1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 17:14:00 +02:00

Also rename playlist if renamed in spotify. Todo: Both ways

This commit is contained in:
Hugo Lindström
2012-04-07 00:35:39 +02:00
parent e147bf4861
commit 6a6e2754c4
3 changed files with 30 additions and 1 deletions

View File

@@ -216,6 +216,26 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
updater->spotifyTracksMoved( tracksList, newRev, oldRev );
}
else if( msgType == "playlistRenamed" )
{
const QString plid = msg.value( "id" ).toString();
// We should already be syncing this playlist if we get updates for it
Q_ASSERT( m_updaters.contains( plid ) );
qDebug() << Q_FUNC_INFO;
if ( !m_updaters.contains( plid ) )
return;
SpotifyPlaylistUpdater* updater = m_updaters[ plid ];
Q_ASSERT( updater->sync() );
qDebug() << "Playlist renamed fetched in tomahawk";
const QString title = msg.value( "name" ).toString();
const QString newRev = msg.value( "revid" ).toString();
const QString oldRev = msg.value( "oldRev" ).toString();
updater->spotifyPlaylistRenamed( title, newRev, oldRev );
}
}

View File

@@ -221,6 +221,15 @@ SpotifyPlaylistUpdater::spotifyTracksRemoved( const QVariantList& trackIds, cons
}
}
void
SpotifyPlaylistUpdater::spotifyPlaylistRenamed( const QString title, const QString& newRev, const QString& oldRev )
{
Q_UNUSED( newRev );
Q_UNUSED( oldRev );
/// @note to self: should do some checking before trying to update
playlist()->rename( title );
}
void
SpotifyPlaylistUpdater::spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev )

View File

@@ -52,7 +52,7 @@ public:
void spotifyTracksAdded( const QVariantList& tracks, const QString& startPosId, const QString& newRev, const QString& oldRev );
void spotifyTracksRemoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
void spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
void spotifyPlaylistRenamed( const QString title, const QString& newRev, const QString& oldRev );
protected:
virtual void removeFromSettings(const QString& group) const;
virtual void saveToSettings(const QString& group) const;