Skip to content

Commit

Permalink
fix remove songs if playlist is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Mar 11, 2023
1 parent 26d2800 commit e25e3b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions YouTube.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def get_playlist_id(self, name):
raise Exception("Playlist title not found in playlists")

def remove_songs(self, playlistId):
items = self.api.get_playlist(playlistId, 10000)['tracks']
if len(items) > 0:
self.api.remove_playlist_items(playlistId, items)
items = self.api.get_playlist(playlistId, 10000)
if 'tracks' in items:
self.api.remove_playlist_items(playlistId, items['tracks'])

def remove_playlists(self, pattern):
playlists = self.api.get_library_playlists(10000)
Expand Down

0 comments on commit e25e3b1

Please sign in to comment.