Beispiel #1
0
    def __init__(self, *args, **kwargs):
        super(TestVtmGo, self).__init__(*args, **kwargs)

        self._vtmgoauth = vtmgoauth.VtmGoAuth(kodi)
        self._vtmgo = vtmgo.VtmGo(kodi)
        self._vtmgostream = vtmgostream.VtmGoStream(kodi)
        self._player = Player(kodi)
Beispiel #2
0
def play_from_page(channel, page):
    """ Play the requested item """
    try:  # Python 3
        from urllib.parse import unquote
    except ImportError:  # Python 2
        from urllib import unquote

    from resources.lib.modules.player import Player
    Player().play_from_page(channel, unquote(page))
Beispiel #3
0
    def play_epg_datetime(self, channel, timestamp):
        """ Play a program based on the channel and the timestamp when it was aired
        :type channel: str
        :type timestamp: str
        """
        broadcast = self._epg.get_broadcast(channel, timestamp)
        if not broadcast:
            kodiutils.ok_dialog(message=kodiutils.localize(30713))  # The requested video was not found in the guide.
            kodiutils.end_of_directory()
            return

        if not broadcast.video_url:
            kodiutils.ok_dialog(message=kodiutils.localize(30712))  # The video is unavailable and can't be played right now.
            kodiutils.end_of_directory()
            return

        Player().play_from_page(channel, broadcast.video_url)
Beispiel #4
0
def play(category, item):
    """ Play the requested item """
    from resources.lib.modules.player import Player
    Player().play(category, item)
Beispiel #5
0
def play(uuid):
    """ Play the requested item """
    from resources.lib.modules.player import Player
    Player().play(uuid)
def play_asset(asset_id):
    """ PLay a Program """
    from resources.lib.modules.player import Player
    Player().play_asset(asset_id)
def play_from_page(page):
    """ Play the requested item """
    from resources.lib.modules.player import Player
    Player().play_from_page(unquote(page))
def play_live(channel):
    """ Play the requested item """
    from resources.lib.modules.player import Player
    Player().live(channel)
Beispiel #9
0
def play_or_live(category, item, channel):
    """ Ask to play the requested item or switch to the live channel """
    from resources.lib.modules.player import Player
    Player().play_or_live(category, item, channel)
Beispiel #10
0
class TestVtmGo(unittest.TestCase):
    """ Tests for VTM GO API """

    def __init__(self, *args, **kwargs):
        super(TestVtmGo, self).__init__(*args, **kwargs)

        self._vtmgoauth = vtmgoauth.VtmGoAuth(kodi)
        self._vtmgo = vtmgo.VtmGo(kodi)
        self._vtmgostream = vtmgostream.VtmGoStream(kodi)
        self._player = Player(kodi)

    def setUp(self):
        # Don't warn that we don't close our HTTPS connections, this is on purpose.
        # warnings.simplefilter("ignore", ResourceWarning)
        pass

    def test_login(self):
        token = self._vtmgoauth.get_token()
        self.assertTrue(token)

    def test_get_config(self):
        config = self._vtmgo.get_config()
        self.assertTrue(config)

    def test_get_profiles(self):
        profiles = self._vtmgo.get_profiles()
        self.assertTrue(profiles)

    def test_catalog(self):
        categories = self._vtmgo.get_categories()
        self.assertTrue(categories)

        items = self._vtmgo.get_items()
        self.assertTrue(items)

        # Movies
        movie = next(a for a in items if isinstance(a, Movie) and not a.geoblocked)
        info = self._vtmgo.get_movie(movie.movie_id)
        self.assertTrue(info)
        try:
            self._player.play('movies', info.movie_id)
        except StreamGeoblockedException:
            pass

        # Programs
        program = next(a for a in items if isinstance(a, Program) and not a.geoblocked)
        info = self._vtmgo.get_program(program.program_id)
        self.assertTrue(info)

        season = list(info.seasons.values())[0]
        episode = list(season.episodes.values())[0]
        info = self._vtmgo.get_episode(episode.episode_id)
        self.assertTrue(info)
        try:
            self._player.play('episodes', info.episode_id)
        except StreamGeoblockedException:
            pass

    def test_recommendations(self):
        recommendations = self._vtmgo.get_recommendations()
        self.assertTrue(recommendations)

    def test_mylist(self):
        mylist = self._vtmgo.get_swimlane('my-list')
        self.assertIsInstance(mylist, list)

    def test_continuewatching(self):
        mylist = self._vtmgo.get_swimlane('continue-watching')
        self.assertIsInstance(mylist, list)

    def test_live(self):
        channel = self._vtmgo.get_live_channel('vtm')
        self.assertTrue(channel)

        try:
            self._player.play('channels', channel.channel_id)
        except StreamGeoblockedException:
            pass