diff --git a/comictalker/comiccacher.py b/comictalker/comiccacher.py index 18a33c5..f3e8173 100644 --- a/comictalker/comiccacher.py +++ b/comictalker/comiccacher.py @@ -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]), ) diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 35aa3ec..3e4561a 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -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"], diff --git a/testing/comicvine.py b/testing/comicvine.py index f5fb508..d6d1c6d 100644 --- a/testing/comicvine.py +++ b/testing/comicvine.py @@ -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", diff --git a/tests/issueidentifier_test.py b/tests/issueidentifier_test.py index ad12553..7f03c9b 100644 --- a/tests/issueidentifier_test.py +++ b/tests/issueidentifier_test.py @@ -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"],