diff --git a/resources/lib/apihelper.py b/resources/lib/apihelper.py index 7dcc1eade..9b6be0b53 100644 --- a/resources/lib/apihelper.py +++ b/resources/lib/apihelper.py @@ -570,7 +570,10 @@ def get_episodes(self, program=None, season=None, episodes=None, category=None, seasons = None if 'facets[seasonTitle]' not in unquote(search_url): facets = search_json.get('facets', dict()).get('facets') - seasons = next((f.get('buckets', []) for f in facets if f.get('name') == 'seasons' and len(f.get('buckets', [])) > 1), None) + if facets: + seasons = next((f.get('buckets', []) for f in facets if f.get('name') == 'seasons' and len(f.get('buckets', [])) > 1), None) + else: + seasons = [] episodes = search_json.get('results', [{}]) show_seasons = bool(season != 'allseasons') diff --git a/resources/lib/playerinfo.py b/resources/lib/playerinfo.py index b61d1c004..605cdaa8e 100644 --- a/resources/lib/playerinfo.py +++ b/resources/lib/playerinfo.py @@ -55,6 +55,10 @@ def onPlayBackStarted(self): # pylint: disable=invalid-name # Get episode data episode = self.apihelper.get_single_episode_data(video_id=ep_id.get('video_id'), whatson_id=ep_id.get('whatson_id'), video_url=ep_id.get('video_url')) + # This may be a live stream? + if episode is None: + return + self.asset_id = self.resumepoints.assetpath_to_id(episode.get('assetPath')) self.title = episode.get('program') self.url = url_to_episode(episode.get('url', '')) diff --git a/resources/lib/streamservice.py b/resources/lib/streamservice.py index 2a08b7157..54218de44 100644 --- a/resources/lib/streamservice.py +++ b/resources/lib/streamservice.py @@ -161,6 +161,8 @@ def _get_stream_json(self, api_data, roaming=False): api_url = api_data.media_api_url + '/videos/' + api_data.publication_id + \ api_data.video_id + '?vrtPlayerToken=' + playertoken + '&client=' + api_data.client json_data = get_url_json(url=api_url) + if not json_data: + return None return json_data @staticmethod diff --git a/resources/lib/utils.py b/resources/lib/utils.py index a8f475570..083e232ba 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -116,6 +116,7 @@ def get_url_json(url, cache=None, headers=None, data=None): ''' Return HTTP data ''' if headers is None: headers = dict() + from json import load, loads log(2, 'URL get: {url}', url=unquote(url)) req = Request(url, headers=headers) if data is not None: