def onSettingsChanged(self):
     ''' Handler for changes to settings '''
     addon = xbmcaddon.Addon(id='plugin.video.vrt.nu')
     kodi_wrapper = kodiwrapper.KodiWrapper(None, None, addon)
     kodi_wrapper.log_notice('VRT NU Addon: settings changed')
     token_resolver = tokenresolver.TokenResolver(kodi_wrapper)
     token_resolver.reset_cookies()
Beispiel #2
0
def router(params_string):
    ''' This is the main router for the video plugin menu '''
    addon = xbmcaddon.Addon()
    kodi_wrapper = kodiwrapper.KodiWrapper(_ADDON_HANDLE, _ADDON_URL, addon)
    token_resolver = tokenresolver.TokenResolver(kodi_wrapper)
    stream_service = streamservice.StreamService(
        vrtplayer.VRTPlayer.VRT_BASE, vrtplayer.VRTPlayer.VRTNU_BASE_URL,
        kodi_wrapper, token_resolver)
    api_helper = vrtapihelper.VRTApiHelper(kodi_wrapper)
    vrt_player = vrtplayer.VRTPlayer(addon.getAddonInfo('path'), kodi_wrapper,
                                     stream_service, api_helper)
    params = dict(parse_qsl(params_string))
    action = params.get('action')
    if action == actions.LISTING_AZ_TVSHOWS:
        vrt_player.show_tvshow_menu_items(path=None)
    elif action == actions.LISTING_CATEGORIES:
        vrt_player.show_category_menu_items()
    elif action == actions.LISTING_LIVE:
        vrt_player.show_livestream_items()
    elif action == actions.LISTING_EPISODES:
        vrt_player.show_episodes(params.get('video_url'))
    elif action == actions.LISTING_CATEGORY_TVSHOWS:
        vrt_player.show_tvshow_menu_items(path=params.get('video_url'))
    elif action == actions.LISTING_TVGUIDE:
        tv_guide = tvguide.TVGuide(addon.getAddonInfo('path'), kodi_wrapper)
        tv_guide.show_tvguide(params)
    elif action == actions.PLAY:
        video = dict(
            video_url=params.get('video_url'),
            video_id=params.get('video_id'),
            publication_id=params.get('publication_id'),
        )
        vrt_player.play(video)
    else:
        vrt_player.show_main_menu_items()
Beispiel #3
0
 def test_get_live_stream_from_url_does_not_crash(self):
     mock = MagicMock()
     token_resolver = tokenresolver.TokenResolver(mock)
     mock.get_setting = MagicMock(side_effect=self._side_effect)
     mock.get_userdata_path.return_value = "vrttest"
     mock.check_if_path_exists.return_value = False
     mock.make_dir.return_value = None
     mock.open_path.return_value = False
     mock.check_inputstream_adaptive.return_value = True
     service = urltostreamservice.UrlToStreamService(
         vrtplayer.VRTPlayer._VRT_BASE, vrtplayer.VRTPlayer._VRTNU_BASE_URL,
         mock, token_resolver)
     stream = service.get_stream_from_url(
         vrtplayer.VRTPlayer._CANVAS_LIVESTREAM_)
     self.assertTrue(stream != None)
Beispiel #4
0
 def test_get_ondemand_stream_from_url_gets_stream_does_not_crash(self):
     mock = MagicMock()
     token_resolver = tokenresolver.TokenResolver(mock)
     mock.get_setting = MagicMock(side_effect=self._side_effect)
     mock.get_userdata_path.return_value = "vrttest"
     mock.check_if_path_exists.return_value = False
     mock.make_dir.return_value = None
     mock.open_path.return_value = False
     mock.check_inputstream_adaptive.return_value = True
     service = urltostreamservice.UrlToStreamService(
         vrtplayer.VRTPlayer._VRT_BASE, vrtplayer.VRTPlayer._VRTNU_BASE_URL,
         mock, token_resolver)
     stream = service.get_stream_from_url(
         '/vrtnu/a-z/22-3-1-jaar-later---het-onderzoek/2017/22-3-1-jaar-later---het-onderzoek-s2017/'
     )
     self.assertTrue(stream != None)
 def test_get_ondemand_stream_from_url_gets_stream_does_not_crash(self):
     mock = MagicMock()
     token_resolver = tokenresolver.TokenResolver(mock)
     mock.get_setting = MagicMock(side_effect=self._side_effect)
     mock.get_userdata_path.return_value = "vrttest"
     mock.check_if_path_exists.return_value = False
     mock.make_dir.return_value = None
     mock.open_path.return_value = False
     mock.check_inputstream_adaptive.return_value = True
     service = streamservice.StreamService(
         vrtplayer.VRTPlayer.VRT_BASE, vrtplayer.VRTPlayer.VRTNU_BASE_URL,
         mock, token_resolver)
     video = dict(
         video_url='vrtnu/a-z/pano/2019/pano-s2019a6/',
         video_id=None,
         publication_id=None,
     )
     stream = service.get_stream(video)
     self.assertTrue(stream is not None)
 def test_get_live_stream_from_url_does_not_crash_returns_stream_and_licensekey(
         self):
     self._use_drm = 'true'
     mock = MagicMock()
     token_resolver = tokenresolver.TokenResolver(mock)
     mock.get_setting = MagicMock(side_effect=self._side_effect)
     mock.get_userdata_path.return_value = "vrttest"
     mock.check_if_path_exists.return_value = False
     mock.make_dir.return_value = None
     mock.open_path.return_value = False
     mock.check_inputstream_adaptive.return_value = True
     service = streamservice.StreamService(
         vrtplayer.VRTPlayer.VRT_BASE, vrtplayer.VRTPlayer.VRTNU_BASE_URL,
         mock, token_resolver)
     video = dict(
         video_url=vrtplayer.VRTPlayer._CANVAS_LIVESTREAM,
         video_id=None,
         publication_id=None,
     )
     stream = service.get_stream(video)
     self.assertTrue(stream is not None)
     self.assertTrue(stream.license_key is not None)
Beispiel #7
0
def router(params_string):
    addon = xbmcaddon.Addon()
    kodi_wrapper = kodiwrapper.KodiWrapper(_handle, _url, addon)
    token_resolver = tokenresolver.TokenResolver(kodi_wrapper)
    stream_service = urltostreamservice.UrlToStreamService(vrtplayer.VRTPlayer._VRT_BASE,
                                                           vrtplayer.VRTPlayer._VRTNU_BASE_URL,
                                                           kodi_wrapper, token_resolver)
    vrt_player = vrtplayer.VRTPlayer(addon.getAddonInfo('path'), kodi_wrapper, stream_service)
    params = dict(parse_qsl(params_string))
    if params:
        if params['action'] == actions.LISTING_AZ:
            vrt_player.show_az_menu_items()
        elif params['action'] == actions.LISTING_CATEGORIES:
            vrt_player.show_category_menu_items()
        elif params['action'] == actions.LISTING_LIVE:
            vrt_player.show_livestream_items()
        elif params['action'] == actions.LISTING_VIDEOS:
            vrt_player.show_videos(params['video'])
        elif params['action'] == actions.LISTING_CATEGORY_VIDEOS:
            vrt_player.show_video_category_episodes(params['video'])
        elif params['action'] == actions.PLAY:
            vrt_player.play(params['video'])
    else:
        vrt_player.show_main_menu_items()