Add format (1-shot, limited series, etc.)

This commit is contained in:
Mizaki 2023-05-23 00:27:58 +01:00
parent 8e2411a086
commit e72347656b
6 changed files with 17 additions and 1 deletions

View File

@ -95,6 +95,7 @@ class ComicCacher:
+ "aliases TEXT," # Newline separated
+ "description TEXT,"
+ "genres TEXT," # Newline separated. For filtering etc.
+ "format TEXT,"
+ "timestamp DATE DEFAULT (datetime('now','localtime')), "
+ "source_name TEXT NOT NULL,"
+ "PRIMARY KEY (id, source_name))"
@ -163,6 +164,7 @@ class ComicCacher:
"image_url": record.image_url,
"description": record.description,
"genres": "\n".join(record.genres),
"format": record.format,
"timestamp": datetime.datetime.now(),
"aliases": "\n".join(record.aliases),
}
@ -197,6 +199,7 @@ class ComicCacher:
aliases=record[12].strip().splitlines(),
description=record[13],
genres=record[14].strip().splitlines(),
format=record[15],
)
results.append(result)
@ -223,6 +226,7 @@ class ComicCacher:
"image_url": series_record.image_url,
"description": series_record.description,
"genres": "\n".join(series_record.genres),
"format": series_record.format,
"timestamp": timestamp,
"aliases": "\n".join(series_record.aliases),
}
@ -302,6 +306,7 @@ class ComicCacher:
aliases=row[8].strip().splitlines(),
description=row[9],
genres=row[10].strip().splitlines(),
format=row[11],
)
return result
@ -320,6 +325,7 @@ class ComicCacher:
count_of_issues=None,
count_of_volumes=None,
volume=None,
format=None,
)
con = lite.connect(self.db_file)
with con:
@ -405,6 +411,7 @@ class ComicCacher:
count_of_issues=None,
count_of_volumes=None,
volume=None,
format=None,
)
# now process the results

View File

@ -23,6 +23,7 @@ class ComicSeries:
publisher: str
start_year: int | None
genres: list[str]
format: str | None
def copy(self) -> ComicSeries:
return copy.deepcopy(self)

View File

@ -45,9 +45,13 @@ def map_comic_issue_to_metadata(
metadata.series = utils.xlate(issue_results.series.name)
metadata.issue = IssueString(issue_results.issue_number).as_string()
# Rely on comic talker to valid this number
# Rely on comic talker to validate this number
metadata.issue_count = utils.xlate_int(issue_results.series.volume)
# TODO Generate list in utils (same as language and countries) and check against that in separate PR
if issue_results.series.format:
metadata.format = issue_results.series.format
metadata.volume = utils.xlate_int(issue_results.series.volume)
metadata.volume_count = utils.xlate_int(issue_results.series.count_of_volumes)

View File

@ -518,6 +518,7 @@ class ComicVineTalker(ComicTalker):
publisher=pub_name,
start_year=start_year,
genres=[],
format=None,
)
)

View File

@ -17,6 +17,7 @@ search_results = [
start_year=0,
aliases=[],
genres=[],
format=None,
),
comictalker.resulttypes.ComicSeries(
count_of_issues=1,
@ -30,6 +31,7 @@ search_results = [
start_year=0,
aliases=[],
genres=[],
format=None,
),
]

View File

@ -179,6 +179,7 @@ comic_issue_result = ComicIssue(
publisher=cv_volume_result["results"]["publisher"]["name"],
start_year=int(cv_volume_result["results"]["start_year"]),
genres=[],
format=None,
),
characters=[],
alt_image_urls=[],