Add maturity_rating, language and country to ComicIssue and pass to metadata.
This commit is contained in:
parent
d65a120eb5
commit
97e64fa918
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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=[],
|
||||
|
Loading…
Reference in New Issue
Block a user