Convert all start_year to int.

This commit is contained in:
Mizaki 2022-10-15 23:20:50 +01:00
parent 34163fe9d7
commit 43464724bd
6 changed files with 12 additions and 10 deletions

View File

@ -39,7 +39,7 @@ class AutoTagStartWindow(QtWidgets.QDialog):
self.cbxSpecifySearchString.setChecked(False)
self.cbxSplitWords.setChecked(False)
self.sbNameMatchSearchThresh.setValue(self.settings.id_series_match_identify_thresh)
self.sbNameMatchSearchThresh.setValue(self.settings.id_series_match_identify_thresh) # TODO fix
self.leSearchString.setEnabled(False)
self.cbxSaveOnLowConfidence.setChecked(self.settings.save_on_low_confidence)

View File

@ -456,7 +456,7 @@ class IssueIdentifier:
"issue_id": 0,
"volume_id": series["id"],
"month": 0,
"year": int(series["start_year"]),
"year": series["start_year"],
"publisher": series["publisher"],
"image_url": image_url,
"thumb_url": thumb_url,

View File

@ -18,7 +18,7 @@ class ComicVolume(TypedDict, total=False):
image: str
name: Required[str]
publisher: str
start_year: str
start_year: int
class ComicIssue(TypedDict, total=False):

View File

@ -399,6 +399,11 @@ class ComicVineTalker(TalkerBase):
else:
image = record["image"]["super_url"]
if record.get("start_year") is None:
start_year = 0
else:
start_year = int(record["start_year"])
formatted_results.append(
ComicVolume(
aliases=record["aliases"],
@ -408,7 +413,7 @@ class ComicVineTalker(TalkerBase):
image=image,
name=record["name"],
publisher=pub_name,
start_year=record.get("start_year", ""),
start_year=start_year,
)
)
@ -793,7 +798,7 @@ class ComicVineTalker(TalkerBase):
metadata.comments = self.cleanup_html(issue_results["description"], own_settings["remove_html_tables"]["value"])
if own_settings["use_series_start_as_volume"]["value"]:
metadata.volume = int(volume_results["start_year"])
metadata.volume = volume_results["start_year"]
metadata.notes = (
f"Tagged with ComicTagger {ctversion.version} using info from Comic Vine on"

View File

@ -12,7 +12,7 @@ search_results = [
image="https://test.org/image/1",
name="test",
publisher="test",
start_year="", # This is currently submitted as a string and returned as an int
start_year=0,
aliases="",
),
comictalker.resulttypes.ComicVolume(
@ -22,7 +22,7 @@ search_results = [
image="https://test.org/image/2",
name="test 2",
publisher="test",
start_year="", # This is currently submitted as a string and returned as an int
start_year=0,
aliases="",
),
]

View File

@ -11,8 +11,6 @@ from testing.comicdata import select_details
def test_search_for_series(comicvine_api, comic_cache):
ct = comictalker.talkers.comicvine.ComicVineTalker()
results = ct.search_for_series("cory doctorows futuristic tales of the here and now")
for r in results:
r["start_year"] = int(r["start_year"])
cache_issues = comic_cache.get_search_results(ct.source_name, "cory doctorows futuristic tales of the here and now")
assert results == cache_issues
@ -20,7 +18,6 @@ def test_search_for_series(comicvine_api, comic_cache):
def test_fetch_volume_data(comicvine_api, comic_cache):
ct = comictalker.talkers.comicvine.ComicVineTalker()
result = ct.fetch_partial_volume_data(23437)
result["start_year"] = int(result["start_year"])
del result["description"]
del result["image"]
assert result == comic_cache.get_volume_info(23437, ct.source_name)