From f8a06a8746ab89de571067e1e8d5fa564f71ceea Mon Sep 17 00:00:00 2001 From: "beville@gmail.com" Date: Fri, 12 Apr 2013 17:53:35 +0000 Subject: [PATCH] Make sure there is a default image URL if none exists git-svn-id: http://comictagger.googlecode.com/svn/trunk@597 6c5673fe-1810-88d6-992b-cd32ca31540c --- comictaggerlib/comicvinetalker.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/comictaggerlib/comicvinetalker.py b/comictaggerlib/comicvinetalker.py index a2c82b0..ecb8d6a 100644 --- a/comictaggerlib/comicvinetalker.py +++ b/comictaggerlib/comicvinetalker.py @@ -58,6 +58,8 @@ class ComicVineTalkerException(Exception): class ComicVineTalker(QObject): + logo_url = "http://static.comicvine.com/bundles/comicvinesite/images/logo.png" + def __init__(self, api_key=""): QObject.__init__(self) @@ -257,7 +259,8 @@ class ComicVineTalker(QObject): volume_issues_result.extend( cv_response['results']) current_result_count += cv_response['number_of_page_results'] - + self.repairUrls( volume_issues_result ) + cvc.add_volume_issues_info( series_id, volume_issues_result ) return volume_issues_result @@ -312,6 +315,8 @@ class ComicVineTalker(QObject): filtered_issues_result.extend( cv_response['results']) current_result_count += cv_response['number_of_page_results'] + self.repairUrls( filtered_issues_result ) + return filtered_issues_result @@ -624,3 +629,11 @@ class ComicVineTalker(QObject): self.altUrlListFetchComplete.emit( alt_cover_url_list, int(self.issue_id) ) + def repairUrls(self, issue_list): + #make sure there are URLs for the image fields + for issue in issue_list: + if issue['image'] is None: + issue['image'] = dict() + issue['image']['super_url'] = ComicVineTalker.logo_url + issue['image']['thumb_url'] = ComicVineTalker.logo_url + \ No newline at end of file