diff --git a/comicapi/utils.py b/comicapi/utils.py index 9b2c2f5..650edce 100644 --- a/comicapi/utils.py +++ b/comicapi/utils.py @@ -239,7 +239,7 @@ def get_language_from_iso(iso: str | None) -> str | None: def get_language_iso(string: str | None) -> str | None: if string is None: return None - # Why return this if ISO failed? + # Return current string if all else fails lang = string.casefold() try: diff --git a/comictalker/comiccacher.py b/comictalker/comiccacher.py index 90e0931..c7c8a60 100644 --- a/comictalker/comiccacher.py +++ b/comictalker/comiccacher.py @@ -126,8 +126,8 @@ class ComicCacher: + "critical_rating FLOAT," + "manga TEXT," # Yes/YesAndRightToLeft/No + "maturity_rating TEXT," - + "language TEXT," # 2-letter iso code - + "country TEXT," # 2-letter iso code + + "language TEXT," + + "country TEXT," + "complete BOOL," # Is the data complete? Includes characters, locations, credits. + "PRIMARY KEY (id, source_name))" ) diff --git a/comictalker/talker_utils.py b/comictalker/talker_utils.py index 180397d..7da85bd 100644 --- a/comictalker/talker_utils.py +++ b/comictalker/talker_utils.py @@ -93,35 +93,21 @@ def map_comic_issue_to_metadata( metadata.story_arc = ", ".join(issue_results.story_arcs) if issue_results.genres: metadata.genre = ", ".join(issue_results.genres) + if issue_results.tags: metadata.tags = set(issue_results.tags) + if issue_results.manga: - if issue_results.manga in ["Yes", "yes", "No", "no", "YesAndRightToLeft", "yesandrighttoleft"]: - metadata.manga = issue_results.manga - else: - metadata.manga = "Unknown" + metadata.manga = issue_results.manga + if issue_results.critical_rating: metadata.critical_rating = utils.xlate_float(issue_results.critical_rating) - # 2-letter country code if issue_results.language: - if utils.get_language_from_iso(issue_results.language): - metadata.language = issue_results.language - else: - code = utils.get_language_iso(issue_results.language) - if code: - metadata.language = code + metadata.language = issue_results.language - # ISO country name if issue_results.country: - # Only CBI supports country currently in CT and is a string name - # TODO Use https://codeberg.org/plotski/countryguess as pycountry seems stale? - # Return current entry if conversion fails metadata.country = issue_results.country - if not utils.get_country_iso(issue_results.country): - code = utils.get_country_iso_name(issue_results.country) - if code: - metadata.country = code return metadata diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 3225306..337828c 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -564,9 +564,6 @@ class ComicVineTalker(ComicTalker): series = self._fetch_series_data(record["volume"]["id"]) - # Make below an option? - # TODO Infer country by publisher (and language)? Check series desc for "Translated into English"? - formatted_results.append( ComicIssue( aliases=record["aliases"].split("\n") if record["aliases"] else [],