mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-20 07:52:30 +02:00
* Check for null results / tracks being created.
This commit is contained in:
parent
9b53dc5c4e
commit
619a2df812
@ -728,9 +728,6 @@ QtScriptResolver::parseResultVariantList( const QVariantList& reslist )
|
||||
foreach( const QVariant& rv, reslist )
|
||||
{
|
||||
QVariantMap m = rv.toMap();
|
||||
if ( m.value( "artist" ).toString().trimmed().isEmpty() || m.value( "track" ).toString().trimmed().isEmpty() )
|
||||
continue;
|
||||
|
||||
// TODO we need to handle preview urls separately. they should never trump a real url, and we need to display
|
||||
// the purchaseUrl for the user to upgrade to a full stream.
|
||||
if ( m.value( "preview" ).toBool() == true )
|
||||
@ -744,7 +741,18 @@ QtScriptResolver::parseResultVariantList( const QVariantList& reslist )
|
||||
}
|
||||
|
||||
Tomahawk::result_ptr rp = Tomahawk::Result::get( m.value( "url" ).toString() );
|
||||
Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(), m.value( "track" ).toString(), m.value( "album" ).toString(), duration, QString(), m.value( "albumpos" ).toUInt(), m.value( "discnumber" ).toUInt() );
|
||||
if ( !rp )
|
||||
continue;
|
||||
|
||||
Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(),
|
||||
m.value( "track" ).toString(),
|
||||
m.value( "album" ).toString(),
|
||||
duration,
|
||||
QString(),
|
||||
m.value( "albumpos" ).toUInt(),
|
||||
m.value( "discnumber" ).toUInt() );
|
||||
if ( !track )
|
||||
continue;
|
||||
|
||||
rp->setBitrate( m.value( "bitrate" ).toUInt() );
|
||||
rp->setSize( m.value( "size" ).toUInt() );
|
||||
|
@ -274,13 +274,16 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
||||
{
|
||||
QVariantMap m = rv.toMap();
|
||||
tDebug( LOGVERBOSE ) << "Found result:" << m;
|
||||
if ( m.value( "artist" ).toString().trimmed().isEmpty() || m.value( "track" ).toString().trimmed().isEmpty() )
|
||||
continue;
|
||||
|
||||
Tomahawk::result_ptr rp = Tomahawk::Result::get( m.value( "url" ).toString() );
|
||||
Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(), m.value( "track" ).toString(), m.value( "album" ).toString(), m.value( "duration" ).toUInt(), QString(), m.value( "albumpos" ).toUInt(), m.value( "discnumber" ).toUInt() );
|
||||
rp->setTrack( track );
|
||||
if ( !rp )
|
||||
continue;
|
||||
|
||||
Tomahawk::track_ptr track = Tomahawk::Track::get( m.value( "artist" ).toString(), m.value( "track" ).toString(), m.value( "album" ).toString(), m.value( "duration" ).toUInt(), QString(), m.value( "albumpos" ).toUInt(), m.value( "discnumber" ).toUInt() );
|
||||
if ( !track )
|
||||
continue;
|
||||
|
||||
rp->setTrack( track );
|
||||
rp->setBitrate( m.value( "bitrate" ).toUInt() );
|
||||
rp->setSize( m.value( "size" ).toUInt() );
|
||||
rp->setRID( uuid() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user