Skip to content

Commit

Permalink
fix(search): 🐛 fix library language scoring comparison
Browse files Browse the repository at this point in the history
also remove unused url/ctx code
  • Loading branch information
djdembeck committed Sep 28, 2021
1 parent ee618dc commit 772860f
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions Contents/Code/__init__.py
Expand Up @@ -157,9 +157,6 @@ class AudiobookAlbum(Agent.Album):
prev_search_provider = 0

def search(self, results, media, lang, manual):
url_info = SiteUrl(True, "www.audible.com", lang)
ctx = url_info.SetupUrls()

# Instantiate search helper
search_helper = SearchTool(lang, manual, media, results)

Expand Down Expand Up @@ -255,9 +252,6 @@ def search(self, results, media, lang, manual):
break

def update(self, metadata, media, lang, force=False):
url_info = SiteUrl(True, "www.audible.com", lang)
ctx = url_info.SetupUrls()

log.separator(
msg=(
"UPDATING: " + media.title + (
Expand All @@ -267,11 +261,8 @@ def update(self, metadata, media, lang, force=False):
log_level="info"
)

# Make url
url = ctx['AUD_BOOK_INFO'] % metadata.id

# Instantiate update helper
update_helper = UpdateTool(force, lang, media, metadata, url)
update_helper = UpdateTool(force, lang, media, metadata)

self.call_item_api(update_helper)

Expand Down Expand Up @@ -398,7 +389,7 @@ def score_result(self, f, helper, i, info, year):
asin = f['asin']
author = f['author'][0]['name']
date = f['date']
language = f['language']
language = f['language'].title()
narrator = f['narrator'][0]['name']
title = f['title']

Expand Down Expand Up @@ -496,7 +487,7 @@ def score_language(self, helper, language):
log.debug(
'Audible language: %s; Library language: %s',
language,
helper.lang
lang_dict[helper.lang]
)
log.debug("Book is not library language, deduct 2 points")
return 2
Expand Down

0 comments on commit 772860f

Please sign in to comment.