Shows media type working
This commit is contained in:
parent
f36f7a7ec0
commit
d3e6d85290
@ -233,38 +233,43 @@ def get_content(library_name, jbop, filters=None, search=None):
|
|||||||
child_lst = []
|
child_lst = []
|
||||||
filter_lst = []
|
filter_lst = []
|
||||||
search_lst = []
|
search_lst = []
|
||||||
|
keyword = ''
|
||||||
|
|
||||||
if search or filters:
|
if search or filters:
|
||||||
if search:
|
if search:
|
||||||
# todo-me replace with documentation showing the available search operators
|
# todo-me replace with documentation showing the available search operators
|
||||||
keyword = {key + '__icontains': value for key, value in search.items()}
|
keyword = {key + '__icontains': value for key, value in search.items()}
|
||||||
# Loop through each library
|
# Loop through each library
|
||||||
for library in library_name:
|
for library in library_name:
|
||||||
plex_library = plex.library.section(library)
|
plex_library = plex.library.section(library)
|
||||||
library_type = plex_library.type
|
library_type = plex_library.type
|
||||||
# Find media type, if show then search/filter episodes
|
# Find media type, if show then search/filter episodes
|
||||||
if library_type == 'movie':
|
if library_type == 'movie':
|
||||||
# Decisions to stack filter and search
|
# Decisions to stack filter and search
|
||||||
if keyword:
|
if keyword:
|
||||||
search_lst = [x.ratingKey for x in plex_library.all(**keyword)]
|
search_lst = [movie.ratingKey for movie in plex_library.all(**keyword)]
|
||||||
child_lst = search_lst
|
child_lst = search_lst
|
||||||
if filters:
|
if filters:
|
||||||
filter_lst = [x.ratingKey for x in plex_library.search(**filters)]
|
filter_lst = [movie.ratingKey for movie in plex_library.search(**filters)]
|
||||||
child_lst = filter_lst
|
child_lst = filter_lst
|
||||||
if keyword and filters:
|
if keyword and filters:
|
||||||
child_lst = list(set(filter_lst) & set(search_lst))
|
child_lst = list(set(filter_lst) & set(search_lst))
|
||||||
elif library_type == 'show':
|
|
||||||
if keyword:
|
elif library_type == 'show':
|
||||||
for child in plex_library.all(**keyword):
|
if keyword:
|
||||||
search_lst += [child.ratingKey]
|
for show in plex_library.all():
|
||||||
child_lst = search_lst
|
for episode in show.episodes(**keyword):
|
||||||
if filters:
|
search_lst += [episode.ratingKey]
|
||||||
filter_lst = [x.ratingKey for x in plex_library.search(**filters)]
|
child_lst = search_lst
|
||||||
child_lst = filter_lst
|
if filters:
|
||||||
if keyword and filters:
|
for show in plex_library.search(**filters):
|
||||||
child_lst = list(set(filter_lst) & set(search_lst))
|
for episode in show.episodes():
|
||||||
else:
|
filter_lst += [episode.ratingKey]
|
||||||
pass
|
child_lst = filter_lst
|
||||||
|
if keyword and filters:
|
||||||
|
child_lst = list(set(filter_lst) & set(search_lst))
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
play_lst = child_lst
|
play_lst = child_lst
|
||||||
|
|
||||||
@ -401,7 +406,7 @@ def show_playlist(playlist_title, playlist_keys):
|
|||||||
plex_obj = plex.fetchItem(key)
|
plex_obj = plex.fetchItem(key)
|
||||||
if plex_obj.type == 'show':
|
if plex_obj.type == 'show':
|
||||||
for episode in plex_obj.episodes():
|
for episode in plex_obj.episodes():
|
||||||
title = "{}".format(episode._prettyfilename())
|
title = u"{}".format(episode._prettyfilename())
|
||||||
title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore').translate(None, "'")
|
title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore').translate(None, "'")
|
||||||
playlist_list.append(title)
|
playlist_list.append(title)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user