Beispiel #1
0
def router(params_string):
    addon = xbmcaddon.Addon()
    kodi_wrapper = kodiwrapper.KodiWrapper(_handle, _url, addon)
    stream_service = urltostreamservice.UrlToStreamService(
        vrtplayer.VRTPlayer._VRT_BASE, vrtplayer.VRTPlayer._VRTNU_BASE_URL,
        kodi_wrapper)
    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_vrtnu_video(params['video'])
        elif params['action'] == actions.PLAY_LIVE:
            vrt_player.play_livestream(params['video'])
    else:
        vrt_player.show_main_menu_items()
Beispiel #2
0
 def test_get_stream_from_url_gets_stream_does_not_crash(self):
     mock = mockkodiwrapper.MockKodiWrapper()
     service = urltostreamservice.UrlToStreamService(
         vrtplayer.VRTPlayer._VRT_BASE, vrtplayer.VRTPlayer._VRTNU_BASE_URL,
         mock)
     service.get_stream_from_url(
         '/vrtnu/a-z/apocalyps--de-eerste-wereldoorlog/1/apocalyps--de-eerste-wereldoorlog-s1a5/'
     )
 def play_video(self, path):
     stream_service = urltostreamservice.UrlToStreamService(
         vrtplayer.VRTPlayer._VRT_BASE, vrtplayer.VRTPlayer._VRTNU_BASE_URL,
         self._addon)
     stream = stream_service.get_stream_from_url(path)
     if stream is not None:
         play_item = xbmcgui.ListItem(path=stream.stream_url)
         play_item.setMimeType('application/x-mpegURL')
         if stream.subtitle_url is not None:
             play_item.setSubtitles([stream.subtitle_url])
         xbmcplugin.setResolvedUrl(self._handle, True, listitem=play_item)
Beispiel #4
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 #5
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)