parent
6fcf430152
commit
75665d50a2
@ -10,8 +10,7 @@ optional arguments:
|
|||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
--jbop Playlist selector.
|
--jbop Playlist selector.
|
||||||
Choices: (historyToday, historyWeek, historyMonth, popularTv, popularMovies)
|
Choices: (historyToday, historyWeek, historyMonth, popularTv, popularMovies)
|
||||||
--action {add,remove,update,show,share}
|
--action Action selector.
|
||||||
Action selector.
|
|
||||||
add - create new playlist for admin or users
|
add - create new playlist for admin or users
|
||||||
remove - remove playlist type or name from admin or users
|
remove - remove playlist type or name from admin or users
|
||||||
update - remove playlist type and create new playlist type for admin or users
|
update - remove playlist type and create new playlist type for admin or users
|
||||||
@ -23,6 +22,7 @@ optional arguments:
|
|||||||
--libraries [ ...] Space separated list of case sensitive names to
|
--libraries [ ...] Space separated list of case sensitive names to
|
||||||
process. Allowed names are:
|
process. Allowed names are:
|
||||||
Choices: (LIBRARIES)
|
Choices: (LIBRARIES)
|
||||||
|
--allLibraries Select all libraries.
|
||||||
--self Create playlist for admin.
|
--self Create playlist for admin.
|
||||||
Default: False
|
Default: False
|
||||||
--days DAYS The time range to calculate statistics.
|
--days DAYS The time range to calculate statistics.
|
||||||
@ -32,6 +32,12 @@ optional arguments:
|
|||||||
--playlists Space separated list of case sensitive names to
|
--playlists Space separated list of case sensitive names to
|
||||||
process. Allowed names are:
|
process. Allowed names are:
|
||||||
Choices: (PLAYLISTS)
|
Choices: (PLAYLISTS)
|
||||||
|
--name NAME Custom name for playlist.
|
||||||
|
--limit LIMIT Limit the amount items to be added to a playlist.
|
||||||
|
--filter FILTER Search filtered metadata fields
|
||||||
|
Filters: (mood unwatched country contentRating collection label director duplicate
|
||||||
|
studio actor year genre guid resolution decade network).
|
||||||
|
--search SEARCH Search non-filtered metadata fields for keywords in title, summary, etc.
|
||||||
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@ -63,12 +69,17 @@ optional arguments:
|
|||||||
|
|
||||||
Share existing admin Playlists "My Custom Playlist" and "Another Playlist" with all users
|
Share existing admin Playlists "My Custom Playlist" and "Another Playlist" with all users
|
||||||
python playlist_manager.py --action share --allUsers --playlists "My Custom Playlist" "Another Playlist"
|
python playlist_manager.py --action share --allUsers --playlists "My Custom Playlist" "Another Playlist"
|
||||||
|
|
||||||
Excluding;
|
Excluding;
|
||||||
|
|
||||||
--user becomes excluded if --allUsers is set
|
--user becomes excluded if --allUsers is set
|
||||||
python playlist_manager.py --action show --allUsers --user USER
|
python playlist_manager.py --action show --allUsers --user USER
|
||||||
- Show all users current Playlists... all users but USER
|
- Show all users current Playlists... all users but USER
|
||||||
|
|
||||||
|
--libraries becomes excluded if --allLibraries is set
|
||||||
|
python playlist_manager.py --jbop historyToday --allLibraries --libraries Movies --action add
|
||||||
|
- Create Aired Today Playlist from every library by Movies for admin user
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -116,7 +127,9 @@ plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess)
|
|||||||
account = plex.myPlexAccount()
|
account = plex.myPlexAccount()
|
||||||
|
|
||||||
user_lst = [x.title for x in plex.myPlexAccount().users()]
|
user_lst = [x.title for x in plex.myPlexAccount().users()]
|
||||||
section_lst = [x.title for x in plex.library.sections()]
|
sections = plex.library.sections()
|
||||||
|
sections_lst = [x.title for x in sections]
|
||||||
|
filter_lst = list(set([y for x in sections if x.type != 'photo' for y in x.ALLOWED_FILTERS]))
|
||||||
playlist_lst = [x.title for x in plex.playlists()]
|
playlist_lst = [x.title for x in plex.playlists()]
|
||||||
today = datetime.datetime.now().date()
|
today = datetime.datetime.now().date()
|
||||||
weeknum = datetime.date(today.year, today.month, today.day).isocalendar()[1]
|
weeknum = datetime.date(today.year, today.month, today.day).isocalendar()[1]
|
||||||
@ -496,9 +509,11 @@ if __name__ == "__main__":
|
|||||||
'Choices: %(choices)s')
|
'Choices: %(choices)s')
|
||||||
parser.add_argument('--allUsers', default=False, action='store_true',
|
parser.add_argument('--allUsers', default=False, action='store_true',
|
||||||
help='Select all users.')
|
help='Select all users.')
|
||||||
parser.add_argument('--libraries', nargs='+', choices=section_lst, metavar='',
|
parser.add_argument('--libraries', nargs='+', choices=sections_lst, metavar='',
|
||||||
help='Space separated list of case sensitive names to process. Allowed names are:\n'
|
help='Space separated list of case sensitive names to process. Allowed names are:\n'
|
||||||
'Choices: %(choices)s')
|
'Choices: %(choices)s')
|
||||||
|
parser.add_argument('--allLibraries', default=False, action='store_true',
|
||||||
|
help='Select all libraries.')
|
||||||
parser.add_argument('--self', default=False, action='store_true',
|
parser.add_argument('--self', default=False, action='store_true',
|
||||||
help='Create playlist for admin.\n'
|
help='Create playlist for admin.\n'
|
||||||
'Default: %(default)s')
|
'Default: %(default)s')
|
||||||
@ -550,6 +565,17 @@ if __name__ == "__main__":
|
|||||||
user_lst.remove(user)
|
user_lst.remove(user)
|
||||||
users = user_lst
|
users = user_lst
|
||||||
|
|
||||||
|
# Defining libraries
|
||||||
|
if opts.allLibraries and not opts.libraries:
|
||||||
|
libraries = sections_lst
|
||||||
|
elif not opts.allLibraries and opts.libraries:
|
||||||
|
libraries = opts.libraries
|
||||||
|
elif opts.allLibraries and opts.libraries:
|
||||||
|
# If allLibraries is used then any libraries listed will be excluded
|
||||||
|
for library in opts.libraries:
|
||||||
|
sections_lst.remove(library)
|
||||||
|
libraries = sections_lst
|
||||||
|
|
||||||
# Create user server objects
|
# Create user server objects
|
||||||
if users:
|
if users:
|
||||||
for user in users:
|
for user in users:
|
||||||
@ -575,7 +601,7 @@ if __name__ == "__main__":
|
|||||||
delete_playlist(playlist_dict)
|
delete_playlist(playlist_dict)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
keys_list, title = build_playlist(opts.jbop, opts.libraries, opts.days, opts.top, search)
|
keys_list, title = build_playlist(opts.jbop, libraries, opts.days, opts.top, search)
|
||||||
|
|
||||||
if opts.jbop and opts.action == 'show':
|
if opts.jbop and opts.action == 'show':
|
||||||
show_playlist(title.title(), keys_list)
|
show_playlist(title.title(), keys_list)
|
||||||
|
Loading…
Reference in New Issue
Block a user