Skip to content

Commit

Permalink
Catch more errors
Browse files Browse the repository at this point in the history
  • Loading branch information
djdembeck committed Sep 2, 2021
1 parent 8b575c0 commit f0c3179
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.python-version
7 changes: 4 additions & 3 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# Any score lower than this will be ignored.
IGNORE_SCORE = 45

#THREAD_MAX = 20

# Setup logger
log = Logging()

Expand Down Expand Up @@ -116,7 +114,7 @@ def search(self, results, media, lang, manual=False):
log.debug(
'* Artist: %s', media.artist
)
log.error(
log.warn(
'****************************************'
'Not Ready For Artist Search Yet'
'****************************************'
Expand Down Expand Up @@ -247,6 +245,9 @@ def update(self, metadata, media, lang, force=False):
html = HTML.ElementFromURL(url)
except Exception as e:
log.error(e)
except UnboundLocalError as e:
log.error("Title no longer avaible on Audible: " + metadata.id)
return

# Instantiate update helper
update_helper = UpdateTool(force, lang, media, metadata, url)
Expand Down
10 changes: 7 additions & 3 deletions Contents/Code/update_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ def re_parse_with_date_published(self, json_data):
for c in data['author']:
author_array.append(c['name'])
self.author = ",".join(author_array)

narrator_array = []
for c in data['readBy']:
narrator_array.append(c['name'])
if 'readBy' in data:
for c in data['readBy']:
narrator_array.append(c['name'])
else:
log.warn("No narrator listed for: " + self.metadata.id)
narrator_array.append("[Unknown Artist]")
self.narrator = ",".join(narrator_array)
self.studio = data['publisher']
self.synopsis = data['description']
Expand Down
7 changes: 3 additions & 4 deletions Contents/Code/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from logging import Logging

# Setup logger
log = Logging()


class SiteUrl:
intl_sites = {
Expand Down Expand Up @@ -190,7 +193,3 @@ def SetupUrls(self):
self.set_context_urls()

return self.context


# Setup logger
log = Logging()

0 comments on commit f0c3179

Please sign in to comment.