diff --git a/comictalker/comiccacher.py b/comictalker/comiccacher.py index aef76d4..1d9cfd8 100644 --- a/comictalker/comiccacher.py +++ b/comictalker/comiccacher.py @@ -122,8 +122,11 @@ class ComicCacher: + "story_arcs TEXT," # Newline separated + "genres TEXT," # Newline separated + "tags TEXT," # Newline separated - + "rating FLOAT," - + "manga TEXT," # Yes/Yes (Right to Left)/No + + "critical_rating FLOAT," + + "manga TEXT," # Yes/YesAndRightToLeft/No + + "maturity_rating TEXT," + + "language TEXT," # 2-letter iso code + + "country TEXT," # 2-letter iso code + "complete BOOL," # Is the data complete? Includes characters, locations, credits. + "PRIMARY KEY (id, source_name))" ) @@ -255,8 +258,11 @@ class ComicCacher: "story_arcs": "\n".join(issue.story_arcs), "genres": "\n".join(issue.genres), "tags": "\n".join(issue.tags), - "rating": issue.rating, + "critical_rating": issue.critical_rating, "manga": issue.manga, + "maturity_rating": issue.maturity_rating, + "language": issue.language, + "country": issue.country, "credits": json.dumps([dataclasses.asdict(x) for x in issue.credits]), "complete": issue.complete, } @@ -357,9 +363,12 @@ class ComicCacher: story_arcs=row[17].strip().splitlines(), genres=row[18].strip().splitlines(), tags=row[19].strip().splitlines(), - rating=row[20], + critical_rating=row[20], manga=row[21], - complete=bool(row[22]), + maturity_rating=row[22], + language=row[23], + country=row[24], + complete=bool(row[25]), ) results.append(record) @@ -423,9 +432,12 @@ class ComicCacher: story_arcs=row[17].strip().splitlines(), genres=row[18].strip().splitlines(), tags=row[19].strip().splitlines(), - rating=row[20], + critical_rating=row[20], manga=row[21], - complete=bool(row[22]), + maturity_rating=row[22], + language=row[23], + country=row[24], + complete=bool(row[25]), ) return record diff --git a/comictalker/resulttypes.py b/comictalker/resulttypes.py index 45a38e0..c7fa18c 100644 --- a/comictalker/resulttypes.py +++ b/comictalker/resulttypes.py @@ -36,11 +36,14 @@ class ComicIssue: id: str image_url: str issue_number: str - rating: float + critical_rating: float + maturity_rating: str manga: str genres: list[str] tags: list[str] name: str + language: str # 2-letter iso code + country: str # 2-letter iso code site_detail_url: str series: ComicSeries alt_image_urls: list[str] diff --git a/comictalker/talker_utils.py b/comictalker/talker_utils.py index ecb97a4..b5c3094 100644 --- a/comictalker/talker_utils.py +++ b/comictalker/talker_utils.py @@ -96,8 +96,16 @@ def map_comic_issue_to_metadata( metadata.manga = issue_results.manga else: metadata.manga = "Unknown" - if issue_results.rating: - metadata.critical_rating = utils.xlate_float(issue_results.rating) + if issue_results.critical_rating: + metadata.critical_rating = utils.xlate_float(issue_results.critical_rating) + + if issue_results.language: + # 2-letter code # TODO Run check against pycountry? + metadata.language = issue_results.language + + if issue_results.country: + # 2-letter code # TODO Run check against pycountry? + metadata.language = issue_results.country return metadata diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 3dc77ef..9476c0d 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -563,6 +563,9 @@ 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 [], @@ -579,8 +582,11 @@ class ComicVineTalker(ComicTalker): locations=location_list, teams=teams_list, story_arcs=story_list, - rating=0, + critical_rating=0, + maturity_rating="", manga="", + language="", + country="", genres=[], tags=[], credits=persons_list, diff --git a/testing/comicvine.py b/testing/comicvine.py index 44d169b..7cb9df5 100644 --- a/testing/comicvine.py +++ b/testing/comicvine.py @@ -186,8 +186,11 @@ comic_issue_result = ComicIssue( credits=[], locations=[], story_arcs=[], - rating=0, + critical_rating=0, + maturity_rating="", manga="", + language="", + country="", genres=[], tags=[], teams=[],