Remove attempted validation of language and country plus minor changes
This commit is contained in:
parent
e72347656b
commit
d191750231
@ -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:
|
||||
|
@ -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))"
|
||||
)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 [],
|
||||
|
Loading…
Reference in New Issue
Block a user