save missing supports utf-8

pull/420/head
meisnate12 3 years ago
parent 13ed5caed3
commit 39c9bfa28d

@ -1697,14 +1697,13 @@ class CollectionBuilder:
except Failed as e:
logger.error(e)
continue
current_title = str(show.title.encode("ascii", "replace").decode())
if self.check_tmdb_filter(missing_id, False, check_released=self.details["missing_only_released"]):
missing_shows_with_names.append((current_title, missing_id))
missing_shows_with_names.append((show.title, missing_id))
if self.details["show_missing"] is True:
logger.info(f"{self.name} Collection | ? | {current_title} (TVDB: {missing_id})")
logger.info(f"{self.name} Collection | ? | {show.title} (TVDB: {missing_id})")
else:
if self.details["show_filtered"] is True and self.details["show_missing"] is True:
logger.info(f"{self.name} Collection | X | {current_title} (TVDb: {missing_id})")
logger.info(f"{self.name} Collection | X | {show.title} (TVDb: {missing_id})")
logger.info("")
logger.info(f"{len(missing_shows_with_names)} Show{'s' if len(missing_shows_with_names) > 1 else ''} Missing")
if len(missing_shows_with_names) > 0:
@ -2102,7 +2101,7 @@ class CollectionBuilder:
for missing_id in self.run_again_shows:
if missing_id not in self.library.show_map:
try:
title = str(self.config.TVDb.get_series(self.language, missing_id).title.encode("ascii", "replace").decode())
title = self.config.TVDb.get_series(self.language, missing_id).title
except Failed as e:
logger.error(e)
continue

@ -203,17 +203,16 @@ class Library(ABC):
pass
def add_missing(self, collection, items, is_movie):
col_name = collection.encode("ascii", "replace").decode()
if col_name not in self.missing:
self.missing[col_name] = {}
if collection not in self.missing:
self.missing[collection] = {}
section = "Movies Missing (TMDb IDs)" if is_movie else "Shows Missing (TVDb IDs)"
if section not in self.missing[col_name]:
self.missing[col_name][section] = {}
if section not in self.missing[collection]:
self.missing[collection][section] = {}
for title, item_id in items:
self.missing[col_name][section][int(item_id)] = str(title).encode("ascii", "replace").decode()
self.missing[collection][section][int(item_id)] = title
with open(self.missing_path, "w"): pass
try:
yaml.round_trip_dump(self.missing, open(self.missing_path, "w"))
yaml.round_trip_dump(self.missing, open(self.missing_path, "w", encoding="utf-8"))
except yaml.scanner.ScannerError as e:
util.print_multiline(f"YAML Error: {util.tab_new_lines(e)}", error=True)

Loading…
Cancel
Save