mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
Set downloadable formats on Results, if available.
This commit is contained in:
parent
ea85ba5724
commit
9f1311553d
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright (C) 2014 Dominik Schmidt <domme@tomahawk-player.org>
|
||||
* Copyright (C) 2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -313,6 +314,21 @@ ScriptAccount::parseResultVariantList( const QVariantList& reslist )
|
||||
|
||||
rp->setFriendlySource( name() );
|
||||
|
||||
QList<DownloadFormat> fl;
|
||||
foreach ( const QVariant& foo, m.value( "downloadUrls" ).toList() )
|
||||
{
|
||||
QVariantMap downloadUrl = foo.toMap();
|
||||
tLog() << "downloadUrl:" << downloadUrl.value( "url" ).toUrl() << "drm:" << downloadUrl.value( "drm" ).toBool() << "extension:" << downloadUrl.value( "extension").toString().toLower() << "bitrate:" << downloadUrl.value( "bitrate" ).toInt();
|
||||
|
||||
DownloadFormat format;
|
||||
format.url = downloadUrl.value( "url" ).toUrl();
|
||||
format.extension = downloadUrl.value( "extension").toString().toLower();
|
||||
format.mimetype = TomahawkUtils::extensionToMimetype( format.extension );
|
||||
|
||||
fl << format;
|
||||
}
|
||||
rp->setDownloadFormats( fl );
|
||||
|
||||
// find collection
|
||||
const QString collectionId = m.value( "collectionId" ).toString();
|
||||
if ( !collectionId.isEmpty() )
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
|
||||
* Copyright (C) 2014 Dominik Schmidt <domme@tomahawk-player.org>
|
||||
* Copyright (C) 2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
Loading…
x
Reference in New Issue
Block a user