mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 23:39:42 +01:00
Add fileid to result and rename dbid to trackid
This commit is contained in:
parent
fa5728d773
commit
b53f83aa95
@ -120,7 +120,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
Tomahawk::artist_ptr artistptr = Tomahawk::Artist::get( query.value( 12 ).toUInt(), artist );
|
||||
Tomahawk::album_ptr albumptr = Tomahawk::Album::get( query.value( 13 ).toUInt(), album, artistptr );
|
||||
|
||||
result->setId( query.value( 14 ).toUInt() );
|
||||
result->setTrackId( query.value( 14 ).toUInt() );
|
||||
result->setArtist( artistptr );
|
||||
result->setAlbum( albumptr );
|
||||
result->setTrack( query.value( 3 ).toString() );
|
||||
@ -137,7 +137,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
QVariantMap attr;
|
||||
|
||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||
attrQuery.bindValue( 0, result->dbid() );
|
||||
attrQuery.bindValue( 0, result->trackId() );
|
||||
attrQuery.exec();
|
||||
while ( attrQuery.next() )
|
||||
{
|
||||
|
@ -156,14 +156,14 @@ DatabaseCommand_Resolve::resolve( DatabaseImpl* lib )
|
||||
result->setTrack( files_query.value( 12 ).toString() );
|
||||
result->setRID( uuid() );
|
||||
result->setAlbumPos( files_query.value( 14 ).toUInt() );
|
||||
result->setId( files_query.value( 9 ).toUInt() );
|
||||
result->setTrackId( files_query.value( 9 ).toUInt() );
|
||||
result->setYear( files_query.value( 17 ).toUInt() );
|
||||
|
||||
TomahawkSqlQuery attrQuery = lib->newquery();
|
||||
QVariantMap attr;
|
||||
|
||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||
attrQuery.bindValue( 0, result->dbid() );
|
||||
attrQuery.bindValue( 0, result->trackId() );
|
||||
attrQuery.exec();
|
||||
while ( attrQuery.next() )
|
||||
{
|
||||
@ -268,12 +268,12 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
|
||||
result->setTrack( files_query.value( 12 ).toString() );
|
||||
result->setRID( uuid() );
|
||||
result->setAlbumPos( files_query.value( 14 ).toUInt() );
|
||||
result->setId( files_query.value( 9 ).toUInt() );
|
||||
result->setTrackId( files_query.value( 9 ).toUInt() );
|
||||
result->setYear( files_query.value( 17 ).toUInt() );
|
||||
|
||||
for ( int k = 0; k < tracks.count(); k++ )
|
||||
{
|
||||
if ( tracks.at( k ).first == (int)result->dbid() )
|
||||
if ( tracks.at( k ).first == (int)result->trackId() )
|
||||
{
|
||||
result->setScore( tracks.at( k ).second );
|
||||
break;
|
||||
@ -284,7 +284,7 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
|
||||
QVariantMap attr;
|
||||
|
||||
attrQuery.prepare( "SELECT k, v FROM track_attributes WHERE id = ?" );
|
||||
attrQuery.bindValue( 0, result->dbid() );
|
||||
attrQuery.bindValue( 0, result->trackId() );
|
||||
attrQuery.exec();
|
||||
while ( attrQuery.next() )
|
||||
{
|
||||
|
@ -249,9 +249,11 @@ DatabaseImpl::file( int fid )
|
||||
r->setArtist( artist );
|
||||
r->setAlbum( album );
|
||||
r->setTrack( query.value( 12 ).toString() );
|
||||
r->setId( query.value( 9 ).toUInt() );
|
||||
r->setTrackId( query.value( 9 ).toUInt() );
|
||||
r->setCollection( s->collection() );
|
||||
r->setScore( 1.0 );
|
||||
r->setRID( query.value( 14 ).toString() );
|
||||
r->setFileId( fid );
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -608,7 +610,7 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
||||
res->setTrack( query.value( 12 ).toString() );
|
||||
res->setAlbumPos( query.value( 14 ).toUInt() );
|
||||
res->setRID( uuid() );
|
||||
res->setId( query.value( 9 ).toUInt() );
|
||||
res->setTrackId( query.value( 9 ).toUInt() );
|
||||
res->setCollection( s->collection() );
|
||||
res->setYear( query.value( 17 ).toUInt() );
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
||||
albumpos1 = r->albumpos();
|
||||
bitrate1 = r->bitrate();
|
||||
mtime1 = r->modificationTime();
|
||||
id1 = r->dbid();
|
||||
id1 = r->trackId();
|
||||
size1 = r->size();
|
||||
}
|
||||
if ( q2->numResults() )
|
||||
@ -343,7 +343,7 @@ TrackProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
||||
albumpos2 = r->albumpos();
|
||||
bitrate2 = r->bitrate();
|
||||
mtime2 = r->modificationTime();
|
||||
id2 = r->dbid();
|
||||
id2 = r->trackId();
|
||||
size2 = r->size();
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,8 @@ Result::Result( const QString& url )
|
||||
, m_modtime( 0 )
|
||||
, m_year( 0 )
|
||||
, m_score( 0 )
|
||||
, m_id( 0 )
|
||||
, m_trackId( 0 )
|
||||
, m_fileId( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,8 @@ public:
|
||||
QList< Tomahawk::SocialAction > allSocialActions();
|
||||
|
||||
void setScore( float score ) { m_score = score; }
|
||||
void setId( unsigned int id ) { m_id = id; }
|
||||
void setTrackId( unsigned int id ) { m_trackId = id; }
|
||||
void setFileId( unsigned int id ) { m_fileId = id; }
|
||||
void setRID( RID id ) { m_rid = id; }
|
||||
void setCollection( const Tomahawk::collection_ptr& collection );
|
||||
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||
@ -104,7 +105,8 @@ public:
|
||||
QVariantMap attributes() const { return m_attributes; }
|
||||
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }
|
||||
|
||||
unsigned int dbid() const { return m_id; }
|
||||
unsigned int trackId() const { return m_trackId; }
|
||||
unsigned int fileId() const { return m_fileId; }
|
||||
|
||||
public slots:
|
||||
void onSocialActionsLoaded();
|
||||
@ -148,7 +150,7 @@ private:
|
||||
|
||||
QVariantMap m_attributes;
|
||||
|
||||
unsigned int m_id;
|
||||
unsigned int m_trackId, m_fileId;
|
||||
|
||||
QHash< QString, QVariant > m_currentSocialActions;
|
||||
QList< SocialAction > m_allSocialActions;
|
||||
|
Loading…
x
Reference in New Issue
Block a user