mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 13:17:34 +02:00
Add support for tomahawk://view/album and tomahawk://view/artist urls
This commit is contained in:
@@ -269,6 +269,8 @@ GlobalActionManager::parseTomahawkLink( const QString& urlIn )
|
|||||||
return handlePlayCommand( u );
|
return handlePlayCommand( u );
|
||||||
} else if( cmdType == "open" ) {
|
} else if( cmdType == "open" ) {
|
||||||
return handleOpenCommand( u );
|
return handleOpenCommand( u );
|
||||||
|
} else if( cmdType == "view" ) {
|
||||||
|
return handleViewCommand( 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();
|
||||||
return false;
|
return false;
|
||||||
@@ -515,6 +517,48 @@ GlobalActionManager::handleSearchCommand( const QUrl& url )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
GlobalActionManager::handleViewCommand( const QUrl& url )
|
||||||
|
{
|
||||||
|
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
||||||
|
if( parts.isEmpty() ) {
|
||||||
|
tLog() << "No specific view command:" << url.toString();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( parts[ 0 ] == "artist" )
|
||||||
|
{
|
||||||
|
const QString artist = url.queryItemValue( "name" );
|
||||||
|
if ( artist.isEmpty() )
|
||||||
|
{
|
||||||
|
tLog() << "Not artist supplied for view/artist command.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
artist_ptr artistPtr = Artist::get( artist );
|
||||||
|
if ( !artistPtr.isNull() )
|
||||||
|
ViewManager::instance()->show( artistPtr );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( parts[ 0 ] == "album" )
|
||||||
|
{
|
||||||
|
const QString artist = url.queryItemValue( "artist" );
|
||||||
|
const QString album = url.queryItemValue( "name" );
|
||||||
|
if ( artist.isEmpty() || album.isEmpty() )
|
||||||
|
{
|
||||||
|
tLog() << "Not artist or album supplied for view/artist command:" << url;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
album_ptr albumPtr = Album::get( Artist::get( artist, false ), album, false );
|
||||||
|
if ( !albumPtr.isNull() )
|
||||||
|
ViewManager::instance()->show( albumPtr );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GlobalActionManager::handleAutoPlaylistCommand( const QUrl& url )
|
GlobalActionManager::handleAutoPlaylistCommand( const QUrl& url )
|
||||||
|
@@ -95,6 +95,7 @@ private:
|
|||||||
bool handlePlayCommand(const QUrl& url );
|
bool handlePlayCommand(const QUrl& url );
|
||||||
bool handleBookmarkCommand(const QUrl& url );
|
bool handleBookmarkCommand(const QUrl& url );
|
||||||
bool handleOpenCommand(const QUrl& url );
|
bool handleOpenCommand(const QUrl& url );
|
||||||
|
bool handleViewCommand(const QUrl& url );
|
||||||
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
||||||
|
|
||||||
bool playSpotify( const QUrl& url );
|
bool playSpotify( const QUrl& url );
|
||||||
|
Reference in New Issue
Block a user