mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
Fix resulthint saving
This commit is contained in:
@@ -200,23 +200,19 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
|||||||
m_addedmap.insert( e->guid(), e ); // needed in postcommithook
|
m_addedmap.insert( e->guid(), e ); // needed in postcommithook
|
||||||
|
|
||||||
QString resultHint, foundResult;
|
QString resultHint, foundResult;
|
||||||
// Whitelist resulthint protocols
|
|
||||||
bool fromQuery = false;
|
|
||||||
if ( !e->query()->results().isEmpty() )
|
if ( !e->query()->results().isEmpty() )
|
||||||
foundResult = e->query()->results().first()->url();
|
foundResult = e->query()->results().first()->url();
|
||||||
else if ( !e->query()->resultHint().isEmpty() )
|
else if ( !e->query()->resultHint().isEmpty() )
|
||||||
{
|
foundResult = e->query()->resultHint();
|
||||||
resultHint = e->query()->resultHint();
|
|
||||||
foundResult = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( resultHint.startsWith( "file://" ) ||
|
if ( foundResult.startsWith( "file://" ) ||
|
||||||
resultHint.startsWith( "servent://" ) || // Save resulthints for local files and peers automatically
|
foundResult.startsWith( "servent://" ) || // Save resulthints for local files and peers automatically
|
||||||
( fromQuery && e->query()->saveHTTPResultHint() ) )
|
( foundResult.startsWith( "http" ) && e->query()->saveHTTPResultHint() ) )
|
||||||
{
|
{
|
||||||
resultHint = foundResult;
|
resultHint = foundResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
adde.bindValue( 0, e->guid() );
|
adde.bindValue( 0, e->guid() );
|
||||||
adde.bindValue( 1, m_playlistguid );
|
adde.bindValue( 1, m_playlistguid );
|
||||||
adde.bindValue( 2, e->query()->track() );
|
adde.bindValue( 2, e->query()->track() );
|
||||||
|
@@ -618,9 +618,8 @@ DatabaseImpl::resultFromHint( const Tomahawk::query_ptr& origquery )
|
|||||||
s = SourceList::instance()->getLocal();
|
s = SourceList::instance()->getLocal();
|
||||||
fileUrl = url;
|
fileUrl = url;
|
||||||
}
|
}
|
||||||
else
|
else if ( !url.isEmpty() )
|
||||||
{
|
{
|
||||||
// Q_ASSERT( false );
|
|
||||||
res = Tomahawk::Result::get( url );
|
res = Tomahawk::Result::get( url );
|
||||||
res->setRID( uuid() );
|
res->setRID( uuid() );
|
||||||
res->setScore( 1.0 );
|
res->setScore( 1.0 );
|
||||||
|
Reference in New Issue
Block a user