Version: 2.2-GIT (using 4.3.85 (KDE 4.3.85 (KDE 4.4 Beta2)), compiled sources) Compiler: gcc OS: Linux (i686) release 2.6.30-gentoo-r8 EngineController::canDecode() decides whether it can decode a file by simple matching a QString mimetype of a file to a QStringList of mimetypes returned by the engine. This ignores the fact that mimetypes are in hierarchy and in fact there might not be a string match even if the type is listed. In particular, on my system it leads to Amarok being unable to recognize ogg vorbis files in filesystem browser as playable. KFileInfo returns audio/x-vorbis type for them, but the closest thing on the engine's list is audio/x-vorbis+ogg. Using KMimeType::is() function instead of string matching solves the problem. Patch follows.
Created attachment 39279 [details] Patch solving the problem
commit bdb9b1af986d58bb104da07f14b730fdd820e40f Author: Mark Kretschmann <kretschmann@kde.org> Date: Wed Dec 23 09:14:27 2009 +0100 More reliable MimeType detection for music formats. Patch by RafaÅ Rzepecki <divided.mind@gmail.com>. BUG: 219792 diff --git a/ChangeLog b/ChangeLog index 8b6e6c5..43c6236 100644 --- a/ChangeLog +++ b/ChangeLog @@ -77,6 +77,8 @@ VERSION 2.2.2 PowerTOP when using the Xine backend. BUGFIXES: + * More reliable MimeType detection for music formats. Patch by RafaÅ + Rzepecki <divided.mind@gmail.com>. (BR 219792) * Fixed regression causing many scripted services, including the, shipped by default, LibriVox service to not work at all. * Fixed corner case that could prevent scans from being completed, diff --git a/src/EngineController.cpp b/src/EngineController.cpp index 55f607f..b055994 100644 --- a/src/EngineController.cpp +++ b/src/EngineController.cpp @@ -219,11 +219,20 @@ EngineController::canDecode( const KUrl &url ) //static mimeTable << "audio/x-m4b"; // MP4 Audio Books have a different extension that KFileItem/Phonon don't grok //mimeTable << "?/?"; //Add comment - const QString mimeType = item.mimetype(); - const bool valid = mimeTable.contains( mimeType, Qt::CaseInsensitive ); + const KMimeType::Ptr mimeType = item.mimeTypePtr(); + + bool valid = false; + foreach( const QString &type, mimeTable ) + { + if( mimeType->is( type ) ) + { + valid = true; + break; + } + } - //we special case this as otherwise users hate us - if ( !valid && ( mimeType == "audio/mp3" || mimeType == "audio/x-mp3" ) && !installDistroCodec() ) + // We special case this, as otherwise the users would hate us + if ( !valid && ( mimeType->is( "audio/mp3" ) || mimeType->is( "audio/x-mp3" ) ) && !installDistroCodec() ) The::statusBar()->longMessage( i18n( "<p>Phonon claims it <b>cannot</b> play MP3 files. You may want to examine " "the installation of the backend that phonon uses.</p>"