Skip to content

Commit

Permalink
tmdb3 lookup: Prevent exception when there are no posters.
Browse files Browse the repository at this point in the history
Index out of range occurred in number of posters was 0.
  • Loading branch information
bennettpeter committed May 6, 2021
1 parent 24803fb commit 25d4e22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mythtv/bindings/python/tmdb3/tmdb3/lookup.py
Expand Up @@ -135,15 +135,15 @@ def buildSingle(inetref, opts):
print("locale_language : ", locale_language)

loc_posters = movie.posters
if loc_posters[0].language != locale_language \
if len(loc_posters) and loc_posters[0].language != locale_language \
and locale_language != system_language:
if opts.debug:
print("1: No poster found for language '%s', trying to sort posters by '%s' :"
%(locale_language, system_language))
loc_posters = sorted(movie.posters,
key = lambda x: x.language==system_language, reverse = True)

if loc_posters[0].language != system_language \
if len(loc_posters) and loc_posters[0].language != system_language \
and loc_posters[0].language != locale_language:
if opts.debug:
print("2: No poster found for language '%s', trying to sort posters by '%s' :"
Expand Down

0 comments on commit 25d4e22

Please sign in to comment.