[71] fix label collection search

pull/858/head
meisnate12 3 years ago
parent 02aa513551
commit 261eb2ce16

@ -1 +1 @@
1.16.5-develop70
1.16.5-develop71

@ -516,7 +516,7 @@ class MetadataFile(DataFile):
remove_suffix = util.parse("Config", "remove_suffix", self.temp_vars["remove_suffix"], parent="template_variable", datatype="commalist")
elif "remove_suffix" in methods:
remove_suffix = util.parse("Config", "remove_suffix", dynamic, parent=map_name, methods=methods, datatype="commalist")
sync = {i.title: i for i in self.library.search(libtype="collection", label=str(map_name))} if sync else {}
sync = {i.title: i for i in self.library.get_all_collections(label=str(map_name))} if sync else {}
other_name = None
if "other_name" in self.temp_vars and include:
other_name = util.parse("Config", "other_name", self.temp_vars["remove_suffix"], parent="template_variable")

@ -434,11 +434,18 @@ class Plex(Library):
self.PlexServer.settings.get('cinemaTrailersPrerollID').set(preroll)
self.PlexServer.settings.save()
def get_all_collections(self):
return self.search(libtype="collection")
def get_all_collections(self, label=None):
args = "?type=18"
if label:
label_id = next((c.key for c in self.get_tags("label") if c.title == label), None)
if label_id:
args = f"{args}&{label_id}"
else:
return []
return self.get_filter_items(args)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def search(self, title=None, libtype=None, sort=None, maxresults=None, **kwargs):
def search(self, title=None, sort=None, maxresults=None, libtype=None, **kwargs):
return self.Plex.search(title=title, sort=sort, maxresults=maxresults, libtype=libtype, **kwargs)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
@ -575,7 +582,6 @@ class Plex(Library):
if isinstance(result, Actor) and result.librarySectionID == self.Plex.key and result.tag == name:
return result.id
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
def get_search_choices(self, search_name, title=True, name_pairs=False):
final_search = search_translation[search_name] if search_name in search_translation else search_name
final_search = show_translation[final_search] if self.is_show and final_search in show_translation else final_search
@ -583,7 +589,7 @@ class Plex(Library):
names = []
choices = {}
use_title = title and final_search not in ["contentRating", "audioLanguage", "subtitleLanguage", "resolution"]
for choice in self.Plex.listFilterChoices(final_search):
for choice in self.get_tags(final_search):
if choice.title not in names:
names.append((choice.title, choice.key) if name_pairs else choice.title)
choices[choice.title] = choice.title if use_title else choice.key

Loading…
Cancel
Save