[69] small fixes

This commit is contained in:
meisnate12 2022-05-06 09:32:37 -04:00
parent 62ad5594f9
commit ae81713579
4 changed files with 15 additions and 12 deletions

View file

@ -1 +1 @@
1.16.5-develop68
1.16.5-develop69

View file

@ -1662,7 +1662,7 @@ class CollectionBuilder:
rating_keys = pl_library.show_map[tvdb_id]
break
if not found and tvdb_id not in self.missing_shows:
self.missing_shows.append(input_id)
self.missing_shows.append(tvdb_id)
elif id_type == "tvdb_season" and (self.collection_level == "season" or self.playlist):
tvdb_id, season_num = input_id.split("_")
tvdb_id = int(tvdb_id)
@ -2157,7 +2157,7 @@ class CollectionBuilder:
if is_movie:
item = self.config.TMDb.get_movie(item_id)
else:
item = self.config.TMDb.get_show(self.config.Convert.tvdb_to_tmdb(item_id))
item = self.config.TMDb.get_show(self.config.Convert.tvdb_to_tmdb(item_id, fail=True))
if check_released:
date_to_check = item.release_date if is_movie else item.first_air_date
if not date_to_check or date_to_check > self.current_time:
@ -2498,7 +2498,9 @@ class CollectionBuilder:
add_tags = self.details["label"] if "label" in self.details else None
remove_tags = self.details["label.remove"] if "label.remove" in self.details else None
sync_tags = self.details["label.sync"] if "label.sync" in self.details else None
batch_display += f"\n{self.library.edit_tags('label', self.obj, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags, do_print=False)[28:]}"
tag_results = self.library.edit_tags('label', self.obj, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags, do_print=False)[28:]
if tag_results:
batch_display += f"\n{tag_results}"
logger.info(batch_display)
if len(batch_display) > 25:

View file

@ -94,14 +94,14 @@ class DataFile:
else:
raise Failed(f"File Error: File does not exist {os.path.abspath(file_path)}")
data, _, _ = yaml.util.load_yaml_guess_indent(content)
if not data or not isinstance(data, dict):
raise Failed("YAML Error: File is empty")
return data
except yaml.scanner.ScannerError as ye:
raise Failed(f"YAML Error: {util.tab_new_lines(ye)}")
except Exception as e:
logger.stacktrace()
raise Failed(f"YAML Error: {e}")
if not data or not isinstance(data, dict):
raise Failed("YAML Error: File is empty")
return data
def apply_template(self, name, data, template_call):
if not self.templates:
@ -452,7 +452,7 @@ class MetadataFile(DataFile):
elif auto_type == "trakt_user_lists":
dynamic_data = util.parse("Config", "data", dynamic, parent=map_name, methods=methods, datatype="list")
for option in dynamic_data:
_check_dict(self.config.Trakt.all_user_lists(option))
_check_dict({self.config.Trakt.build_user_url(u[0], u[1]): u[2] for u in self.config.Trakt.all_user_lists(option)})
elif auto_type == "trakt_liked_lists":
_check_dict(self.config.Trakt.all_liked_lists())
elif auto_type == "tmdb_popular_people":

View file

@ -259,14 +259,14 @@ class Trakt:
logger.error(f"Trakt Error: No {id_display} found for {name}")
return ids
def all_user_lists(self, user):
def all_user_lists(self, user="me"):
try:
items = self._request(f"/users/{user}/lists")
except Failed:
raise Failed(f"Trakt Error: User {user} not found")
if len(items) == 0:
raise Failed(f"Trakt Error: User {user} has no lists")
return {self.build_user_url(user, i["ids"]["slug"]): i["name"] for i in items}
return [(user, i["ids"]["slug"], i["name"]) for i in items]
def all_liked_lists(self):
items = self._request(f"/users/likes/lists")
@ -277,9 +277,10 @@ class Trakt:
def build_user_url(self, user, name):
return f"{base_url.replace('api.', '')}/users/{user}/lists/{name}"
def _list(self, data):
def _list(self, data, urlparse=True):
try:
items = self._request(f"{requests.utils.urlparse(data).path}/items")
url = requests.utils.urlparse(data).path if urlparse else f"/users/me/lists/{data}"
items = self._request(f"{url}/items")
except Failed:
raise Failed(f"Trakt Error: List {data} not found")
if len(items) == 0: