Skip to content

Commit 49a32b5

Browse files
authored
Update to JSON Genre Tag code
Discovered that not all books have two legit genre tags. Made the second line optional to prevent it failing out on books with only one tag.
1 parent 0f5db94 commit 49a32b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Contents/Code/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def json_decode(output):
2020

2121

2222
# URLs
23-
VERSION_NO = '1.2017.11.09.5'
23+
VERSION_NO = '1.2017.11.10.1'
2424

2525
REQUEST_DELAY = 0 # Delay used when requesting HTML, may be good to have to prevent being banned from the site
2626

@@ -499,7 +499,10 @@ def update(self, metadata, media, lang, force=False):
499499
#for key in json_data:
500500
# Log('{0}:{1}'.format(key, json_data[key]))
501501
genre1=json_data['itemListElement'][1]['item']['name']
502-
genre2=json_data['itemListElement'][2]['item']['name']
502+
try: # Not all books have two genre tags.
503+
genre2=json_data['itemListElement'][2]['item']['name']
504+
except:
505+
continue
503506

504507
for r in html.xpath('//li[contains (@class, "seriesLabel")]'):
505508
series = self.getStringContentFromXPath(r, '//li[contains (@class, "seriesLabel")]//a[1]')

0 commit comments

Comments
 (0)