mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
fix artist hotttnesss link, switch to /station/ and /autoplaylist/, and artist_limitto
This commit is contained in:
@@ -103,7 +103,7 @@ GlobalActionManager::copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& p
|
|||||||
foreach( const Tomahawk::dyncontrol_ptr& c, controls ) {
|
foreach( const Tomahawk::dyncontrol_ptr& c, controls ) {
|
||||||
if( c->selectedType() == "Artist" ) {
|
if( c->selectedType() == "Artist" ) {
|
||||||
if( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType )
|
if( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType )
|
||||||
link.addQueryItem( "artist_limit", c->input() );
|
link.addQueryItem( "artist_limitto", c->input() );
|
||||||
else
|
else
|
||||||
link.addQueryItem( "artist", c->input() );
|
link.addQueryItem( "artist", c->input() );
|
||||||
} else if( c->selectedType() == "Artist Description" ) {
|
} else if( c->selectedType() == "Artist Description" ) {
|
||||||
@@ -192,6 +192,8 @@ GlobalActionManager::parseTomahawkLink( const QString& url )
|
|||||||
return handleQueueCommand( u );
|
return handleQueueCommand( u );
|
||||||
} else if( cmdType == "station" ) {
|
} else if( cmdType == "station" ) {
|
||||||
return handleStationCommand( u );
|
return handleStationCommand( u );
|
||||||
|
} else if( cmdType == "autoplaylist" ) {
|
||||||
|
return handleAutoPlaylistCommand( u );
|
||||||
} else if( cmdType == "search" ) {
|
} else if( cmdType == "search" ) {
|
||||||
return handleSearchCommand( u );
|
return handleSearchCommand( u );
|
||||||
} else if( cmdType == "play" ) {
|
} else if( cmdType == "play" ) {
|
||||||
@@ -377,7 +379,13 @@ GlobalActionManager::handleSearchCommand( const QUrl& url )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GlobalActionManager::handleStationCommand( const QUrl& url )
|
GlobalActionManager::handleAutoPlaylistCommand( const QUrl& url )
|
||||||
|
{
|
||||||
|
return loadDynamicPlaylist( url, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
GlobalActionManager::loadDynamicPlaylist( const QUrl& url, bool station )
|
||||||
{
|
{
|
||||||
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
QStringList parts = url.path().split( "/" ).mid( 1 ); // get the rest of the command
|
||||||
if( parts.isEmpty() ) {
|
if( parts.isEmpty() ) {
|
||||||
@@ -392,9 +400,9 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
|
|||||||
}
|
}
|
||||||
QString title = url.queryItemValue( "title" );
|
QString title = url.queryItemValue( "title" );
|
||||||
QString type = url.queryItemValue( "type" );
|
QString type = url.queryItemValue( "type" );
|
||||||
Tomahawk::GeneratorMode m = Tomahawk::OnDemand;
|
Tomahawk::GeneratorMode m = Tomahawk::Static;
|
||||||
if( url.hasQueryItem( "plmode" ) && url.queryItemValue( "plmode" ).toInt() == 1 )
|
if( station )
|
||||||
m = Tomahawk::Static;
|
m = Tomahawk::OnDemand;
|
||||||
|
|
||||||
Tomahawk::dynplaylist_ptr pl = Tomahawk::DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), title, QString(), QString(), m, false, type );
|
Tomahawk::dynplaylist_ptr pl = Tomahawk::DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), title, QString(), QString(), m, false, type );
|
||||||
pl->setMode( m );
|
pl->setMode( m );
|
||||||
@@ -406,7 +414,7 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
|
|||||||
c->setInput( param.second );
|
c->setInput( param.second );
|
||||||
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistRadioType ) );
|
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistRadioType ) );
|
||||||
controls << c;
|
controls << c;
|
||||||
} else if( param.first == "artist_limit" ) {
|
} else if( param.first == "artist_limitto" ) {
|
||||||
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Artist" );
|
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Artist" );
|
||||||
c->setInput( param.second );
|
c->setInput( param.second );
|
||||||
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistType ) );
|
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistType ) );
|
||||||
@@ -461,7 +469,7 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
|
|||||||
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Artist Hotttnesss" );
|
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Artist Hotttnesss" );
|
||||||
int extra = param.first.endsWith( "_max" ) ? -1 : 0;
|
int extra = param.first.endsWith( "_max" ) ? -1 : 0;
|
||||||
c->setInput( param.second );
|
c->setInput( param.second );
|
||||||
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistMinFamiliarity + extra ) );
|
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistMinHotttnesss + extra ) );
|
||||||
controls << c;
|
controls << c;
|
||||||
} else if( param.first.startsWith( "song_hotttnesss" ) ) {
|
} else if( param.first.startsWith( "song_hotttnesss" ) ) {
|
||||||
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Song Hotttnesss" );
|
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Song Hotttnesss" );
|
||||||
@@ -504,6 +512,13 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
GlobalActionManager::handleStationCommand( const QUrl& url )
|
||||||
|
{
|
||||||
|
return loadDynamicPlaylist( url, true );
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GlobalActionManager::handlePlayCommand( const QUrl& url )
|
GlobalActionManager::handlePlayCommand( const QUrl& url )
|
||||||
{
|
{
|
||||||
|
@@ -59,11 +59,13 @@ private:
|
|||||||
bool handleCollectionCommand(const QUrl& url );
|
bool handleCollectionCommand(const QUrl& url );
|
||||||
bool handleQueueCommand(const QUrl& url );
|
bool handleQueueCommand(const QUrl& url );
|
||||||
bool handleStationCommand(const QUrl& url );
|
bool handleStationCommand(const QUrl& url );
|
||||||
|
bool handleAutoPlaylistCommand(const QUrl& url );
|
||||||
bool handleSearchCommand(const QUrl& url );
|
bool handleSearchCommand(const QUrl& url );
|
||||||
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 loadDynamicPlaylist( const QUrl& url, bool station );
|
||||||
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
bool doQueueAdd( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
|
||||||
|
|
||||||
Tomahawk::playlist_ptr m_toShow;
|
Tomahawk::playlist_ptr m_toShow;
|
||||||
|
Reference in New Issue
Block a user