mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
smart labels sorts were not updating
This commit is contained in:
parent
f5feb75a17
commit
433e0f2e7f
2 changed files with 7 additions and 5 deletions
|
@ -1518,9 +1518,11 @@ class CollectionBuilder:
|
|||
def update_details(self):
|
||||
if not self.obj and self.smart_url:
|
||||
self.library.create_smart_collection(self.name, self.smart_type_key, self.smart_url)
|
||||
elif not self.obj and self.smart_label_collection:
|
||||
elif self.smart_label_collection:
|
||||
try:
|
||||
self.library.create_smart_labels(self.name, sort=self.smart_sort)
|
||||
smart_type, self.smart_url = self.library.smart_label_url(self.name, self.smart_sort)
|
||||
if not self.obj:
|
||||
self.library.create_smart_collection(self.name, smart_type, self.smart_url)
|
||||
except Failed:
|
||||
raise Failed(f"Collection Error: Label: {self.name} was not added to any items in the Library")
|
||||
self.obj = self.library.get_collection(self.name)
|
||||
|
|
|
@ -439,16 +439,16 @@ class PlexAPI:
|
|||
else: method = None
|
||||
self.Plex._server.query(key, method=method)
|
||||
|
||||
def create_smart_labels(self, title, sort):
|
||||
def smart_label_url(self, title, sort):
|
||||
labels = self.get_labels()
|
||||
if title not in labels:
|
||||
raise Failed(f"Plex Error: Label: {title} does not exist")
|
||||
smart_type = 1 if self.is_movie else 2
|
||||
sort_type = movie_smart_sorts[sort] if self.is_movie else show_smart_sorts[sort]
|
||||
uri_args = f"?type={smart_type}&sort={sort_type}&label={labels[title]}"
|
||||
self.create_smart_collection(title, smart_type, uri_args)
|
||||
return smart_type, f"?type={smart_type}&sort={sort_type}&label={labels[title]}"
|
||||
|
||||
def create_smart_collection(self, title, smart_type, uri_args):
|
||||
logger.debug(f"Smart Collection Created: {uri_args}")
|
||||
args = {
|
||||
"type": smart_type,
|
||||
"title": title,
|
||||
|
|
Loading…
Reference in a new issue