mirror of
https://github.com/blacktwin/JBOPS.git
synced 2025-12-16 13:05:37 +00:00
clean up, correct showing user's current playlists
This commit is contained in:
parent
e667d48f68
commit
34f161de22
@ -614,12 +614,12 @@ if __name__ == "__main__":
|
|||||||
filters = ''
|
filters = ''
|
||||||
playlists = []
|
playlists = []
|
||||||
keys_list = []
|
keys_list = []
|
||||||
plex_servers = []
|
|
||||||
pop_movie_title = selectors()['popularMovies'].format(days=opts.days)
|
pop_movie_title = selectors()['popularMovies'].format(days=opts.days)
|
||||||
pop_tv_title = selectors()['popularTv'].format(days=opts.days)
|
pop_tv_title = selectors()['popularTv'].format(days=opts.days)
|
||||||
|
|
||||||
playlist_dict = {'pop_tv': pop_tv_title,
|
playlist_dict = {'pop_tv': pop_tv_title,
|
||||||
'pop_movie': pop_movie_title}
|
'pop_movie': pop_movie_title,
|
||||||
|
'data': []}
|
||||||
|
|
||||||
if opts.search:
|
if opts.search:
|
||||||
search = dict([opts.search])
|
search = dict([opts.search])
|
||||||
@ -651,21 +651,19 @@ if __name__ == "__main__":
|
|||||||
user_server = PlexServer(PLEX_URL, user_acct.get_token(plex.machineIdentifier))
|
user_server = PlexServer(PLEX_URL, user_acct.get_token(plex.machineIdentifier))
|
||||||
all_playlists = [pl.title for pl in user_server.playlists()]
|
all_playlists = [pl.title for pl in user_server.playlists()]
|
||||||
user_selected = exclusions(opts.allPlaylists, opts.playlists, all_playlists)
|
user_selected = exclusions(opts.allPlaylists, opts.playlists, all_playlists)
|
||||||
plex_servers.append({
|
playlist_dict['data'].append({
|
||||||
'server': user_server,
|
'server': user_server,
|
||||||
'user': user,
|
'user': user,
|
||||||
'user_selected': user_selected,
|
'user_selected': user_selected,
|
||||||
'all_playlists': all_playlists})
|
'all_playlists': all_playlists})
|
||||||
|
|
||||||
if opts.self or not users:
|
if opts.self or not users:
|
||||||
plex_servers.append({'server': plex,
|
playlist_dict['data'].append({'server': plex,
|
||||||
'user': 'admin',
|
'user': 'admin',
|
||||||
'user_selected': selected_playlists,
|
'user_selected': selected_playlists,
|
||||||
'all_playlists': playlist_lst})
|
'all_playlists': playlist_lst})
|
||||||
|
|
||||||
playlist_dict['data'] = plex_servers
|
if not opts.jbop and opts.action == 'show':
|
||||||
|
|
||||||
if opts.action == 'show':
|
|
||||||
print("Displaying the user's playlist(s)...")
|
print("Displaying the user's playlist(s)...")
|
||||||
for data in playlist_dict['data']:
|
for data in playlist_dict['data']:
|
||||||
user = data['user']
|
user = data['user']
|
||||||
@ -677,10 +675,7 @@ if __name__ == "__main__":
|
|||||||
if opts.action == 'remove':
|
if opts.action == 'remove':
|
||||||
print("Deleting the playlist(s)...")
|
print("Deleting the playlist(s)...")
|
||||||
for data in playlist_dict['data']:
|
for data in playlist_dict['data']:
|
||||||
playlist_dict['server'] = data['server']
|
delete_playlist(data, opts.jbop)
|
||||||
playlist_dict['user'] = data['user']
|
|
||||||
playlist_dict['user_selected'] = data['user_selected']
|
|
||||||
delete_playlist(playlist_dict, opts.jbop)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if libraries:
|
if libraries:
|
||||||
@ -702,18 +697,15 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if opts.action == 'update':
|
if opts.action == 'update':
|
||||||
print("Deleting the playlist(s)...")
|
print("Deleting the playlist(s)...")
|
||||||
for x in plex_servers:
|
for data in playlist_dict['data']:
|
||||||
playlist_dict['server'] = x['server']
|
delete_playlist(data, opts.jbop)
|
||||||
playlist_dict['user'] = x['user']
|
|
||||||
playlist_dict['user_selected'] = x['user_selected']
|
|
||||||
delete_playlist(playlist_dict, opts.jbop)
|
|
||||||
print('Creating playlist(s)...')
|
print('Creating playlist(s)...')
|
||||||
for x in plex_servers:
|
for data in playlist_dict['data']:
|
||||||
create_playlist(title, keys_list, x['server'], x['user'])
|
create_playlist(title, keys_list, data['server'], data['user'])
|
||||||
|
|
||||||
if opts.action == 'add':
|
if opts.action == 'add':
|
||||||
print('Creating playlist(s)...')
|
print('Creating playlist(s)...')
|
||||||
for x in plex_servers:
|
for data in playlist_dict['data']:
|
||||||
create_playlist(title, keys_list, x['server'], x['user'])
|
create_playlist(title, keys_list, data['server'], data['user'])
|
||||||
|
|
||||||
print("Done.")
|
print("Done.")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user