Skip to content

Commit

Permalink
Fix getting latest episode (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister authored Oct 4, 2024
1 parent 246920e commit 4761108
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions resources/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def get_latest_episode_data(program_name):
variables = {
'pageId': '/vrtnu/a-z/{}.model.json'.format(program_name),
}
return api_req(graphql_query, operation_name, variables)
return api_req(graphql_query, operation_name, variables, client='MobileAndroid')


def get_seasons_data(program_name):
Expand Down Expand Up @@ -1050,7 +1050,7 @@ def get_latest_episode(program_name):
page = api_data.get('data').get('page')
if page:
most_relevant_ep = page.get('components')[0].get('mostRelevantEpisodeTile')
if most_relevant_ep.get('title') == 'Meest recente aflevering':
if most_relevant_ep and most_relevant_ep.get('title') == 'Meest recente aflevering':
latest_episode = most_relevant_ep
else:
items = page.get('components')[1].get('items')[0].get('components')[0]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ def test_play_livestream_by_id_route(self):
@unittest.skipUnless(xbmc_addon.settings.get('password'), 'Skipping as VRT password is missing.')
def test_play_latestepisode_route(self):
"""Play last episode method: /play/lastepisode/<program>"""
addon.run(['plugin://plugin.video.vrt.nu/play/latest/het-journaal', '0', ''])
self.assertEqual(plugin.url_for(addon.play_latest, program_name='het-journaal'), 'plugin://plugin.video.vrt.nu/play/latest/het-journaal')
addon.run(['plugin://plugin.video.vrt.nu/play/latest/vrt-nws-journaal', '0', ''])
self.assertEqual(plugin.url_for(addon.play_latest, program_name='vrt-nws-journaal'), 'plugin://plugin.video.vrt.nu/play/latest/vrt-nws-journaal')
addon.run(['plugin://plugin.video.vrt.nu/play/latest/terzake', '0', ''])
self.assertEqual(plugin.url_for(addon.play_latest, program_name='terzake'), 'plugin://plugin.video.vrt.nu/play/latest/terzake')
addon.run(['plugin://plugin.video.vrt.nu/play/latest/winteruur', '0', ''])
Expand Down

0 comments on commit 4761108

Please sign in to comment.