diff --git a/addon.py b/addon.py index 6911eea..b9db8d2 100644 --- a/addon.py +++ b/addon.py @@ -103,9 +103,13 @@ def conduct_program(program_file, feature): choice = settings['choice'] trailertype = settings['type'] count = settings['count'] - movies = get_recommendations(apikey, tmdbid, language, choice) - random.shuffle(movies) - trailers = get_trailers(apikey, movies, language, trailertype, 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'],