Add volume and count_of_volumes to ComicSeries

This commit is contained in:
Mizaki 2023-05-12 21:48:45 +01:00
parent 9e86b5e331
commit 6cf259191e
6 changed files with 36 additions and 10 deletions

View File

@ -88,6 +88,8 @@ class ComicCacher:
+ "name TEXT,"
+ "publisher TEXT,"
+ "count_of_issues INT,"
+ "count_of_volumes INT,"
+ "volume TEXT,"
+ "start_year INT,"
+ "image_url TEXT,"
+ "aliases TEXT," # Newline separated
@ -152,6 +154,8 @@ class ComicCacher:
"name": record.name,
"publisher": record.publisher,
"count_of_issues": record.count_of_issues,
"count_of_volumes": record.count_of_volumes,
"volume": record.volume,
"start_year": record.start_year,
"image_url": record.image_url,
"description": record.description,
@ -183,11 +187,13 @@ class ComicCacher:
name=record[5],
publisher=record[6],
count_of_issues=record[7],
start_year=record[8],
image_url=record[9],
aliases=record[10].strip().splitlines(),
description=record[11],
genres=record[12].strip().splitlines(),
count_of_volumes=record[8],
volume=record[9],
start_year=record[10],
image_url=record[11],
aliases=record[12].strip().splitlines(),
description=record[13],
genres=record[14].strip().splitlines(),
)
results.append(result)
@ -208,6 +214,8 @@ class ComicCacher:
"name": series_record.name,
"publisher": series_record.publisher,
"count_of_issues": series_record.count_of_issues,
"count_of_volumes": series_record.count_of_volumes,
"volume": series_record.volume,
"start_year": series_record.start_year,
"image_url": series_record.image_url,
"description": series_record.description,
@ -281,11 +289,13 @@ class ComicCacher:
name=row[1],
publisher=row[2],
count_of_issues=row[3],
start_year=row[4],
image_url=row[5],
aliases=row[6].strip().splitlines(),
description=row[7],
genres=row[8].strip().splitlines(),
count_of_volumes=row[4],
volume=row[5],
start_year=row[6],
image_url=row[7],
aliases=row[8].strip().splitlines(),
description=row[9],
genres=row[10].strip().splitlines(),
)
return result
@ -302,6 +312,8 @@ class ComicCacher:
start_year=None,
aliases=[],
count_of_issues=None,
count_of_volumes=None,
volume=None,
)
con = lite.connect(self.db_file)
with con:
@ -394,6 +406,8 @@ class ComicCacher:
start_year=None,
aliases=[],
count_of_issues=None,
count_of_volumes=None,
volume=None,
)
# now process the results

View File

@ -14,6 +14,8 @@ class Credit:
class ComicSeries:
aliases: list[str]
count_of_issues: int | None
count_of_volumes: int | None
volume: str | None
description: str
id: str
image_url: str

View File

@ -35,6 +35,8 @@ def map_comic_issue_to_metadata(
metadata.series = utils.xlate(issue_results.series.name)
metadata.issue = IssueString(issue_results.issue_number).as_string()
metadata.volume = utils.xlate(issue_results.series.volume, True)
metadata.volume_count = utils.xlate(issue_results.series.count_of_volumes, True)
if issue_results.name:
metadata.title = utils.xlate(issue_results.name)

View File

@ -501,6 +501,8 @@ class ComicVineTalker(ComicTalker):
ComicSeries(
aliases=aliases.splitlines(),
count_of_issues=record.get("count_of_issues", 0),
count_of_volumes=None,
volume=None,
description=record.get("description", ""),
id=str(record["id"]),
image_url=image_url,

View File

@ -7,6 +7,8 @@ from comicapi import utils
search_results = [
comictalker.resulttypes.ComicSeries(
count_of_issues=1,
count_of_volumes=1,
volume="1",
description="this is a description",
id="1",
image_url="https://test.org/image/1",
@ -18,6 +20,8 @@ search_results = [
),
comictalker.resulttypes.ComicSeries(
count_of_issues=1,
count_of_volumes=1,
volume="1",
description="this is a description",
id="2",
image_url="https://test.org/image/2",

View File

@ -172,6 +172,8 @@ comic_issue_result = ComicIssue(
name=cv_issue_result["results"]["volume"]["name"],
aliases=[],
count_of_issues=cv_volume_result["results"]["count_of_issues"],
count_of_volumes=None,
volume=None,
description=cv_volume_result["results"]["description"],
image_url=cv_volume_result["results"]["image"]["super_url"],
publisher=cv_volume_result["results"]["publisher"]["name"],