handle feature without TMDB id
This commit is contained in:
parent
aa6f35b4de
commit
a57e2234a0
6
addon.py
6
addon.py
@ -103,9 +103,13 @@ def conduct_program(program_file, feature):
|
|||||||
choice = settings['choice']
|
choice = settings['choice']
|
||||||
trailertype = settings['type']
|
trailertype = settings['type']
|
||||||
count = settings['count']
|
count = settings['count']
|
||||||
|
if tmdbid:
|
||||||
movies = get_recommendations(apikey, tmdbid, language, choice)
|
movies = get_recommendations(apikey, tmdbid, language, choice)
|
||||||
random.shuffle(movies)
|
random.shuffle(movies)
|
||||||
trailers = get_trailers(apikey, movies, language, trailertype, count)
|
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:
|
for trailer in trailers:
|
||||||
entry = {'type': 'video', 'data': trailer['location']}
|
entry = {'type': 'video', 'data': trailer['location']}
|
||||||
program.append(entry)
|
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
|
query = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"movieid": %s, "properties": ["file", "mpaa", "uniqueid"]}, "id": "1"}' % movieid
|
||||||
json_response = xbmc.executeJSONRPC(query)
|
json_response = xbmc.executeJSONRPC(query)
|
||||||
response = json.loads(json_response)
|
response = json.loads(json_response)
|
||||||
|
if not 'tmdb' in response['result']['moviedetails']['uniqueid']:
|
||||||
|
response['result']['moviedetails']['uniqueid']['tmdb'] = 0
|
||||||
feature = {
|
feature = {
|
||||||
'label': response['result']['moviedetails']['label'],
|
'label': response['result']['moviedetails']['label'],
|
||||||
'file': response['result']['moviedetails']['file'],
|
'file': response['result']['moviedetails']['file'],
|
||||||
|
Loading…
Reference in New Issue
Block a user