Commit 402623fc authored by Sergey Ivanov's avatar Sergey Ivanov
Browse files

Screen escape characters in MusicBrainz request string.

BUG: 269455
parent bba5d6c7
......@@ -5,6 +5,7 @@ Amarok ChangeLog
VERSION 2.4.1
BUGFIXES:
* Screen escape characters in MusicBrainz request string. (BR: 269455)
* Fixed detection of iPod devices.
* Fixed crash when the lyrics applet was removed and re-added while a
track was playing and the user pressed "ESC".
......
......@@ -435,12 +435,16 @@ MusicBrainzFinder::compileRequest( const Meta::TrackPtr &track )
QString query = QString( "dur:(%1)" ).arg( track->length() );
QVariantMap metadata = guessMetadata( track );
QRegExp escape( "([~!\\^&*()\\-+\\[\\]{}\\\\:\"?])" );
QString replacement( "\\\\1" );
#define VALUE(s) metadata.value( s ).toString().replace( escape, replacement )
if( metadata.contains( Meta::Field::TITLE ) )
query += QString( " track:(%1)" ).arg( metadata.value( Meta::Field::TITLE ).toString() );
query += QString( " track:(%1)" ).arg( VALUE( Meta::Field::TITLE ) );
if( metadata.contains( Meta::Field::ARTIST ) )
query += QString( " artist:(%1)" ).arg( metadata.value( Meta::Field::ARTIST ).toString() );
query += QString( " artist:(%1)" ).arg( VALUE( Meta::Field::ARTIST ) );
if( metadata.contains( Meta::Field::ALBUM ) )
query += QString ( " release:(%1)" ).arg( metadata.value( Meta::Field::ALBUM ).toString() );
query += QString ( " release:(%1)" ).arg( VALUE( Meta::Field::ALBUM ) );
#undef VALUE
m_parsedMetaData.insert( track, metadata );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment