@@ -245,10 +245,32 @@ def unlike_all():
245
245
logging .info ("Finished unliking all songs." )
246
246
247
247
248
+ @cli .command ()
249
+ def delete_playlists ():
250
+ """Delete all playlists
251
+ """
252
+ logging .info ("Retrieving all your playlists..." )
253
+ library_playlists = youtube_auth .get_library_playlists (sys .maxsize )
254
+ # Can't delete "Your Likes" playlist
255
+ library_playlists = list (filter (lambda playlist : playlist ["playlistId" ] != "LM" , library_playlists ))
256
+ logging .info (f"\t Retrieved { len (library_playlists )} playlists." )
257
+ logging .info (f"Begin deleting playlists..." )
258
+ progress_bar = manager .counter (total = len (library_playlists ), desc = "Playlists Deleted" , unit = "playlists" )
259
+ for playlist in library_playlists :
260
+ logging .info (f"Processing playlist: { playlist ['title' ]} " )
261
+ response = youtube_auth .delete_playlist (playlist ["playlistId" ])
262
+ if response :
263
+ logging .info (f"\t Removed playlist \" { playlist ['title' ]} \" from your library." )
264
+ else :
265
+ logging .error (f"\t Failed to remove playlist \" { playlist ['title' ]} \" from your library." )
266
+ progress_bar .update ()
267
+ logging .info ("Finished deleting all playlists" )
268
+
248
269
@cli .command ()
249
270
@click .pass_context
250
271
def delete_all (ctx ):
251
- """Executes delete-uploads, remove-library, and unlike-all"""
272
+ """Executes delete-uploads, remove-library, unlike-all, and delete_playlists """
252
273
ctx .invoke (delete_uploads )
253
274
ctx .invoke (remove_library )
254
275
ctx .invoke (unlike_all )
276
+ ctx .invoke (delete_playlists )
0 commit comments