1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-29 16:50:11 +02:00

* Fixed using resolv-hints for offline sources.

This commit is contained in:
Christian Muehlhaeuser
2011-01-10 12:00:52 +01:00
parent 18d5d43695
commit 0dd7d1e0e0
2 changed files with 15 additions and 5 deletions

View File

@@ -37,16 +37,23 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib )
if ( !m.isEmpty() ) if ( !m.isEmpty() )
{ {
if ( m.value( "srcid" ).toUInt() > 0 ) if ( m.value( "srcid" ).toUInt() > 0 )
coll = SourceList::instance()->get( m.value( "srcid" ).toUInt() )->collection(); {
source_ptr s = SourceList::instance()->get( m.value( "srcid" ).toUInt() );
if ( !s.isNull() )
coll = s->collection();
}
else else
coll = SourceList::instance()->getLocal()->collection(); coll = SourceList::instance()->getLocal()->collection();
if ( !coll.isNull() )
{
res << Tomahawk::result_ptr( new Tomahawk::Result( m, coll ) ); res << Tomahawk::result_ptr( new Tomahawk::Result( m, coll ) );
emit results( qid, res ); emit results( qid, res );
return; return;
} }
} }
}
/* /*
Resolving is a 2 stage process. Resolving is a 2 stage process.

View File

@@ -477,6 +477,7 @@ DatabaseImpl::result( const QString& url )
{ {
TomahawkSqlQuery query = newquery(); TomahawkSqlQuery query = newquery();
Tomahawk::source_ptr s; Tomahawk::source_ptr s;
QVariantMap m;
QString fileUrl; QString fileUrl;
if ( url.contains( "servent://" ) ) if ( url.contains( "servent://" ) )
@@ -484,6 +485,9 @@ DatabaseImpl::result( const QString& url )
QStringList parts = url.mid( QString( "servent://" ).length() ).split( "\t" ); QStringList parts = url.mid( QString( "servent://" ).length() ).split( "\t" );
s = SourceList::instance()->get( parts.at( 0 ) ); s = SourceList::instance()->get( parts.at( 0 ) );
fileUrl = parts.at( 1 ); fileUrl = parts.at( 1 );
if ( s.isNull() )
return m;
} }
else if ( url.contains( "file://" ) ) else if ( url.contains( "file://" ) )
{ {
@@ -518,7 +522,6 @@ DatabaseImpl::result( const QString& url )
query.bindValue( 0, fileUrl ); query.bindValue( 0, fileUrl );
query.exec(); query.exec();
QVariantMap m;
if( query.next() ) if( query.next() )
{ {
const QString url_str = query.value( 0 ).toString(); const QString url_str = query.value( 0 ).toString();