From 34dc6d23ee298a2c5409c57a887a71dfd379d007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Lindstr=C3=B6m?= Date: Thu, 19 Jul 2012 00:50:07 +0200 Subject: [PATCH] Send resulthint when we have it --- .../accounts/spotify/SpotifyPlaylistUpdater.cpp | 5 ++++- src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h | 2 +- src/libtomahawk/resolvers/ScriptResolver.cpp | 2 ++ src/libtomahawk/utils/SpotifyParser.cpp | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp index 7e5c2d236..b4412b3aa 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp +++ b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2012, Leo Franchi + * Copyright 2012, Hugo Lindström * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -680,8 +681,10 @@ SpotifyPlaylistUpdater::variantToQueries( const QVariantList& list ) continue; if ( trackMap.contains( "id" ) ) + { + q->setResultHint( trackMap.value( "id" ).toString() ); q->setProperty( "annotation", trackMap.value( "id" ) ); - + } queries << q; } diff --git a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h index 3ac899a1d..040ad6cf9 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h +++ b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h @@ -1,7 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2012, Leo Franchi - * + * Copyright 2012, Hugo Lindström * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or diff --git a/src/libtomahawk/resolvers/ScriptResolver.cpp b/src/libtomahawk/resolvers/ScriptResolver.cpp index 3bf81dbda..23c615b6e 100644 --- a/src/libtomahawk/resolvers/ScriptResolver.cpp +++ b/src/libtomahawk/resolvers/ScriptResolver.cpp @@ -346,6 +346,8 @@ ScriptResolver::resolve( const Tomahawk::query_ptr& query ) QVariantMap m; m.insert( "_msgtype", "rq" ); + m.insert( "resultHint", query->resultHint() ); + if ( query->isFullTextQuery() ) { m.insert( "fulltext", query->fullTextQuery() ); diff --git a/src/libtomahawk/utils/SpotifyParser.cpp b/src/libtomahawk/utils/SpotifyParser.cpp index 7c37e1ed2..631a99701 100644 --- a/src/libtomahawk/utils/SpotifyParser.cpp +++ b/src/libtomahawk/utils/SpotifyParser.cpp @@ -216,6 +216,9 @@ SpotifyParser::spotifyBrowseFinished() if ( q.isNull() ) continue; + tLog() << "Setting resulthint to " << trackResult.value( "trackuri" ); + q->setResultHint( trackResult.value("trackuri").toString() ); + m_tracks << q; } } @@ -279,7 +282,11 @@ SpotifyParser::spotifyTrackLookupFinished() Tomahawk::query_ptr q = Tomahawk::Query::get( artist, title, album, uuid(), m_trackMode ); if ( !q.isNull() ) + { + tLog() << "Setting resulthint to " << t.value( "trackuri" ); + q->setResultHint( t.value("trackuri").toString() ); m_tracks << q; + } } else {