diff --git a/src/libtomahawk/AlbumPlaylistInterface.cpp b/src/libtomahawk/AlbumPlaylistInterface.cpp index c5b4f60d9..e4b74e039 100644 --- a/src/libtomahawk/AlbumPlaylistInterface.cpp +++ b/src/libtomahawk/AlbumPlaylistInterface.cpp @@ -198,7 +198,7 @@ AlbumPlaylistInterface::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData re foreach ( const QString& trackName, tracks ) { - track_ptr track = Track::get( inputInfo[ "artist" ], trackName, inputInfo[ "album" ], 0, QString(), trackNo++ ); + track_ptr track = Track::get( inputInfo[ "artist" ], trackName, inputInfo[ "album" ], QString(), 0, QString(), trackNo++ ); query_ptr query = Query::get( track ); if ( query ) ql << query; diff --git a/src/libtomahawk/ArtistPlaylistInterface.cpp b/src/libtomahawk/ArtistPlaylistInterface.cpp index d6a6568d8..bce671177 100644 --- a/src/libtomahawk/ArtistPlaylistInterface.cpp +++ b/src/libtomahawk/ArtistPlaylistInterface.cpp @@ -158,7 +158,7 @@ ArtistPlaylistInterface::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData r foreach ( const QString& trackName, tracks ) { - track_ptr track = Track::get( inputInfo[ "artist" ], trackName, inputInfo[ "album" ], 0, QString(), trackNo++ ); + track_ptr track = Track::get( inputInfo[ "artist" ], trackName, inputInfo[ "album" ], QString(), 0, QString(), trackNo++ ); query_ptr query = Query::get( track ); if ( query ) ql << query; diff --git a/src/libtomahawk/audio/AudioEngine.cpp b/src/libtomahawk/audio/AudioEngine.cpp index 22160170b..7f4faef75 100644 --- a/src/libtomahawk/audio/AudioEngine.cpp +++ b/src/libtomahawk/audio/AudioEngine.cpp @@ -848,7 +848,7 @@ AudioEngine::play( const QUrl& url ) if ( !tags.isEmpty() ) { t = Track::get( tags["artist"].toString(), tags["track"].toString(), tags["album"].toString(), - tags["duration"].toInt(), tags["composer"].toString(), + tags["albumArtist"].toString(), tags["duration"].toInt(), tags["composer"].toString(), tags["albumpos"].toUInt(), tags["discnumber"].toUInt() ); } else diff --git a/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp b/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp index 61da74976..bff5c06c3 100644 --- a/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp +++ b/src/libtomahawk/database/DatabaseCommand_AllTracks.cpp @@ -76,14 +76,16 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi ) } QString sql = QString( - "SELECT file.id, artist.name, album.name, track.name, composer.name, file.size, " //0 - "file.duration, file.bitrate, file.url, file.source, file.mtime, " //6 - "file.mimetype, file_join.discnumber, file_join.albumpos, track.id " //11 + "SELECT file.id, artist.name, album.name, track.name, composer.name, file.size, " //0 + "file.duration, file.bitrate, file.url, file.source, file.mtime, " //6 + "file.mimetype, file_join.discnumber, file_join.albumpos, track.id, albumArtist.name " //11 "FROM file, artist, track, file_join " "LEFT OUTER JOIN album " "ON file_join.album = album.id " "LEFT OUTER JOIN artist AS composer " "ON file_join.composer = composer.id " + "LEFT OUTER JOIN artist AS albumArtist " + "ON album.artist = albumArtist.id " "WHERE file.id = file_join.file " "AND file_join.artist = artist.id " "AND file_join.track = track.id " @@ -106,20 +108,21 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi ) while( query.next() ) { - QString artist = query.value( 1 ).toString(); - QString album = query.value( 2 ).toString(); - QString track = query.value( 3 ).toString(); - QString composer = query.value( 4 ).toString(); - uint size = query.value( 5 ).toUInt(); - uint duration = query.value( 6 ).toUInt(); - uint bitrate = query.value( 7 ).toUInt(); + const QString artist = query.value( 1 ).toString(); + const QString album = query.value( 2 ).toString(); + const QString track = query.value( 3 ).toString(); + const QString composer = query.value( 4 ).toString(); + const uint size = query.value( 5 ).toUInt(); + const uint duration = query.value( 6 ).toUInt(); + const uint bitrate = query.value( 7 ).toUInt(); QString url = query.value( 8 ).toString(); - uint sourceId = query.value( 9 ).toUInt(); - uint modificationTime = query.value( 10 ).toUInt(); - QString mimetype = query.value( 11 ).toString(); - uint discnumber = query.value( 12 ).toUInt(); - uint albumpos = query.value( 13 ).toUInt(); - uint trackId = query.value( 14 ).toUInt(); + const uint sourceId = query.value( 9 ).toUInt(); + const uint modificationTime = query.value( 10 ).toUInt(); + const QString mimetype = query.value( 11 ).toString(); + const uint discnumber = query.value( 12 ).toUInt(); + const uint albumpos = query.value( 13 ).toUInt(); + const uint trackId = query.value( 14 ).toUInt(); + const QString albumArtist = query.value( 15 ).toString(); std::unordered_map::const_iterator _s = sourceCache.find( sourceId ); Tomahawk::source_ptr s; @@ -142,7 +145,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi ) Tomahawk::track_ptr t = Tomahawk::Track::get( trackId, artist, track, album, - duration, composer, + albumArtist, duration, composer, albumpos, discnumber ); if ( !t ) continue; diff --git a/src/libtomahawk/database/DatabaseCommand_Resolve.cpp b/src/libtomahawk/database/DatabaseCommand_Resolve.cpp index e3bc07cdb..e001227af 100644 --- a/src/libtomahawk/database/DatabaseCommand_Resolve.cpp +++ b/src/libtomahawk/database/DatabaseCommand_Resolve.cpp @@ -111,10 +111,13 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib ) "file_join.albumpos, " //17 "artist.id as artid, " //18 "album.id as albid, " //19 - "composer.id as cmpid " //20 + "composer.id as cmpid, " //20 + "albumArtist.id as albumartistid, " //21 + "albumArtist.name as albumartistname " //22 "FROM file, file_join, artist, track " "LEFT JOIN album ON album.id = file_join.album " "LEFT JOIN artist AS composer ON composer.id = file_join.composer " + "LEFT JOIN artist AS albumArtist ON albumArtist.id = album.artist " "WHERE " "artist.id = file_join.artist AND " "track.id = file_join.track AND " @@ -145,7 +148,9 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib ) continue; } - track_ptr track = Track::get( files_query.value( 9 ).toUInt(), files_query.value( 12 ).toString(), files_query.value( 14 ).toString(), files_query.value( 13 ).toString(), files_query.value( 5 ).toUInt(), files_query.value( 15 ).toString(), files_query.value( 17 ).toUInt(), files_query.value( 11 ).toUInt() ); + track_ptr track = Track::get( files_query.value( 9 ).toUInt(), files_query.value( 12 ).toString(), files_query.value( 14 ).toString(), + files_query.value( 13 ).toString(), files_query.value( 22 ).toString(), files_query.value( 5 ).toUInt(), + files_query.value( 15 ).toString(), files_query.value( 17 ).toUInt(), files_query.value( 11 ).toUInt() ); if ( !track ) continue; track->loadAttributes(); @@ -224,10 +229,13 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib ) "file_join.albumpos, " //17 "artist.id as artid, " //18 "album.id as albid, " //19 - "composer.id as cmpid " //20 + "composer.id as cmpid, " //20 + "albumArtist.id as albumartistid, " //21 + "albumArtist.name as albumartistname " //22 "FROM file, file_join, artist, track " "LEFT JOIN album ON album.id = file_join.album " "LEFT JOIN artist AS composer ON composer.id = file_join.composer " + "LEFT JOIN artist AS albumArtist ON albumArtist.id = album.artist " "WHERE " "artist.id = file_join.artist AND " "track.id = file_join.track AND " @@ -258,7 +266,9 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib ) continue; } - track_ptr track = Track::get( files_query.value( 9 ).toUInt(), files_query.value( 12 ).toString(), files_query.value( 14 ).toString(), files_query.value( 13 ).toString(), files_query.value( 5 ).toUInt(), files_query.value( 15 ).toString(), files_query.value( 17 ).toUInt(), files_query.value( 11 ).toUInt() ); + track_ptr track = Track::get( files_query.value( 9 ).toUInt(), files_query.value( 12 ).toString(), files_query.value( 14 ).toString(), + files_query.value( 13 ).toString(), files_query.value( 22 ).toString(), files_query.value( 5 ).toUInt(), + files_query.value( 15 ).toString(), files_query.value( 17 ).toUInt(), files_query.value( 11 ).toUInt() ); track->loadAttributes(); result = Result::get( url, track ); diff --git a/src/libtomahawk/database/DatabaseImpl.cpp b/src/libtomahawk/database/DatabaseImpl.cpp index 63d3363bc..323af70ea 100644 --- a/src/libtomahawk/database/DatabaseImpl.cpp +++ b/src/libtomahawk/database/DatabaseImpl.cpp @@ -290,11 +290,12 @@ Tomahawk::DatabaseImpl::file( int fid ) TomahawkSqlQuery query = newquery(); query.exec( QString( "SELECT url, mtime, size, md5, mimetype, duration, bitrate, " "file_join.artist, file_join.album, file_join.track, file_join.composer, " - "(select name from artist where id = file_join.artist) as artname, " - "(select name from album where id = file_join.album) as albname, " - "(select name from track where id = file_join.track) as trkname, " - "(select name from artist where id = file_join.composer) as cmpname, " - "source " + "(SELECT name FROM artist WHERE id = file_join.artist) AS artname, " + "(SELECT name FROM album WHERE id = file_join.album) AS albname, " + "(SELECT name FROM track WHERE id = file_join.track) AS trkname, " + "(SELECT name FROM artist WHERE id = file_join.composer) AS cmpname, " + "source, " + "(SELECT artist.name FROM artist, album WHERE artist.id = album.artist AND album.id = file_join.album) AS albumartname " "FROM file, file_join " "WHERE file.id = file_join.file AND file.id = %1" ) .arg( fid ) ); @@ -308,7 +309,9 @@ Tomahawk::DatabaseImpl::file( int fid ) if ( !s->isLocal() ) url = QString( "servent://%1\t%2" ).arg( s->nodeId() ).arg( url ); - Tomahawk::track_ptr track = Tomahawk::Track::get( query.value( 9 ).toUInt(), query.value( 11 ).toString(), query.value( 13 ).toString(), query.value( 12 ).toString(), query.value( 5 ).toUInt(), query.value( 14 ).toString(), 0, 0 ); + Tomahawk::track_ptr track = Tomahawk::Track::get( query.value( 9 ).toUInt(), query.value( 11 ).toString(), query.value( 13 ).toString(), + query.value( 12 ).toString(), query.value( 16 ).toString(), query.value( 5 ).toUInt(), + query.value( 14 ).toString(), 0, 0 ); if ( !track ) return r; r = Tomahawk::Result::get( url, track ); @@ -633,6 +636,7 @@ Tomahawk::DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) Tomahawk::track_ptr track = Tomahawk::Track::get( origquery->queryTrack()->artist(), origquery->queryTrack()->track(), origquery->queryTrack()->album(), + QString(), origquery->queryTrack()->duration() ); // Return http resulthint directly @@ -674,10 +678,13 @@ Tomahawk::DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) "file_join.discnumber, " //17 "artist.id as artid, " //18 "album.id as albid, " //19 - "composer.id as cmpid " //20 + "composer.id as cmpid, " //20 + "albumArtist.id as albumartistid, " //21 + "albumArtist.name as albumartistname " //22 "FROM file, file_join, artist, track " "LEFT JOIN album ON album.id = file_join.album " "LEFT JOIN artist AS composer on composer.id = file_join.composer " + "LEFT JOIN artist AS albumArtist on albumArtist.id = album.artist " "WHERE " "artist.id = file_join.artist AND " "track.id = file_join.track AND " @@ -703,6 +710,7 @@ Tomahawk::DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery ) query.value( 11 ).toString(), query.value( 13 ).toString(), query.value( 12 ).toString(), + query.value( 22 ).toString(), query.value( 5 ).toInt(), query.value( 14 ).toString(), query.value( 16 ).toUInt(), diff --git a/src/libtomahawk/resolvers/JSResolver.cpp b/src/libtomahawk/resolvers/JSResolver.cpp index 7fbe10f90..0d08bd281 100644 --- a/src/libtomahawk/resolvers/JSResolver.cpp +++ b/src/libtomahawk/resolvers/JSResolver.cpp @@ -585,6 +585,7 @@ JSResolver::parseResultVariantList( const QVariantList& reslist ) Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(), m.value( "track" ).toString(), m.value( "album" ).toString(), + m.value( "albumartist" ).toString(), duration, QString(), m.value( "albumpos" ).toUInt(), diff --git a/src/libtomahawk/resolvers/ScriptResolver.cpp b/src/libtomahawk/resolvers/ScriptResolver.cpp index 090ecbbab..6d23587dd 100644 --- a/src/libtomahawk/resolvers/ScriptResolver.cpp +++ b/src/libtomahawk/resolvers/ScriptResolver.cpp @@ -290,7 +290,14 @@ ScriptResolver::handleMsg( const QByteArray& msg ) QVariantMap m = rv.toMap(); tDebug( LOGVERBOSE ) << "Found result:" << m; - Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(), m.value( "track" ).toString(), m.value( "album" ).toString(), m.value( "duration" ).toUInt(), QString(), m.value( "albumpos" ).toUInt(), m.value( "discnumber" ).toUInt() ); + Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(), + m.value( "track" ).toString(), + m.value( "album" ).toString(), + m.value( "albumartist" ).toString(), + m.value( "duration" ).toUInt(), + QString(), + m.value( "albumpos" ).toUInt(), + m.value( "discnumber" ).toUInt() ); if ( !track ) continue; diff --git a/src/libtomahawk/utils/JspfLoader.cpp b/src/libtomahawk/utils/JspfLoader.cpp index 1ccc1c13b..06a514517 100644 --- a/src/libtomahawk/utils/JspfLoader.cpp +++ b/src/libtomahawk/utils/JspfLoader.cpp @@ -178,7 +178,7 @@ JSPFLoader::gotBody() continue; } - track_ptr t = Tomahawk::Track::get( artist, track, album, duration.toInt() / 1000 ); + track_ptr t = Tomahawk::Track::get( artist, track, album, QString(), duration.toInt() / 1000 ); query_ptr q = Tomahawk::Query::get( t ); if ( !q ) continue; diff --git a/src/libtomahawk/utils/XspfLoader.cpp b/src/libtomahawk/utils/XspfLoader.cpp index 75c951883..b9c939728 100644 --- a/src/libtomahawk/utils/XspfLoader.cpp +++ b/src/libtomahawk/utils/XspfLoader.cpp @@ -291,7 +291,7 @@ XSPFLoader::gotBody() continue; } - track_ptr t = Tomahawk::Track::get( artist, track, album, duration.toInt() / 1000 ); + track_ptr t = Tomahawk::Track::get( artist, track, album, QString(), duration.toInt() / 1000 ); query_ptr q = Tomahawk::Query::get( t ); if ( q.isNull() ) continue;