Add --action show to display user's current playlist
This commit is contained in:
@ -44,7 +44,7 @@ optional arguments:
|
|||||||
python playlist_manager.py --jbop mostPopularTv --action add --users bob "Black Twin"
|
python playlist_manager.py --jbop mostPopularTv --action add --users bob "Black Twin"
|
||||||
|
|
||||||
Create 10 Most Popular Movies (60 days) Playlist and share to users bob and Black Twin
|
Create 10 Most Popular Movies (60 days) Playlist and share to users bob and Black Twin
|
||||||
python playlist_manager.py --jbop mostPopularTv --action add --users bob "Black Twin" --days 60 --top 10
|
python playlist_manager.py --jbop mostPopularMovies --action add --users bob "Black Twin" --days 60 --top 10
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -82,7 +82,7 @@ MOVIE_PLAYLIST = 'Most Popular Movies ({days} days)'
|
|||||||
TV_PLAYLIST = 'Most Popular TV Shows ({days} days)'
|
TV_PLAYLIST = 'Most Popular TV Shows ({days} days)'
|
||||||
|
|
||||||
SELECTOR = ['todayInHistory', 'mostPopularTv', 'mostPopularMovies']
|
SELECTOR = ['todayInHistory', 'mostPopularTv', 'mostPopularMovies']
|
||||||
ACTIONS = ['add', 'remove', 'update']
|
ACTIONS = ['add', 'remove', 'update', 'show']
|
||||||
|
|
||||||
|
|
||||||
sess = requests.Session()
|
sess = requests.Session()
|
||||||
@ -256,7 +256,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Create, share, and clean Playlists for users.",
|
parser = argparse.ArgumentParser(description="Create, share, and clean Playlists for users.",
|
||||||
formatter_class = argparse.RawTextHelpFormatter)
|
formatter_class = argparse.RawTextHelpFormatter)
|
||||||
parser.add_argument('--jbop', required=True, choices=SELECTOR,
|
parser.add_argument('--jbop', choices=SELECTOR,
|
||||||
help='Playlist selector.\n'
|
help='Playlist selector.\n'
|
||||||
'Choices: (%(choices)s)')
|
'Choices: (%(choices)s)')
|
||||||
parser.add_argument('--action', required=True, choices=ACTIONS,
|
parser.add_argument('--action', required=True, choices=ACTIONS,
|
||||||
@ -296,6 +296,13 @@ if __name__ == "__main__":
|
|||||||
plex_servers.append({'server': plex,
|
plex_servers.append({'server': plex,
|
||||||
'user': 'admin'})
|
'user': 'admin'})
|
||||||
|
|
||||||
|
if opts.action == 'show':
|
||||||
|
print("Displaying the user's playlist(s)...")
|
||||||
|
for x in plex_servers:
|
||||||
|
user = x['user']
|
||||||
|
playlist = [y.title for y in x['server'].playlists()]
|
||||||
|
print("{}'s current playlist(s): {}".format(user, ', '.join(playlist)))
|
||||||
|
|
||||||
if opts.action == 'remove':
|
if opts.action == 'remove':
|
||||||
print("Deleting the playlist(s)...")
|
print("Deleting the playlist(s)...")
|
||||||
for x in plex_servers:
|
for x in plex_servers:
|
||||||
|
Reference in New Issue
Block a user