Shows media type working

This commit is contained in:
Blacktwin 2019-01-01 02:46:48 -05:00
parent f36f7a7ec0
commit d3e6d85290

View File

@ -233,6 +233,7 @@ 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:
@ -246,20 +247,24 @@ def get_content(library_name, jbop, filters=None, search=None):
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': elif library_type == 'show':
if keyword: if keyword:
for child in plex_library.all(**keyword): for show in plex_library.all():
search_lst += [child.ratingKey] for episode in show.episodes(**keyword):
search_lst += [episode.ratingKey]
child_lst = search_lst child_lst = search_lst
if filters: if filters:
filter_lst = [x.ratingKey for x in plex_library.search(**filters)] for show in plex_library.search(**filters):
for episode in show.episodes():
filter_lst += [episode.ratingKey]
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))
@ -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: