From cd7ca26e782cf8a3c22b32b026da3e263b58c975 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sun, 30 Nov 2014 01:40:45 +0100 Subject: [PATCH] Pluginify link generation --- src/libtomahawk/CMakeLists.txt | 3 + src/libtomahawk/resolvers/SyncScriptJob.cpp | 31 ++++ src/libtomahawk/resolvers/SyncScriptJob.h | 42 ++++++ src/libtomahawk/utils/LinkGenerator.cpp | 137 +----------------- src/libtomahawk/utils/LinkGenerator.h | 52 ++++++- src/libtomahawk/utils/LinkGeneratorPlugin.cpp | 65 +++++++++ src/libtomahawk/utils/LinkGeneratorPlugin.h | 47 ++++++ .../utils/TomaHkLinkGeneratorPlugin.cpp | 125 ++++++++++++++++ .../utils/TomaHkLinkGeneratorPlugin.h | 52 +++++++ 9 files changed, 416 insertions(+), 138 deletions(-) create mode 100644 src/libtomahawk/resolvers/SyncScriptJob.cpp create mode 100644 src/libtomahawk/resolvers/SyncScriptJob.h create mode 100644 src/libtomahawk/utils/LinkGeneratorPlugin.cpp create mode 100644 src/libtomahawk/utils/LinkGeneratorPlugin.h create mode 100644 src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.cpp create mode 100644 src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.h diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 188eba0a3..bc659cda4 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -91,6 +91,7 @@ set( libGuiSources resolvers/ScriptEngine.cpp resolvers/JSPlugin.cpp resolvers/ScriptJob.cpp + resolvers/SyncScriptJob.cpp utils/DpiScaler.cpp utils/ImageRegistry.cpp @@ -119,6 +120,8 @@ set( libGuiSources utils/NetworkAccessManager.cpp utils/ShortLinkHelper.cpp utils/LinkGenerator.cpp + utils/LinkGeneratorPlugin.cpp + utils/TomaHkLinkGeneratorPlugin.cpp viewpages/SearchViewPage.cpp viewpages/SourceViewPage.cpp diff --git a/src/libtomahawk/resolvers/SyncScriptJob.cpp b/src/libtomahawk/resolvers/SyncScriptJob.cpp new file mode 100644 index 000000000..9b2150dbf --- /dev/null +++ b/src/libtomahawk/resolvers/SyncScriptJob.cpp @@ -0,0 +1,31 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ +#include "SyncScriptJob.h" + + +Tomahawk::SyncScriptJob::SyncScriptJob( const QVariantMap& resultData ) + : ScriptJob( nullptr, "nomethod") +{ + m_data = resultData; +} + + +void Tomahawk::SyncScriptJob::start() +{ + QMetaObject::invokeMethod( this, "reportResults", Qt::QueuedConnection, Q_ARG( QVariantMap, m_data ) ); +} diff --git a/src/libtomahawk/resolvers/SyncScriptJob.h b/src/libtomahawk/resolvers/SyncScriptJob.h new file mode 100644 index 000000000..8f09e9f82 --- /dev/null +++ b/src/libtomahawk/resolvers/SyncScriptJob.h @@ -0,0 +1,42 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#pragma once +#ifndef TOMAHAWK_SYNCSCRIPTJOB_H +#define TOMAHAWK_SYNCSCRIPTJOB_H + +#include "ScriptJob.h" + +#include "../DllMacro.h" +#include "../Typedefs.h" + +namespace Tomahawk { + +class SyncScriptJob : public ScriptJob +{ +Q_OBJECT + +public: + SyncScriptJob( const QVariantMap& resultData ); + + void start() override; +}; + +} // namespace Tomahawk + +#endif // TOMAHAWK_SYNCSCRIPTJOB_H diff --git a/src/libtomahawk/utils/LinkGenerator.cpp b/src/libtomahawk/utils/LinkGenerator.cpp index 0b3d4884d..ccee61a03 100644 --- a/src/libtomahawk/utils/LinkGenerator.cpp +++ b/src/libtomahawk/utils/LinkGenerator.cpp @@ -27,42 +27,19 @@ #include "Logger.h" #include "ShortLinkHelper.h" -#include "../playlist/dynamic/GeneratorInterface.h" -#include "../playlist/dynamic/DynamicPlaylist.h" -#include "../Track.h" -#include "../Artist.h" -#include "../Album.h" -#include "../resolvers/ScriptJob.h" +#include "TomaHkLinkGeneratorPlugin.h" -#include +#include "../resolvers/SyncScriptJob.h" #include #include #include +#include using namespace Tomahawk; using namespace Tomahawk::Utils; - -// HACK: to prepare proper scripting -class SyncScriptJob : public ScriptJob -{ -Q_OBJECT - -public: - SyncScriptJob( const QVariantMap& resultData ) : ScriptJob( nullptr, "nomethod") - { - m_data = resultData; - } - - void start() override - { - QMetaObject::invokeMethod( this, "reportResults", Qt::QueuedConnection, Q_ARG( QVariantMap, m_data ) ); - } -}; -#include "LinkGenerator.moc" - LinkGenerator* LinkGenerator::s_instance = 0; @@ -79,6 +56,8 @@ LinkGenerator::instance() LinkGenerator::LinkGenerator( QObject* parent ) : QObject( parent ) { + m_defaultPlugin.reset( new TomaHkLinkGeneratorPlugin ); + m_plugins.append( m_defaultPlugin.get() ); } @@ -86,112 +65,6 @@ LinkGenerator::~LinkGenerator() { } - -QString -LinkGenerator::hostname() const -{ - return QString( "http://toma.hk" ); -} - - -ScriptJob* -LinkGenerator::openLink( const query_ptr& query ) const -{ - QString title = query->track()->track(); - QString artist = query->track()->artist(); - QString album = query->track()->album(); - - return openLink( title, artist, album ); -} - - -ScriptJob* -LinkGenerator::openLink( const QString& title, const QString& artist, const QString& album ) const -{ - QUrl link( QString( "%1/open/track/" ).arg( hostname() ) ); - - if ( !artist.isEmpty() ) - TomahawkUtils::urlAddQueryItem( link, "artist", artist ); - if ( !title.isEmpty() ) - TomahawkUtils::urlAddQueryItem( link, "title", title ); - if ( !album.isEmpty() ) - TomahawkUtils::urlAddQueryItem( link, "album", album ); - - QVariantMap data; - data[ "url" ] = link; - - return new SyncScriptJob( data ); -} - - -ScriptJob* -LinkGenerator::openLink( const Tomahawk::dynplaylist_ptr& playlist ) const -{ - QUrl link( QString( "%1/%2/create/" ).arg( hostname() ).arg( playlist->mode() == OnDemand ? "station" : "autoplaylist" ) ); - - if ( playlist->generator()->type() != "echonest" ) - { - tLog() << "Only echonest generators are supported"; - return nullptr; - } - - TomahawkUtils::urlAddQueryItem( link, "type", "echonest" ); - TomahawkUtils::urlAddQueryItem( link, "title", playlist->title() ); - - QList< dyncontrol_ptr > controls = playlist->generator()->controls(); - foreach ( const dyncontrol_ptr& c, controls ) - { - if ( c->selectedType() == "Artist" ) - { - if ( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType ) - TomahawkUtils::urlAddQueryItem( link, "artist_limitto", c->input() ); - else - TomahawkUtils::urlAddQueryItem( link, "artist", c->input() ); - } - else if ( c->selectedType() == "Artist Description" ) - { - TomahawkUtils::urlAddQueryItem( link, "description", c->input() ); - } - else - { - QString name = c->selectedType().toLower().replace( " ", "_" ); - Echonest::DynamicPlaylist::PlaylistParam p = static_cast< Echonest::DynamicPlaylist::PlaylistParam >( c->match().toInt() ); - // if it is a max, set that too - if ( p == Echonest::DynamicPlaylist::MaxTempo || p == Echonest::DynamicPlaylist::MaxDuration || p == Echonest::DynamicPlaylist::MaxLoudness - || p == Echonest::DynamicPlaylist::MaxDanceability || p == Echonest::DynamicPlaylist::MaxEnergy || p == Echonest::DynamicPlaylist::ArtistMaxFamiliarity - || p == Echonest::DynamicPlaylist::ArtistMaxHotttnesss || p == Echonest::DynamicPlaylist::SongMaxHotttnesss || p == Echonest::DynamicPlaylist::ArtistMaxLatitude - || p == Echonest::DynamicPlaylist::ArtistMaxLongitude ) - name += "_max"; - - TomahawkUtils::urlAddQueryItem( link, name, c->input() ); - } - } - - QVariantMap data; - data[ "url" ] = link; - - return new SyncScriptJob( data ); -} - - -ScriptJob* -LinkGenerator::openLink( const Tomahawk::artist_ptr& artist ) const -{ - QVariantMap data; - data[ "url" ] = QString( "%1/artist/%2" ).arg( hostname() ).arg( artist->name() ); - return new SyncScriptJob( data ); -} - - -ScriptJob* -LinkGenerator::openLink( const Tomahawk::album_ptr& album ) const -{ - QVariantMap data; - data[ "url" ] = QUrl::fromUserInput( QString( "%1/album/%2/%3" ).arg( hostname() ).arg( album->artist().isNull() ? QString() : album->artist()->name() ).arg( album->name() ) );; - return new SyncScriptJob( data ); -} - - void LinkGenerator::copyScriptJobResultToClipboard( const QVariantMap& data ) { diff --git a/src/libtomahawk/utils/LinkGenerator.h b/src/libtomahawk/utils/LinkGenerator.h index 060f13430..3179965ba 100644 --- a/src/libtomahawk/utils/LinkGenerator.h +++ b/src/libtomahawk/utils/LinkGenerator.h @@ -22,10 +22,13 @@ #define TOMAHAWK_UTILS_LINKGENERATOR_H #include "../resolvers/ScriptJob.h" +#include "LinkGeneratorPlugin.h" #include "../DllMacro.h" #include "../Typedefs.h" +#include + namespace Tomahawk { namespace Utils { @@ -37,11 +40,45 @@ public: static LinkGenerator* instance(); virtual ~LinkGenerator(); - ScriptJob* openLink( const QString& title, const QString& artist, const QString& album ) const; - ScriptJob* openLink( const Tomahawk::query_ptr& query ) const; - ScriptJob* openLink( const Tomahawk::artist_ptr& artist ) const; - ScriptJob* openLink( const Tomahawk::album_ptr& album ) const; - ScriptJob* openLink( const Tomahawk::dynplaylist_ptr& playlist ) const; + // TODO: openLink(QString, QString, QString) is a rather annoying special case. Can we get rid of it? + + ScriptJob* openLink( const QString& title, const QString& artist, const QString& album ) const + { + ScriptJob* job; + QList< LinkGeneratorPlugin* >::const_iterator i = m_plugins.constEnd(); + while ( i != m_plugins.constBegin() ) + { + --i; + job = (*i)->openLink( title, artist, album ); + if ( job ) + { + break; + } + } + + // No suitable link generator plugin found + Q_ASSERT( job ); + return job; + } + + template ScriptJob* openLink( const T& item ) const + { + ScriptJob* job; + QList< LinkGeneratorPlugin* >::const_iterator i = m_plugins.constEnd(); + while ( i != m_plugins.constBegin() ) + { + --i; + job = (*i)->openLink( item ); + if ( job ) + { + break; + } + } + + // No suitable link generator plugin found + Q_ASSERT( job ); + return job; + } // Fire and forget @@ -68,10 +105,13 @@ private slots: private: explicit LinkGenerator( QObject* parent = 0 ); - QString hostname() const; QUrl m_clipboardLongUrl; + std::unique_ptr< LinkGeneratorPlugin > m_defaultPlugin; + QList< LinkGeneratorPlugin* > m_plugins; + + static LinkGenerator* s_instance; }; diff --git a/src/libtomahawk/utils/LinkGeneratorPlugin.cpp b/src/libtomahawk/utils/LinkGeneratorPlugin.cpp new file mode 100644 index 000000000..a07346931 --- /dev/null +++ b/src/libtomahawk/utils/LinkGeneratorPlugin.cpp @@ -0,0 +1,65 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ +#include "LinkGeneratorPlugin.h" + +#include "../Query.h" +#include "../Track.h" +#include "../Artist.h" +#include "../Album.h" + +Tomahawk::Utils::LinkGeneratorPlugin::~LinkGeneratorPlugin() +{ +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::LinkGeneratorPlugin::openLink(const QString&, const QString&, const QString&) const +{ + return nullptr; +} + +Tomahawk::ScriptJob* Tomahawk::Utils::LinkGeneratorPlugin::openLink( const Tomahawk::query_ptr& query ) const +{ + QString title = query->track()->track(); + QString artist = query->track()->artist(); + QString album = query->track()->album(); + + return openLink( title, artist, album ); +} + + + +Tomahawk::ScriptJob* +Tomahawk::Utils::LinkGeneratorPlugin::openLink(const Tomahawk::artist_ptr&) const +{ + return nullptr; +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::LinkGeneratorPlugin::openLink(const Tomahawk::album_ptr&) const +{ + return nullptr; +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::LinkGeneratorPlugin::openLink(const Tomahawk::dynplaylist_ptr&) const +{ + return nullptr; +} diff --git a/src/libtomahawk/utils/LinkGeneratorPlugin.h b/src/libtomahawk/utils/LinkGeneratorPlugin.h new file mode 100644 index 000000000..68c89b675 --- /dev/null +++ b/src/libtomahawk/utils/LinkGeneratorPlugin.h @@ -0,0 +1,47 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#pragma once +#ifndef TOMAHAWK_UTILS_LINKGENERATORPLUGIN_H +#define TOMAHAWK_UTILS_LINKGENERATORPLUGIN_H + +#include "../DllMacro.h" +#include "../Typedefs.h" + +namespace Tomahawk { + +class ScriptJob; + +namespace Utils { + +class DLLEXPORT LinkGeneratorPlugin +{ +public: + virtual ~LinkGeneratorPlugin(); + + virtual ScriptJob* openLink( const QString& title, const QString& artist, const QString& album ) const; + virtual ScriptJob* openLink( const Tomahawk::query_ptr& query ) const; + virtual ScriptJob* openLink( const Tomahawk::artist_ptr& artist ) const; + virtual ScriptJob* openLink( const Tomahawk::album_ptr& album ) const; + virtual ScriptJob* openLink( const Tomahawk::dynplaylist_ptr& playlist ) const; +}; + +} // namespace Utils +} // namespace Tomahawk + +#endif // TOMAHAWK_UTILS_LINKGENERATORPLUGIN_H diff --git a/src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.cpp b/src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.cpp new file mode 100644 index 000000000..ee497cfe0 --- /dev/null +++ b/src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.cpp @@ -0,0 +1,125 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2011 Leo Franchi + * Copyright (C) 2011, Jeff Mitchell + * Copyright (C) 2011-2014, Christian Muehlhaeuser + * Copyright (C) 2013, Uwe L. Korn + * Copyright (C) 2013, Teo Mrnjavac + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ +#include "TomaHkLinkGeneratorPlugin.h" + +#include "../playlist/dynamic/GeneratorInterface.h" +#include "../playlist/dynamic/DynamicPlaylist.h" +#include "../Track.h" +#include "../Artist.h" +#include "../Album.h" +#include "../resolvers/SyncScriptJob.h" +#include "../utils/Logger.h" + +QString +Tomahawk::Utils::TomaHkLinkGeneratorPlugin::hostname() const +{ + return QString( "http://toma.hk" ); + +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::TomaHkLinkGeneratorPlugin::openLink( const QString& title, const QString& artist, const QString& album ) const +{ + QUrl link( QString( "%1/open/track/" ).arg( hostname() ) ); + + if ( !artist.isEmpty() ) + TomahawkUtils::urlAddQueryItem( link, "artist", artist ); + if ( !title.isEmpty() ) + TomahawkUtils::urlAddQueryItem( link, "title", title ); + if ( !album.isEmpty() ) + TomahawkUtils::urlAddQueryItem( link, "album", album ); + + QVariantMap data; + data[ "url" ] = link; + + return new SyncScriptJob( data ); +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::TomaHkLinkGeneratorPlugin::openLink( const Tomahawk::artist_ptr& artist ) const +{ + QVariantMap data; + data[ "url" ] = QString( "%1/artist/%2" ).arg( hostname() ).arg( artist->name() ); + return new SyncScriptJob( data ); +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::TomaHkLinkGeneratorPlugin::openLink( const Tomahawk::album_ptr& album ) const +{ + QVariantMap data; + data[ "url" ] = QUrl::fromUserInput( QString( "%1/album/%2/%3" ).arg( hostname() ).arg( album->artist().isNull() ? QString() : album->artist()->name() ).arg( album->name() ) );; + return new SyncScriptJob( data ); +} + + +Tomahawk::ScriptJob* +Tomahawk::Utils::TomaHkLinkGeneratorPlugin::openLink( const Tomahawk::dynplaylist_ptr& playlist ) const +{ + QUrl link( QString( "%1/%2/create/" ).arg( hostname() ).arg( playlist->mode() == OnDemand ? "station" : "autoplaylist" ) ); + + if ( playlist->generator()->type() != "echonest" ) + { + tLog() << "Only echonest generators are supported"; + return nullptr; + } + + TomahawkUtils::urlAddQueryItem( link, "type", "echonest" ); + TomahawkUtils::urlAddQueryItem( link, "title", playlist->title() ); + + QList< dyncontrol_ptr > controls = playlist->generator()->controls(); + foreach ( const dyncontrol_ptr& c, controls ) + { + if ( c->selectedType() == "Artist" ) + { + if ( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType ) + TomahawkUtils::urlAddQueryItem( link, "artist_limitto", c->input() ); + else + TomahawkUtils::urlAddQueryItem( link, "artist", c->input() ); + } + else if ( c->selectedType() == "Artist Description" ) + { + TomahawkUtils::urlAddQueryItem( link, "description", c->input() ); + } + else + { + QString name = c->selectedType().toLower().replace( " ", "_" ); + Echonest::DynamicPlaylist::PlaylistParam p = static_cast< Echonest::DynamicPlaylist::PlaylistParam >( c->match().toInt() ); + // if it is a max, set that too + if ( p == Echonest::DynamicPlaylist::MaxTempo || p == Echonest::DynamicPlaylist::MaxDuration || p == Echonest::DynamicPlaylist::MaxLoudness + || p == Echonest::DynamicPlaylist::MaxDanceability || p == Echonest::DynamicPlaylist::MaxEnergy || p == Echonest::DynamicPlaylist::ArtistMaxFamiliarity + || p == Echonest::DynamicPlaylist::ArtistMaxHotttnesss || p == Echonest::DynamicPlaylist::SongMaxHotttnesss || p == Echonest::DynamicPlaylist::ArtistMaxLatitude + || p == Echonest::DynamicPlaylist::ArtistMaxLongitude ) + name += "_max"; + + TomahawkUtils::urlAddQueryItem( link, name, c->input() ); + } + } + + QVariantMap data; + data[ "url" ] = link; + + return new SyncScriptJob( data ); +} diff --git a/src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.h b/src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.h new file mode 100644 index 000000000..76219012a --- /dev/null +++ b/src/libtomahawk/utils/TomaHkLinkGeneratorPlugin.h @@ -0,0 +1,52 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright (C) 2014 Dominik Schmidt + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#pragma once +#ifndef TOMAHAWK_UTILS_TOMAHKLINKGENERATORPLUGIN_H +#define TOMAHAWK_UTILS_TOMAHKLINKGENERATORPLUGIN_H + +#include "LinkGeneratorPlugin.h" + +#include "../DllMacro.h" +#include "../Typedefs.h" + +#include + +namespace Tomahawk { + +class ScriptJob; + +namespace Utils { + +class DLLEXPORT TomaHkLinkGeneratorPlugin : public LinkGeneratorPlugin +{ +public: + ScriptJob* openLink( const QString& title, const QString& artist, const QString& album ) const override; + ScriptJob* openLink( const Tomahawk::artist_ptr& artist ) const override; + ScriptJob* openLink( const Tomahawk::album_ptr& album ) const override; + ScriptJob* openLink( const Tomahawk::dynplaylist_ptr& playlist ) const override; + +private: + QString hostname() const; + +}; + +} // namespace Utils +} // namespace Tomahawk + +#endif // TOMAHAWK_UTILS_TOMAHKLINKGENERATORPLUGIN_H