mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02: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:
@@ -88,13 +88,15 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
|
|||||||
"file.source, "
|
"file.source, "
|
||||||
"file_join.albumpos, "
|
"file_join.albumpos, "
|
||||||
"artist.id as artid, "
|
"artist.id as artid, "
|
||||||
"album.id as albid "
|
"album.id as albid, "
|
||||||
"FROM file, file_join, artist, track "
|
"track_attributes.v as year "
|
||||||
|
"FROM file, file_join, artist, track, track_attributes "
|
||||||
"LEFT JOIN album ON album.id = file_join.album "
|
"LEFT JOIN album ON album.id = file_join.album "
|
||||||
"WHERE "
|
"WHERE "
|
||||||
"artist.id = file_join.artist AND "
|
"artist.id = file_join.artist AND "
|
||||||
"track.id = file_join.track AND "
|
"track.id = file_join.track AND "
|
||||||
"file.id = file_join.file AND "
|
"file.id = file_join.file AND "
|
||||||
|
"file.id = track_attributes.id AND "
|
||||||
"file_join.artist IN (%1) AND "
|
"file_join.artist IN (%1) AND "
|
||||||
"file_join.track IN (%2)" )
|
"file_join.track IN (%2)" )
|
||||||
.arg( artsl.join( "," ) )
|
.arg( artsl.join( "," ) )
|
||||||
@@ -140,6 +142,7 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
|
|||||||
result->setRID( uuid() );
|
result->setRID( uuid() );
|
||||||
result->setAlbumPos( files_query.value( 14 ).toUInt() );
|
result->setAlbumPos( files_query.value( 14 ).toUInt() );
|
||||||
result->setId( files_query.value( 9 ).toUInt() );
|
result->setId( files_query.value( 9 ).toUInt() );
|
||||||
|
result->setYear( files_query.value( 17 ).toUInt() );
|
||||||
|
|
||||||
float score = how_similar( m_query, result );
|
float score = how_similar( m_query, result );
|
||||||
result->setScore( score );
|
result->setScore( score );
|
||||||
|
@@ -580,14 +580,16 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
"file.source, "
|
"file.source, "
|
||||||
"file_join.albumpos, "
|
"file_join.albumpos, "
|
||||||
"artist.id as artid, "
|
"artist.id as artid, "
|
||||||
"album.id as albid "
|
"album.id as albid, "
|
||||||
"FROM file, file_join, artist, track "
|
"track_attributes.v as year "
|
||||||
|
"FROM file, file_join, artist, track, track_attributes "
|
||||||
"LEFT JOIN album ON album.id = file_join.album "
|
"LEFT JOIN album ON album.id = file_join.album "
|
||||||
"WHERE "
|
"WHERE "
|
||||||
"artist.id = file_join.artist AND "
|
"artist.id = file_join.artist AND "
|
||||||
"track.id = file_join.track AND "
|
"track.id = file_join.track AND "
|
||||||
"file.source %1 AND "
|
"file.source %1 AND "
|
||||||
"file_join.file = file.id AND "
|
"file_join.file = file.id AND "
|
||||||
|
"file.id = track_attributes.id AND "
|
||||||
"file.url = ?"
|
"file.url = ?"
|
||||||
).arg( searchlocal ? "IS NULL" : QString( "= %1" ).arg( s->id() ) );
|
).arg( searchlocal ? "IS NULL" : QString( "= %1" ).arg( s->id() ) );
|
||||||
|
|
||||||
@@ -632,6 +634,7 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
res->setRID( uuid() );
|
res->setRID( uuid() );
|
||||||
res->setId( query.value( 9 ).toUInt() );
|
res->setId( query.value( 9 ).toUInt() );
|
||||||
res->setCollection( s->collection() );
|
res->setCollection( s->collection() );
|
||||||
|
res->setYear( query.value( 17 ).toUInt() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@@ -87,6 +87,7 @@ public:
|
|||||||
void setSize( unsigned int size ) { m_size = size; }
|
void setSize( unsigned int size ) { m_size = size; }
|
||||||
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
|
void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
|
||||||
void setModificationTime( unsigned int modtime ) { m_modtime = modtime; }
|
void setModificationTime( unsigned int modtime ) { m_modtime = modtime; }
|
||||||
|
void setYear( unsigned int year ) { m_year = year; }
|
||||||
|
|
||||||
QVariantMap attributes() const { return m_attributes; }
|
QVariantMap attributes() const { return m_attributes; }
|
||||||
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }
|
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }
|
||||||
|
Reference in New Issue
Block a user