1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

fix artist hotttnesss link, switch to /station/ and /autoplaylist/, and artist_limitto

This commit is contained in:
Leo Franchi 2011-05-22 20:40:31 -04:00
parent f70183a0e9
commit 428828426c
2 changed files with 24 additions and 7 deletions

View File

@ -103,7 +103,7 @@ GlobalActionManager::copyPlaylistToClipboard( const Tomahawk::dynplaylist_ptr& p
foreach( const Tomahawk::dyncontrol_ptr& c, controls ) {
if( c->selectedType() == "Artist" ) {
if( c->match().toInt() == Echonest::DynamicPlaylist::ArtistType )
link.addQueryItem( "artist_limit", c->input() );
link.addQueryItem( "artist_limitto", c->input() );
else
link.addQueryItem( "artist", c->input() );
} else if( c->selectedType() == "Artist Description" ) {
@ -192,6 +192,8 @@ GlobalActionManager::parseTomahawkLink( const QString& url )
return handleQueueCommand( u );
} else if( cmdType == "station" ) {
return handleStationCommand( u );
} else if( cmdType == "autoplaylist" ) {
return handleAutoPlaylistCommand( u );
} else if( cmdType == "search" ) {
return handleSearchCommand( u );
} else if( cmdType == "play" ) {
@ -377,7 +379,13 @@ GlobalActionManager::handleSearchCommand( const QUrl& url )
}
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
if( parts.isEmpty() ) {
@ -392,9 +400,9 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
}
QString title = url.queryItemValue( "title" );
QString type = url.queryItemValue( "type" );
Tomahawk::GeneratorMode m = Tomahawk::OnDemand;
if( url.hasQueryItem( "plmode" ) && url.queryItemValue( "plmode" ).toInt() == 1 )
m = Tomahawk::Static;
Tomahawk::GeneratorMode m = Tomahawk::Static;
if( station )
m = Tomahawk::OnDemand;
Tomahawk::dynplaylist_ptr pl = Tomahawk::DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), title, QString(), QString(), m, false, type );
pl->setMode( m );
@ -406,7 +414,7 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
c->setInput( param.second );
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistRadioType ) );
controls << c;
} else if( param.first == "artist_limit" ) {
} else if( param.first == "artist_limitto" ) {
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Artist" );
c->setInput( param.second );
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" );
int extra = param.first.endsWith( "_max" ) ? -1 : 0;
c->setInput( param.second );
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistMinFamiliarity + extra ) );
c->setMatch( QString::number( (int)Echonest::DynamicPlaylist::ArtistMinHotttnesss + extra ) );
controls << c;
} else if( param.first.startsWith( "song_hotttnesss" ) ) {
Tomahawk::dyncontrol_ptr c = pl->generator()->createControl( "Song Hotttnesss" );
@ -504,6 +512,13 @@ GlobalActionManager::handleStationCommand( const QUrl& url )
return false;
}
bool
GlobalActionManager::handleStationCommand( const QUrl& url )
{
return loadDynamicPlaylist( url, true );
}
bool
GlobalActionManager::handlePlayCommand( const QUrl& url )
{

View File

@ -59,11 +59,13 @@ private:
bool handleCollectionCommand(const QUrl& url );
bool handleQueueCommand(const QUrl& url );
bool handleStationCommand(const QUrl& url );
bool handleAutoPlaylistCommand(const QUrl& url );
bool handleSearchCommand(const QUrl& url );
bool handlePlayCommand(const QUrl& url );
bool handleBookmarkCommand(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 );
Tomahawk::playlist_ptr m_toShow;