Beispiel #1
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._api = VtmGo(self._auth)
Beispiel #2
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)
Beispiel #3
0
 def __init__(self):
     Monitor.__init__(self)
     self.kodi = KodiWrapper()
     self.vtm_go = VtmGo(self.kodi)
     self.vtm_go_auth = VtmGoAuth(self.kodi)
     self.update_interval = 24 * 3600  # Every 24 hours
     self.cache_expiry = 30 * 24 * 3600  # One month
Beispiel #4
0
 def __init__(self, kodi):
     """ Initialise object
     :type kodi: KodiWrapper
     """
     self._kodi = kodi
     self._vtm_go = VtmGo(self._kodi)
     self._menu = Menu(self._kodi)
Beispiel #5
0
 def __init__(self, port):
     """ Initialise object
     :type port: int
     """
     self._vtm_go = VtmGo()
     self._vtm_go_epg = VtmGoEpg()
     self.port = port
 def __init__(self, kodi, port):
     """ Initialise object
     :type kodi: resources.lib.kodiwrapper.KodiWrapper
     """
     self._kodi = kodi
     self._vtm_go = VtmGo(self._kodi)
     self._vtm_go_epg = VtmGoEpg(self._kodi)
     self.port = port
 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)
    def onSettingsChanged(self):  # pylint: disable=invalid-name
        """ Callback when a setting has changed """
        # Refresh our VtmGo instance
        self.vtm_go = VtmGo(self._kodi)

        if self.vtm_go_auth.has_credentials_changed():
            _LOGGER.debug('Clearing auth tokens due to changed credentials')
            self.vtm_go_auth.clear_token()

            # Refresh container
            self._kodi.container_refresh()
Beispiel #9
0
    def onSettingsChanged(self):
        """ Callback when a setting has changed """
        # Refresh our VtmGo instance
        self.vtm_go = VtmGo(self.kodi)

        if self.vtm_go_auth.has_credentials_changed():
            self.kodi.log('Clearing auth tokens due to changed credentials',
                          LOG_INFO)
            self.vtm_go_auth.clear_token()

            # Refresh container
            self.kodi.container_refresh()
Beispiel #10
0
 def __init__(self, port):
     """ Initialise object
     :type port: int
     """
     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_epg = VtmGoEpg()
     self.port = port
Beispiel #11
0
    def play(self, category, item):
        """ Play the requested item.
        :type category: string
        :type item: string
        """
        # 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:
            self._kodi.show_ok_dialog(message=self._kodi.localize(30708))  # Please reboot Kodi
            return

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

        except StreamGeoblockedException:
            self._kodi.show_ok_dialog(heading=self._kodi.localize(30709), message=self._kodi.localize(30710))  # This video is geo-blocked...
            self._kodi.end_of_directory()
            return

        except StreamUnavailableException:
            self._kodi.show_ok_dialog(heading=self._kodi.localize(30711), message=self._kodi.localize(30712))  # The video is unavailable...
            self._kodi.end_of_directory()
            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 in ['movies', 'oneoffs']:
                info_dict.update({'mediatype': 'movie'})

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

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

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

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

                # 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 UnavailableException:
            # We continue without details.
            # This seems to make it possible to play some programs what don't have metadata.
            pass

        # Play this item
        self._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=self._vtm_go_stream.create_license_key(resolved_stream.license_url))
 def onSettingsChanged(self):
     """ Callback when a setting has changed """
     # Refresh our VtmGo instance
     self.vtm_go = VtmGo(self.kodi)
Beispiel #13
0
 def __init__(self, kodi):
     """ Initialise object """
     self._kodi = kodi
     self._vtm_go = VtmGo(self._kodi)
Beispiel #14
0
""" Addon code """

from __future__ import absolute_import, division, unicode_literals

import routing

from resources.lib import GeoblockedException, UnavailableException
from resources.lib.kodiwrapper import KodiWrapper, TitleItem
from resources.lib.vtmgo.vtmgo import Content, VtmGo
from resources.lib.vtmgo.vtmgoauth import VtmGoAuth, InvalidLoginException
from resources.lib.vtmgo.vtmgoepg import VtmGoEpg
from resources.lib.vtmgo.vtmgostream import VtmGoStream

routing = routing.Plugin()
kodi = KodiWrapper(routing=routing)
vtm_go = VtmGo(kodi)


@routing.route('/kids')
def show_kids_index():
    """ Show the main menu (kids) """
    show_index()


@routing.route('/')
def show_index():
    """ Show the main menu """
    kids = kodi.kids_mode()

    listing = []
    listing.extend([
Beispiel #15
0
    def onSettingsChanged(self):
        """ Callback when a setting has changed """
        self.kodi.log('IN VTM GO: Settings changed')

        # Refresh our VtmGo instance
        self.vtm_go = VtmGo(self.kodi)
Beispiel #16
0
 def __init__(self):
     Monitor.__init__(self)
     self.kodi = KodiWrapper()
     self.vtm_go = VtmGo(self.kodi)
     self.update_interval = 24 * 3600  # Every 24 hours