Version: Amarok 1.4-SVN (oct 31,2007) (using KDE KDE 3.5.8) Installed from: Ubuntu Packages OS: Linux Artists such as "Crosby, Stills, & Nash" weren't properly loading similar Artists. I've fixed this locally by escaping "&", ",", and "?" in the artist name, before it is added to the AS request URL. there must be a QString routine to escape characters that are reserved for HTTP queries. -=-=-=-=-=-=-=-= new code below . amarok/src/scrobbler.cpp line 69 void Scrobbler::similarArtists( const QString & artist ) { QString safeArtist = QDeepCopy<QString>( artist ); if ( AmarokConfig::retrieveSimilarArtists() ) { // Request looks like this: // http://ws.audioscrobbler.com/1.0/artist/Metallica/similar.xml m_similarArtistsBuffer = QByteArray(); m_artist = artist; safeArtist.replace("?","%3F").replace("&","%26").replace(",","%2C"); m_similarArtistsJob = KIO::get( "http://ws.audioscrobbler.com/1.0/artist/" + safeArtist + "/similar.xml", false, false ); connect( m_similarArtistsJob, SIGNAL( result( KIO::Job* ) ), this, SLOT( audioScrobblerSimilarArtistsResult( KIO::Job* ) ) ); connect( m_similarArtistsJob, SIGNAL( data( KIO::Job*, const QByteArray& ) ), this, SLOT( audioScrobblerSimilarArtistsData( KIO::Job*, const QByteArray& ) ) ); } }
add .replace("/","%2F"); as well
This doesn't go far enough because of unicode characters. I think the correct way to do this would be to use Qt::escape(), but I am not sure about that.
I apologise if im talking complete bs, but im a bit of a newbie in the whole kde, amarok and general development area! Is there a function (it may be QT::escape(), but there you go!) that will replace all characters with their escape sequence? (i.e. "/" -> "%2F") This may be overkill, but it will sort all unicode characters, and ensure there are absolutely _no_ problems with characters in requests. Gary
I could not find such a function in Qt. If you do, please let us know.
Not managed to find a function as of yet. I know Qt::escape() wont work. I'll have a go at writing my own as soon as I get chance. Shouldn't be too hard (i hope!) Gary
It is in the documentation, but I am not a programmer nor do I play one on tv. http://doc.trolltech.com/4.3/qt.html#escape
SVN commit 841074 by markey: Html-escape similar artists string before lookup. The code is commented out (not yet implemented in Amarok 2) but I've fixed it anyway. BUG: 151748 M +1 -1 CollectionManager.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=841074