From 36855783a7bf7810a402fd5cd13696fe7d1a9b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Lindstr=C3=B6m?= Date: Sat, 8 Oct 2011 20:14:26 +0200 Subject: [PATCH] Now supports charts from last.fm, billboard, itunes. Known issue: sometimes fail to populate breadcrumb with itunes resource --- .../infosystem/infoplugins/generic/chartsplugin.cpp | 12 ++++++------ src/libtomahawk/widgets/whatshotwidget.cpp | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp b/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp index 9254fa0fa..69f8dee98 100644 --- a/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/generic/chartsplugin.cpp @@ -32,8 +32,8 @@ #include "utils/tomahawkutils.h" #include "utils/logger.h" -//#define CHART_URL "http://charts.tomahawk-player.org:10080/" -#define CHART_URL "http://localhost:8080/" +#define CHART_URL "http://charts.tomahawk-player.org:10080/" +//#define CHART_URL "http://localhost:8080/" #include #include @@ -234,11 +234,11 @@ ChartsPlugin::notInCacheSlot( uint requestId, QHash criteria, { /// Itunes supplys charts based on geo, for now, only take US charts /// @todo: Add new breadcrumb option for country? - /*if( type.toMap().value( "source" ).toString() == chartResource.toString() + if( type.toMap().value( "source" ).toString() == chartResource.toString() && type.toMap().value( "geo" ).isValid() && type.toMap().value( "geo" ).toString() != "us" ) continue; - */ + /// Append each type to its parent source /// @todo Add chartType enum if( type.toMap().value( "source" ).toString() == chartResource.toString() ) @@ -364,8 +364,8 @@ ChartsPlugin::chartReturned() if( chartType() == Album ) { /** HACK, billboard chart returns wrong typename **/ - //if( res.value( "source" ).toString() == "billboard" ) - // album = chartMap.value( "track" ).toString(); + if( res.value( "source" ).toString() == "billboard" ) + album = chartMap.value( "track" ).toString(); if ( album.isEmpty() && artist.isEmpty() ) // don't have enough... { diff --git a/src/libtomahawk/widgets/whatshotwidget.cpp b/src/libtomahawk/widgets/whatshotwidget.cpp index 23ba6ef3a..c048fba66 100644 --- a/src/libtomahawk/widgets/whatshotwidget.cpp +++ b/src/libtomahawk/widgets/whatshotwidget.cpp @@ -208,13 +208,12 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat } else if( type == "albums" ) { - - /// @todo: Fill the empty albums with resolved ones. setLeftViewAlbums(); m_albumsModel->clear(); QList al; const QList albums = returnedData["albums"].value >(); tDebug( LOGVERBOSE ) << "WhatsHot: got albums! " << albums.size(); + foreach ( const Tomahawk::InfoSystem::ArtistAlbumPair& album, albums ) { qDebug() << "Getting album" << album.album << "By" << album.artist; @@ -227,7 +226,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat qDebug() << "Adding albums to model"; m_albumsModel->addAlbums( al ); - } else if( type == "tracks" ) {