Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Delete duplicate entries from Google Play Music user playlist
from gmusicapi import Mobileclient
# Get gmusicapi:
# This script iterates through all your playlists, and deletes any playlist entries that
# have a duplicate later on in the same playlist.
api = Mobileclient()
logged_in = api.login('', 'nice try :P')
playlists = api.get_all_user_playlist_contents()
leading_dupes = []
for playlist in playlists:
entries = playlist['tracks']
def have_i_dupe_ahead(entry, entries, idx):
for t in entries[(idx+1):]:
if entry['trackId'] == t['trackId']:
return True
return False
for idx, entry in enumerate(entries):
isdupe = have_i_dupe_ahead(entry, entries, idx)
if isdupe:
entry_ids = [entry['id'] for entry in leading_dupes]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.