Compensate for a split empty string returning ['']. I don't see a way around this?

This commit is contained in:
Mizaki 2022-11-05 01:21:51 +00:00
parent 19e5f10a7b
commit a724fd8430
4 changed files with 18 additions and 18 deletions

View File

@ -183,7 +183,7 @@ class ComicCacher:
count_of_issues=record[7],
start_year=record[8],
image_url=record[9],
aliases=record[10].split("\n"),
aliases=record[10].split("\n") if record[10] else [],
description=record[11],
)
@ -278,7 +278,7 @@ class ComicCacher:
count_of_issues=row[3],
start_year=row[4],
image_url=row[5],
aliases=row[6],
aliases=row[6].split("\n") if row[6] else [],
description=row[7],
)
@ -320,13 +320,13 @@ class ComicCacher:
image_url=row[6],
description=row[8],
volume=volume,
aliases=row[9],
alt_image_urls=row[10].split("\n"),
characters=row[11].split("\n"),
locations=row[12].split("\n"),
aliases=row[9].split("\n") if row[9] else [],
alt_image_urls=row[10].split("\n") if row[10] else [],
characters=row[11].split("\n") if row[11] else [],
locations=row[12].split("\n") if row[12] else [],
credits=json.loads(row[13]),
teams=row[14].split("\n"),
story_arcs=row[15].split("\n"),
teams=row[14].split("\n") if row[14] else [],
story_arcs=row[15].split("\n") if row[15] else [],
complete=bool(row[16]),
)
@ -372,13 +372,13 @@ class ComicCacher:
image_thumb_url=row[7],
description=row[8],
volume=volume,
aliases=row[9],
alt_image_urls=row[11].split("\n"),
characters=row[12].split("\n"),
locations=row[13].split("\n"),
aliases=row[9].split("\n") if row[9] else [],
alt_image_urls=row[11].split("\n") if row[11] else [],
characters=row[12].split("\n") if row[12] else [],
locations=row[13].split("\n") if row[13] else [],
credits=json.loads(row[14]),
teams=row[15].split("\n"),
story_arcs=row[16].split("\n"),
teams=row[15].split("\n") if row[15] else [],
story_arcs=row[16].split("\n") if row[16] else [],
complete=bool(row[17]),
)

View File

@ -376,11 +376,10 @@ class ComicVineTalker(ComicTalker):
start_year = 0
else:
start_year = utils.xlate(record["start_year"], True)
aliases = record["aliases"] or ""
formatted_results.append(
ComicVolume(
aliases=aliases.split("\n"),
aliases=record["aliases"].split("\n") if record["aliases"] else [],
count_of_issues=record.get("count_of_issues", 0),
description=record.get("description", ""),
id=record["id"],

View File

@ -22,7 +22,7 @@ cv_issue_result: dict[str, Any] = {
"number_of_total_results": 1,
"status_code": 1,
"results": {
"aliases": None,
"aliases": [],
"api_detail_url": "https://comicvine.gamespot.com/api/issue/4000-140529/",
"associated_images": [],
"character_credits": [],
@ -117,7 +117,7 @@ cv_volume_result: dict[str, Any] = {
"number_of_total_results": 1,
"status_code": 1,
"results": {
"aliases": None,
"aliases": [],
"api_detail_url": "https://comicvine.gamespot.com/api/volume/4050-23437/",
"count_of_issues": 6,
"date_added": "2008-10-16 05:25:47",

View File

@ -56,6 +56,7 @@ def test_search(cbz, settings, comicvine_api):
"series": f"{testing.comicvine.cv_volume_result['results']['name']} ({testing.comicvine.cv_volume_result['results']['start_year']})",
"distance": 0,
"issue_number": testing.comicvine.cv_issue_result["results"]["issue_number"],
"alt_image_urls": [],
"cv_issue_count": testing.comicvine.cv_volume_result["results"]["count_of_issues"],
"issue_title": testing.comicvine.cv_issue_result["results"]["name"],
"issue_id": testing.comicvine.cv_issue_result["results"]["id"],