1
0
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:
Christian Muehlhaeuser 2015-03-11 05:24:18 +01:00
parent ea85ba5724
commit 9f1311553d
2 changed files with 17 additions and 0 deletions

View File

@ -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() )

View File

@ -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