1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Use LinkGenerator in AdiumPlugin too

This commit is contained in:
Dominik Schmidt 2014-12-05 07:21:35 +01:00
parent dbd047b42a
commit f0e1248e3d
2 changed files with 16 additions and 4 deletions

View File

@ -26,7 +26,7 @@
#include "Artist.h"
#include "Result.h"
#include "TomahawkSettings.h"
#include "GlobalActionManager.h"
#include "utils/LinkGenerator.h"
#include "utils/Logger.h"
#include "AdiumPlugin.h"
@ -161,11 +161,19 @@ AdiumPlugin::audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair
m_currentArtist = hash["artist"];
// Request a short URL
m_currentLongUrl = GlobalActionManager::instance()->openLink( hash.value( "title" ), hash.value( "artist" ), hash.value( "album" ) );
ScriptJob* job = Utils::LinkGenerator::instance()->openLink( hash.value( "title" ), hash.value( "artist" ), hash.value( "album" ) );
connect( job, SIGNAL( done( QVariantMap ) ), SLOT ( onQueryLinkReady( QVariantMap ) ) );
job->start();
}
void
AdiumPlugin::onQueryLinkReady( const QVariantMap& data )
{
m_currentLongUrl = data[ "url" ].toUrl();
QUrl shortUrl = m_currentLongUrl;
if ( pushInfoPair.first.contains( "shortUrl" ) )
shortUrl = pushInfoPair.first[ "shortUrl" ].toUrl();
QString nowPlaying = "";
nowPlaying.append( m_currentArtist );
@ -184,8 +192,11 @@ AdiumPlugin::audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair
nowPlaying.append( " " );
nowPlaying.append( shortUrl.toEncoded() );
setStatus( nowPlaying );
sender()->deleteLater();
}
void
AdiumPlugin::audioFinished( const QVariant &input )
{

View File

@ -65,6 +65,7 @@ public slots:
private slots:
void clearStatus();
void settingsChanged();
void onQueryLinkReady( const QVariantMap& data );
private:
void audioStarted( const Tomahawk::InfoSystem::PushInfoPair pushInfoPair );