diff --git a/fun/playlist_manager.py b/fun/playlist_manager.py index c09c526..f05bbd4 100644 --- a/fun/playlist_manager.py +++ b/fun/playlist_manager.py @@ -505,7 +505,7 @@ def create_playlist(playlist_title, playlist_keys, server, user): print("...Added Playlist: {title} to '{user}'.".format(title=playlist_title, user=user)) -def delete_playlist(playlist_dict, jbop): +def delete_playlist(playlist_dict, jbop, libraries=None, limit=None): """ Parameters ---------- @@ -545,6 +545,12 @@ def delete_playlist(playlist_dict, jbop): playlist.delete() print("...Deleted Playlist: {playlist.title} for '{user}'." .format(playlist=playlist, user=user)) + elif jbop == 'random': + title = selectors()['random'].format(count=limit, libraries='/'.join(libraries.values())) + if playlist.title == title: + playlist.delete() + print("...Deleted Playlist: {playlist.title} for '{user}'." + .format(playlist=playlist, user=user)) elif playlist.title in user_selected: playlist.delete() print("...Deleted Playlist: {playlist.title} for '{user}'." @@ -669,7 +675,7 @@ if __name__ == "__main__": if opts.action == 'remove': print("Deleting the playlist(s)...") for data in playlist_dict['data']: - delete_playlist(data, opts.jbop) + delete_playlist(data, opts.jbop, libraries, opts.limit) else: if libraries: @@ -695,7 +701,7 @@ if __name__ == "__main__": if opts.action == 'update': print("Deleting the playlist(s)...") for data in playlist_dict['data']: - delete_playlist(data, opts.jbop) + delete_playlist(data, opts.jbop, libraries, opts.limit) print('Creating playlist(s)...') for data in playlist_dict['data']: create_playlist(title, keys_list, data['server'], data['user'])