def main(): try: deep_clean() except spotipy.client.SpotifyException: print('we got it!') sp = getSpotipy() main()
for track in playlist_tracks: id = track['id'] keys = create_key(track) # In case song has same name but extra artist for remix. should_remove = True for key in keys: if not key_in_history(key): should_remove = False break if should_remove: remove_tracks.append(id) remove_tracks_from_playlist(remove_tracks, playlist_name) remove_duplicates_in_playlist(playlist_name) def clean_playlists(): clean_playlist('new_music_friday_10') clean_playlist('discover_weekly') clean_playlist('the_charts') sp = getSpotipy() # Test #clean_playlist('new_music_friday_6') # Main add_recents_to_played_history(sp) add_from_history_playlist() clean_playlists()