1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 08:19:42 +01:00

Load the year for results.

Fixes TWK-183. This will take some thinking post-0.1 as years are stored by trackid right now so if you get a peer's database with a clashing trackid we'll not handle that properly
This commit is contained in:
Leo Franchi 2011-05-21 10:02:04 -04:00
parent 6714865384
commit 6b877e3364
3 changed files with 11 additions and 4 deletions

View File

@ -88,13 +88,15 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
"file.source, "
"file_join.albumpos, "
"artist.id as artid, "
"album.id as albid "
"FROM file, file_join, artist, track "
"album.id as albid, "
"track_attributes.v as year "
"FROM file, file_join, artist, track, track_attributes "
"LEFT JOIN album ON album.id = file_join.album "
"WHERE "
"artist.id = file_join.artist AND "
"track.id = file_join.track AND "
"file.id = file_join.file AND "
"file.id = track_attributes.id AND "
"file_join.artist IN (%1) AND "
"file_join.track IN (%2)" )
.arg( artsl.join( "," ) )
@ -140,6 +142,7 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
result->setRID( uuid() );
result->setAlbumPos( files_query.value( 14 ).toUInt() );
result->setId( files_query.value( 9 ).toUInt() );
result->setYear( files_query.value( 17 ).toUInt() );
float score = how_similar( m_query, result );
result->setScore( score );

View File

@ -580,14 +580,16 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
"file.source, "
"file_join.albumpos, "
"artist.id as artid, "
"album.id as albid "
"FROM file, file_join, artist, track "
"album.id as albid, "
"track_attributes.v as year "
"FROM file, file_join, artist, track, track_attributes "
"LEFT JOIN album ON album.id = file_join.album "
"WHERE "
"artist.id = file_join.artist AND "
"track.id = file_join.track AND "
"file.source %1 AND "
"file_join.file = file.id AND "
"file.id = track_attributes.id AND "
"file.url = ?"
).arg( searchlocal ? "IS NULL" : QString( "= %1" ).arg( s->id() ) );
@ -632,6 +634,7 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
res->setRID( uuid() );
res->setId( query.value( 9 ).toUInt() );
res->setCollection( s->collection() );
res->setYear( query.value( 17 ).toUInt() );
}
return res;

View File

@ -87,6 +87,7 @@ public:
void setSize( unsigned int size ) { m_size = size; }
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
void setModificationTime( unsigned int modtime ) { m_modtime = modtime; }
void setYear( unsigned int year ) { m_year = year; }
QVariantMap attributes() const { return m_attributes; }
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }