From c4b734fcf3b0ecaa33f88e0a0d835fa7317c6c5e Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sat, 2 Feb 2013 16:03:23 +0100 Subject: [PATCH 1/2] Urlencode Spotify URLs to open playlist encoded in Apps links --- src/libtomahawk/utils/SpotifyParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libtomahawk/utils/SpotifyParser.cpp b/src/libtomahawk/utils/SpotifyParser.cpp index ab8a85429..024cf2d79 100644 --- a/src/libtomahawk/utils/SpotifyParser.cpp +++ b/src/libtomahawk/utils/SpotifyParser.cpp @@ -85,6 +85,10 @@ SpotifyParser::lookupUrl( const QString& rawLink ) link.replace( "/", ":" ); link = "spotify:" + link; } + // Some spotify apps contain the link to the playlist as url-encoded in their link (e.g. ShareMyPlaylists) + if ( link.contains( "%3A" ) ) { + link = QUrl::fromPercentEncoding(link.toUtf8()); + } // TODO: Ignoring search and user querys atm // (spotify:(?:(?:artist|album|track|user:[^:]+:playlist):[a-zA-Z0-9]+|user:[^:]+|search:(?:[-\w$\.+!*'(),<>:\s]+|%[a-fA-F0-9\s]{2})+)) QRegExp rx( "(spotify:(?:(?:artist|album|track|user:[^:]+:playlist):[a-zA-Z0-9]+[^:]))" ); From 23fe2de9b111f2d0062c1a4d70adce0416f6aec8 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sat, 2 Feb 2013 17:34:27 +0100 Subject: [PATCH 2/2] Fix coding style --- src/libtomahawk/utils/SpotifyParser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/utils/SpotifyParser.cpp b/src/libtomahawk/utils/SpotifyParser.cpp index 024cf2d79..4219d804a 100644 --- a/src/libtomahawk/utils/SpotifyParser.cpp +++ b/src/libtomahawk/utils/SpotifyParser.cpp @@ -86,8 +86,9 @@ SpotifyParser::lookupUrl( const QString& rawLink ) link = "spotify:" + link; } // Some spotify apps contain the link to the playlist as url-encoded in their link (e.g. ShareMyPlaylists) - if ( link.contains( "%3A" ) ) { - link = QUrl::fromPercentEncoding(link.toUtf8()); + if ( link.contains( "%3A" ) ) + { + link = QUrl::fromPercentEncoding( link.toUtf8() ); } // TODO: Ignoring search and user querys atm // (spotify:(?:(?:artist|album|track|user:[^:]+:playlist):[a-zA-Z0-9]+|user:[^:]+|search:(?:[-\w$\.+!*'(),<>:\s]+|%[a-fA-F0-9\s]{2})+))