mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
Add support for tomahawk://love links.
This commit is contained in:
@@ -360,6 +360,10 @@ GlobalActionManager::parseTomahawkLink( const QString& urlIn )
|
|||||||
{
|
{
|
||||||
return handleImportCommand( u );
|
return handleImportCommand( u );
|
||||||
}
|
}
|
||||||
|
else if ( cmdType == "love" )
|
||||||
|
{
|
||||||
|
return handleLoveCommand( u );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tLog() << "Tomahawk link not supported, command not known!" << cmdType << u.path();
|
tLog() << "Tomahawk link not supported, command not known!" << cmdType << u.path();
|
||||||
@@ -526,6 +530,38 @@ GlobalActionManager::handleOpenCommand( const QUrl& url )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
GlobalActionManager::handleLoveCommand( const QUrl& url )
|
||||||
|
{
|
||||||
|
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
||||||
|
if ( parts.isEmpty() )
|
||||||
|
{
|
||||||
|
tLog() << "No specific love command:" << url.toString();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPair< QString, QString > pair;
|
||||||
|
QString title, artist, album;
|
||||||
|
foreach ( pair, urlQueryItems( url ) )
|
||||||
|
{
|
||||||
|
if ( pair.first == "title" )
|
||||||
|
title = pair.second;
|
||||||
|
else if ( pair.first == "artist" )
|
||||||
|
artist = pair.second;
|
||||||
|
else if ( pair.first == "album" )
|
||||||
|
album = pair.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
track_ptr t = Track::get( artist, title, album );
|
||||||
|
if ( t.isNull() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
t->setLoved( true );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GlobalActionManager::handleOpenTrack( const query_ptr& q )
|
GlobalActionManager::handleOpenTrack( const query_ptr& q )
|
||||||
{
|
{
|
||||||
|
@@ -118,6 +118,7 @@ private:
|
|||||||
bool handleCollectionCommand( const QUrl& url );
|
bool handleCollectionCommand( const QUrl& url );
|
||||||
bool handlePlayCommand( const QUrl& url );
|
bool handlePlayCommand( const QUrl& url );
|
||||||
bool handleOpenCommand( const QUrl& url );
|
bool handleOpenCommand( const QUrl& url );
|
||||||
|
bool handleLoveCommand( const QUrl& url );
|
||||||
|
|
||||||
void createPlaylistFromUrl( const QString& type, const QString& url, const QString& title );
|
void createPlaylistFromUrl( const QString& type, const QString& url, const QString& title );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user