예제 #1
0
 def __init__(self, kodi):
     """ Initialise object
     :type kodi: resources.lib.kodiwrapper.KodiWrapper
     """
     self._kodi = kodi
     self._vtm_go = VtmGo(self._kodi)
     self._vtm_go_stream = VtmGoStream(self._kodi)
예제 #2
0
 def __init__(self):
     """ Initialise object """
     self._auth = VtmGoAuth(kodiutils.get_setting('username'),
                            kodiutils.get_setting('password'),
                            'VTM',
                            kodiutils.get_setting('profile'),
                            kodiutils.get_tokens_path())
     self._vtm_go = VtmGo(self._auth)
     self._vtm_go_stream = VtmGoStream()
예제 #3
0
    def __init__(self):
        """ Initialise object """
        try:
            self._auth = VtmGoAuth(kodiutils.get_setting('username'),
                                   kodiutils.get_setting('password'),
                                   'VTM',
                                   kodiutils.get_setting('profile'),
                                   kodiutils.get_tokens_path())
        except NoLoginException:
            self._auth = None

        self._vtm_go = VtmGo(self._auth)
        self._vtm_go_stream = VtmGoStream(self._auth)
예제 #4
0
def play(category, item):
    """ Play the requested item. Uses setResolvedUrl(). """
    _vtmgostream = VtmGoStream(kodi)

    # Check if inputstreamhelper is correctly installed
    try:
        from inputstreamhelper import Helper
        is_helper = Helper('mpd', drm='com.widevine.alpha')
        if not is_helper.check_inputstream():
            # inputstreamhelper has already shown an error
            return

    except ImportError:
        kodi.show_ok_dialog(message=kodi.localize(30708))  # Please reboot Kodi
        return

    # Get stream information
    try:
        resolved_stream = _vtmgostream.get_stream(category, item)

    except GeoblockedException:
        kodi.show_ok_dialog(heading=kodi.localize(30709),
                            message=kodi.localize(30710))  # Geo-blocked
        return

    except UnavailableException:
        kodi.show_ok_dialog(heading=kodi.localize(30711),
                            message=kodi.localize(30712))  # Unavailable
        return

    info_dict = {
        'tvshowtitle': resolved_stream.program,
        'title': resolved_stream.title,
        'duration': resolved_stream.duration,
    }

    prop_dict = {}

    stream_dict = {
        'duration': resolved_stream.duration,
    }

    # Lookup metadata
    try:
        if category == 'movies':
            info_dict.update({'mediatype': 'movie'})

            # Get details
            details = VtmGo(kodi).get_movie(item)
            info_dict.update({
                'plot': details.description,
                'year': details.year,
            })

        elif category == 'episodes':
            info_dict.update({'mediatype': 'episode'})

            # Get details
            details = VtmGo(kodi).get_episode(item)
            info_dict.update({
                'plot': details.description,
                'season': details.season,
                'episode': details.number,
            })

        elif category == 'channels':
            info_dict.update({'mediatype': 'video'})

            # For live channels, we need to keep on updating the manifest
            # This might not be needed, and could be done with the Location-tag updates if inputstream.adaptive supports it
            # See https://github.com/peak3d/inputstream.adaptive/pull/298#issuecomment-524206935
            prop_dict.update({
                'inputstream.adaptive.manifest_update_parameter':
                'full',
            })

        else:
            raise Exception('Unknown category %s' % category)

    except GeoblockedException:
        kodi.show_ok_dialog(heading=kodi.localize(30709),
                            message=kodi.localize(30710))  # Geo-blocked
        return

    except UnavailableException:
        # We continue without details.
        # This seems to make it possible to play some programs what don't have metadata.
        pass

    # Play this item
    kodi.play(TitleItem(
        title=resolved_stream.title,
        path=resolved_stream.url,
        subtitles_path=resolved_stream.subtitles,
        art_dict={},
        info_dict=info_dict,
        prop_dict=prop_dict,
        stream_dict=stream_dict,
        is_playable=True,
    ),
              license_key=_vtmgostream.create_license_key(
                  resolved_stream.license_url))