mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
Support artist name (for compilations) and albumpos+discnumber (for multi disc releases) in InfoAlbumSongs info request
This commit is contained in:
@@ -187,7 +187,7 @@ AlbumPlaylistInterface::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData re
|
|||||||
Tomahawk::InfoSystem::InfoStringHash inputInfo;
|
Tomahawk::InfoSystem::InfoStringHash inputInfo;
|
||||||
inputInfo = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
inputInfo = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
||||||
|
|
||||||
QStringList tracks = returnedData[ "tracks" ].toStringList();
|
QVariantList data = returnedData[ "tracks" ].toList();
|
||||||
QList<query_ptr> ql;
|
QList<query_ptr> ql;
|
||||||
|
|
||||||
//TODO: Figure out how to do this with a multi-disk album without breaking the
|
//TODO: Figure out how to do this with a multi-disk album without breaking the
|
||||||
@@ -196,9 +196,42 @@ AlbumPlaylistInterface::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData re
|
|||||||
// which should make this easier. --Teo 11/2011
|
// which should make this easier. --Teo 11/2011
|
||||||
unsigned int trackNo = 1;
|
unsigned int trackNo = 1;
|
||||||
|
|
||||||
foreach ( const QString& trackName, tracks )
|
foreach ( const QVariant& datum, data )
|
||||||
{
|
{
|
||||||
track_ptr track = Track::get( inputInfo[ "artist" ], trackName, inputInfo[ "album" ], QString(), 0, QString(), trackNo++ );
|
track_ptr track;
|
||||||
|
if ( !datum.toString().isEmpty() )
|
||||||
|
{
|
||||||
|
track = Track::get( inputInfo[ "artist" ], datum.toString(), inputInfo[ "album" ], QString(), 0, QString(), trackNo++ );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trackNo++;
|
||||||
|
|
||||||
|
QVariantMap m = datum.toMap();
|
||||||
|
|
||||||
|
int duration = m.value( "duration", 0 ).toInt();
|
||||||
|
if ( duration <= 0 && m.contains( "durationString" ) )
|
||||||
|
{
|
||||||
|
QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" );
|
||||||
|
duration = time.secsTo( QTime( 0, 0 ) ) * -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
track = Tomahawk::Track::get( m.value( "artist" ).toString(),
|
||||||
|
m.value( "track" ).toString(),
|
||||||
|
m.value( "album" ).toString(),
|
||||||
|
inputInfo[ "artist" ],
|
||||||
|
duration,
|
||||||
|
QString(),
|
||||||
|
m.value( "albumpos" ).toUInt(),
|
||||||
|
m.value( "discnumber" ).toUInt() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ( !track )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
query_ptr query = Query::get( track );
|
query_ptr query = Query::get( track );
|
||||||
if ( query )
|
if ( query )
|
||||||
ql << query;
|
ql << query;
|
||||||
|
Reference in New Issue
Block a user