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

* Always sync the PlaylistEntry's result-hint to the database - never the Query's.

This commit is contained in:
Christian Muehlhaeuser 2013-04-26 09:10:23 +02:00
parent 5cdc8e40c6
commit 7b4c025b2a
2 changed files with 2 additions and 27 deletions

View File

@ -158,7 +158,7 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
if ( !e->query()->numResults() )
continue;
adde.bindValue( 0, hintFromQuery( e->query() ) );
adde.bindValue( 0, e->resultHint() );
adde.bindValue( 1, e->guid() );
adde.exec();
}
@ -204,8 +204,6 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
m_addedmap.insert( e->guid(), e ); // needed in postcommithook
const QString resultHint = hintFromQuery( e->query() );
adde.bindValue( 0, e->guid() );
adde.bindValue( 1, m_playlistguid );
adde.bindValue( 2, e->query()->queryTrack()->track() );
@ -215,7 +213,7 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
adde.bindValue( 6, (int) e->duration() );
adde.bindValue( 7, e->lastmodified() );
adde.bindValue( 8, source()->isLocal() ? QVariant(QVariant::Int) : source()->id() );
adde.bindValue( 9, resultHint );
adde.bindValue( 9, e->resultHint() );
adde.exec();
}
}
@ -272,24 +270,3 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
// Q_ASSERT( false );
}
}
QString
DatabaseCommand_SetPlaylistRevision::hintFromQuery( const query_ptr& query ) const
{
QString resultHint, foundResult;
if ( !query->results().isEmpty() )
foundResult = query->results().first()->url();
else if ( !query->resultHint().isEmpty() )
foundResult = query->resultHint();
if ( foundResult.startsWith( "file://" ) ||
foundResult.startsWith( "servent://" ) || // Save resulthints for local files and peers automatically
( TomahawkUtils::whitelistedHttpResultHint( foundResult ) && query->saveHTTPResultHint() ) )
{
resultHint = foundResult;
}
return resultHint;
}

View File

@ -122,8 +122,6 @@ protected:
QString m_currentRevision;
private:
QString hintFromQuery( const query_ptr& query ) const;
QVariantList m_orderedguids;
QList<Tomahawk::plentry_ptr> m_addedentries, m_entries;