mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
Also rename playlist if renamed in spotify. Todo: Both ways
This commit is contained in:
@@ -216,6 +216,26 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
|||||||
|
|
||||||
updater->spotifyTracksMoved( tracksList, newRev, oldRev );
|
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 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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
|
void
|
||||||
SpotifyPlaylistUpdater::spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev )
|
SpotifyPlaylistUpdater::spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev )
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
void spotifyTracksAdded( const QVariantList& tracks, const QString& startPosId, const QString& newRev, const QString& oldRev );
|
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 spotifyTracksRemoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
|
||||||
void spotifyTracksMoved( 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:
|
protected:
|
||||||
virtual void removeFromSettings(const QString& group) const;
|
virtual void removeFromSettings(const QString& group) const;
|
||||||
virtual void saveToSettings(const QString& group) const;
|
virtual void saveToSettings(const QString& group) const;
|
||||||
|
Reference in New Issue
Block a user