Skip to content

Commit

Permalink
append banners to background + fix name-id search
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaw committed Sep 28, 2020
1 parent b14d4ca commit ebcb3b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Contents/Code/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def search_anime(type, results, media, lang):
}'''
if Prefs['search_type'] == 'name-id':
variables = '''{
"id": "'''+ re.match(' ([0-9]*?)$', search_term).group(1) +'''"
"id": "'''+ re.search(' ([0-9]*?)$', search_term).group(1) +'''"
}'''
if Prefs['search_type'] == 'id':
variables = '''{
Expand Down
21 changes: 19 additions & 2 deletions Contents/Code/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def update_anime(type, metadata, media, force):
if type == 'tv':

# Banners
if metadata.banners is None or force:
if metadata.banners is None or metadata.art is None or force:
try:
banner_hash = base64.b64encode(str(anime['bannerImage']))
banner = Proxy.Media(
Expand All @@ -167,13 +167,30 @@ def update_anime(type, metadata, media, force):
verify=certifi.where()
).content
)
metadata.banners[banner_hash] = banner
except:
Log.Error('Error: Show has no banners: ' + metadata.id)
if metadata.banners is None or force:
metadata.banners[banner_hash] = banner
if metadata.art is None or force:
metadata.art[banner_hash] = banner


# Movie Specific
if type == 'movie':

if metadata.art is None or force:
try:
banner_hash = base64.b64encode(str(anime['bannerImage']))
banner = Proxy.Media(
requests_retry_session().get(
anime['bannerImage'],
verify=certifi.where()
).content
)
metadata.art[banner_hash] = banner
except:
Log.Error('Error: Show has no banners: ' + metadata.id)

# Year
if metadata.year is None or force:
try:
Expand Down

0 comments on commit ebcb3b9

Please sign in to comment.