Bug 130993

Summary: "Jobs" tab "Encoding" line reports wrong format
Product: [Applications] kaudiocreator Reporter: Robert Morrison <orbert>
Component: generalAssignee: Gerd Fleischer <gerdfleischer>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot

Description Robert Morrison 2006-07-17 20:59:07 UTC
Version:           1.13 (using KDE KDE 3.5.3)
Installed from:    SuSE RPMs
OS:                Linux

When ripping/encoding a CD with more than one track, and encoding to mp3,
the "Encoding" line for the first track shows "ogg" instead of "mp3".
The file is actually encoded in mp3.
Comment 1 Robert Morrison 2006-07-17 21:02:53 UTC
Created attachment 17014 [details]
Screenshot

Screenshot: note line 11.
Comment 2 d.account 2007-03-23 19:33:38 UTC
KAudioCreator 1.13
Using KDE 3.5.5 release 45
OpenSUSE 10.2  64 bit

Error in display of ripping file type in job tab - description column.

After ripping a track and file encoding begins, the description column
gives a display of Encoding (FileType):Track info.  The filetype displayed 
is the previously used filetype, though the file is saved as the proper
requested filetype.

For example, take the same track and rip it sequentially encoding in the 
following order:

Encode as     Description displays     Saves as
ogg                                    ogg
wav           ogg                      wav
mp3           wav                      mp3
flac          mp3                      flac
Comment 3 Richard Lärkäng 2007-08-15 13:48:15 UTC
SVN commit 700376 by larkang:

Use correct EncoderPrefs, so the extension is displayed correctly
when changing the encoder

BUG: 130993


 M  +8 -7      encoder.cpp  
 M  +1 -2      encoder.h  
 M  +3 -0      tracksimp.cpp  


--- trunk/extragear/multimedia/kaudiocreator/encoder.cpp #700375:700376
@@ -50,13 +50,16 @@
 		tendToNewJobs();
 }
 
-void Encoder::loadEncoder( int encoder ){
+EncoderPrefs* Encoder::loadEncoder( int encoder ){
+	EncoderPrefs* prefs;
 	QString currentEncoderGroup = QString("Encoder_%1").arg(encoder);
 	prefs = EncoderPrefs::prefs(currentEncoderGroup);
 	if ( !EncoderPrefs::hasPrefs(currentEncoderGroup) ) {
 		KMessageBox::sorry(0, i18n("No encoder has been selected.\nPlease select an encoder in the configuration."), i18n("No Encoder Selected"));
 		prefs->setCommandLine(QString::null);
 	}
+
+	return prefs;
 }
 
 /**
@@ -128,7 +131,8 @@
  * @param job the job to encode.
  */
 void Encoder::encodeWav(Job *job ) {
-	emit(addJob(job, i18n("Encoding (%1): %2 - %3", prefs->extension(), job->track_artist, job->track_title)));
+	emit(addJob(job, i18n("Encoding (%1): %2 - %3", loadEncoder(job->encoder)->extension(),
+	                                                job->track_artist, job->track_title)));
 	pendingJobs.append(job);
 	tendToNewJobs();
 }
@@ -152,10 +156,7 @@
 	Job *job = pendingJobs.first();
 	pendingJobs.remove(job);
 
-	// if encoder is selected load it.
-	if ( job->encoder != -1 ){
-		loadEncoder(job->encoder);
-	}
+	EncoderPrefs* prefs = loadEncoder(job->encoder);
 
 	QString desiredFile = Prefs::fileFormat();
 	desiredFile.replace( QRegExp("~"), QDir::homePath() );
@@ -251,7 +252,7 @@
 		return;
 	}
 	//qDebug(QString("Pre cropped: %1").arg(output).latin1());
-	output = output.mid(output.indexOf('%')-prefs->percentLength(),2);
+	output = output.mid(output.indexOf('%')-loadEncoder(job->encoder)->percentLength(),2);
 	//qDebug(QString("Post cropped: %1").arg(output).latin1());
 	bool conversionSuccessfull = false;
 	int percent = output.toInt(&conversionSuccessfull);
--- trunk/extragear/multimedia/kaudiocreator/encoder.h #700375:700376
@@ -48,7 +48,7 @@
   void removeJob(int id);
   void encodeWav(Job *job);
   void loadSettings();
-	void loadEncoder( int encoder );
+  EncoderPrefs* loadEncoder( int encoder );
 
 private slots:
   void receivedThreadOutput(K3Process *process, char *buffer, int buflen);
@@ -60,7 +60,6 @@
   Q3PtrList<K3ShellProcess> threads;
   QMap<K3ShellProcess*, Job*> jobs;
 
-  EncoderPrefs *prefs;
   int reportCount;
 };
 
--- trunk/extragear/multimedia/kaudiocreator/tracksimp.cpp #700375:700376
@@ -378,6 +378,9 @@
 		if( r == KMessageBox::No )
 			return;
 	}
+
+	if (encoder == -1)
+		encoder = Prefs::currentEncoder();
 	
 	Job *lastJob = 0;