handle feature without TMDB id

This commit is contained in:
Ronald Schaten 2021-03-16 18:30:37 +01:00
parent aa6f35b4de
commit a57e2234a0

View File

@ -103,9 +103,13 @@ def conduct_program(program_file, feature):
choice = settings['choice']
trailertype = settings['type']
count = settings['count']
if tmdbid:
movies = get_recommendations(apikey, tmdbid, language, choice)
random.shuffle(movies)
trailers = get_trailers(apikey, movies, language, trailertype, count)
else:
print("TODO: this feature has no tmdb id, find someting else to play")
trailers = []
for trailer in trailers:
entry = {'type': 'video', 'data': trailer['location']}
program.append(entry)
@ -118,6 +122,8 @@ def get_feature(movieid):
query = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties": ["file", "mpaa", "uniqueid"]}, "id": "1"}' % movieid
json_response = xbmc.executeJSONRPC(query)
response = json.loads(json_response)
if not 'tmdb' in response['result']['moviedetails']['uniqueid']:
response['result']['moviedetails']['uniqueid']['tmdb'] = 0
feature = {
'label': response['result']['moviedetails']['label'],
'file': response['result']['moviedetails']['file'],