#133 fix for actions with --playlists arg not working properly
removed --playlist choice to allow for selecting any user's playlists
This commit is contained in:
parent
91d7195143
commit
2cb51cc312
@ -474,34 +474,41 @@ def delete_playlist(playlist_dict, jbop):
|
|||||||
user = playlist_dict['user']
|
user = playlist_dict['user']
|
||||||
pop_movie = playlist_dict['pop_movie']
|
pop_movie = playlist_dict['pop_movie']
|
||||||
pop_tv = playlist_dict['pop_tv']
|
pop_tv = playlist_dict['pop_tv']
|
||||||
|
playlist_names = playlist_dict['playlist_name']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# todo-me this needs improvement
|
||||||
for playlist in server.playlists():
|
for playlist in server.playlists():
|
||||||
if jbop == 'historyToday':
|
if jbop == 'historyToday':
|
||||||
if playlist.title.startswith('Aired Today'):
|
if playlist.title.startswith('Aired Today'):
|
||||||
playlist.delete()
|
playlist.delete()
|
||||||
print("...Deleted {playlist.title} for '{user}'."
|
print("...Deleted Playlist: {playlist.title} for '{user}'."
|
||||||
.format(playlist=playlist, user=user))
|
.format(playlist=playlist, user=user))
|
||||||
elif jbop == 'historyWeek':
|
elif jbop == 'historyWeek':
|
||||||
if playlist.title.startswith('Aired This Week'):
|
if playlist.title.startswith('Aired This Week'):
|
||||||
playlist.delete()
|
playlist.delete()
|
||||||
print("...Deleted {playlist.title} for '{user}'."
|
print("...Deleted Playlist: {playlist.title} for '{user}'."
|
||||||
.format(playlist=playlist, user=user))
|
.format(playlist=playlist, user=user))
|
||||||
elif jbop == 'historyMonth':
|
elif jbop == 'historyMonth':
|
||||||
if playlist.title.startswith('Aired in'):
|
if playlist.title.startswith('Aired in'):
|
||||||
playlist.delete()
|
playlist.delete()
|
||||||
print("...Deleted {playlist.title} for '{user}'."
|
print("...Deleted Playlist: {playlist.title} for '{user}'."
|
||||||
.format(playlist=playlist, user=user))
|
.format(playlist=playlist, user=user))
|
||||||
elif jbop == 'popularMovies':
|
elif jbop == 'popularMovies':
|
||||||
if playlist.title == pop_movie:
|
if playlist.title == pop_movie:
|
||||||
playlist.delete()
|
playlist.delete()
|
||||||
print("...Deleted {playlist.title} for '{user}'."
|
print("...Deleted Playlist: {playlist.title} for '{user}'."
|
||||||
.format(playlist=playlist, user=user))
|
.format(playlist=playlist, user=user))
|
||||||
elif jbop == 'popularTv':
|
elif jbop == 'popularTv':
|
||||||
if playlist.title == pop_tv:
|
if playlist.title == pop_tv:
|
||||||
playlist.delete()
|
playlist.delete()
|
||||||
print("...Deleted {playlist.title} for '{user}'."
|
print("...Deleted Playlist: {playlist.title} for '{user}'."
|
||||||
.format(playlist=playlist, user=user))
|
.format(playlist=playlist, user=user))
|
||||||
|
elif playlist.title in playlist_names:
|
||||||
|
playlist.delete()
|
||||||
|
print("...Deleted Playlist: {playlist.title} for '{user}'."
|
||||||
|
.format(playlist=playlist, user=user))
|
||||||
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
# print("Playlist not found on '{user}' account".format(user=user))
|
# print("Playlist not found on '{user}' account".format(user=user))
|
||||||
@ -538,9 +545,8 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument('--top', type=str, default=TOP,
|
parser.add_argument('--top', type=str, default=TOP,
|
||||||
help='The number of top items to list.\n'
|
help='The number of top items to list.\n'
|
||||||
'Default: %(default)s')
|
'Default: %(default)s')
|
||||||
parser.add_argument('--playlists', nargs='+', choices=playlist_lst, metavar='',
|
parser.add_argument('--playlists', nargs='+', metavar='',
|
||||||
help='Space separated list of case sensitive names to process. Allowed names are:\n'
|
help='Enter Playlist name to be managed.')
|
||||||
'Choices: %(choices)s')
|
|
||||||
parser.add_argument('--allPlaylists', default=False, action='store_true',
|
parser.add_argument('--allPlaylists', default=False, action='store_true',
|
||||||
help='Select all playlists.')
|
help='Select all playlists.')
|
||||||
parser.add_argument('--name', type=str,
|
parser.add_argument('--name', type=str,
|
||||||
@ -615,6 +621,7 @@ if __name__ == "__main__":
|
|||||||
playlist_lst.remove(playlist)
|
playlist_lst.remove(playlist)
|
||||||
playlists = playlist_lst
|
playlists = playlist_lst
|
||||||
|
|
||||||
|
playlist_dict['playlist_name'] = playlists
|
||||||
# Create user server objects
|
# Create user server objects
|
||||||
if users:
|
if users:
|
||||||
for user in users:
|
for user in users:
|
||||||
|
Loading…
Reference in New Issue
Block a user