def __init__(self): """ Initialise object """ self._auth = Auth(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_setting('loginprovider'), kodiutils.get_setting('profile'), kodiutils.get_tokens_path())
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)
def index(): """ Ask to login, or go to the main menu. """ if not kodiutils.has_credentials(): if not kodiutils.yesno_dialog(message=kodiutils.localize( 30701)): # You need to configure your credentials... # We have no credentials, return to the Home Menu kodiutils.end_of_directory() kodiutils.execute_builtin('ActivateWindow(Home)') return kodiutils.open_settings() try: # Try authentication AuthApi(username=kodiutils.get_setting('username'), password=kodiutils.get_setting('password'), tenant=kodiutils.get_setting('tenant'), token_path=kodiutils.get_tokens_path()) except InvalidLoginException: kodiutils.ok_dialog(message=kodiutils.localize( 30203)) # Your credentials are not valid! kodiutils.open_settings() kodiutils.execute_builtin('ActivateWindow(Home)') kodiutils.end_of_directory() return except HTTPError as exc: kodiutils.ok_dialog(message=kodiutils.localize( 30702, code='HTTP %d' % exc.response.status_code) ) # Unknown error while logging in: {code} kodiutils.end_of_directory() return show_main_menu()
def __init__(self): """ Initialise object """ self._auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path()) self._api = ContentApi(self._auth, cache_path=kodiutils.get_cache_path())
def __init__(self): Monitor.__init__(self) self.update_interval = 24 * 3600 # Every 24 hours self.cache_expiry = 30 * 24 * 3600 # One month self._auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path())
def __init__(self): """ Initialise object. """ auth = AuthApi(username=kodiutils.get_setting('username'), password=kodiutils.get_setting('password'), tenant=kodiutils.get_setting('tenant'), token_path=kodiutils.get_tokens_path()) self._search_api = SearchApi(auth)
def __init__(self, port): """ Initialize IPTV Manager object. """ self.port = port self._auth = AuthApi(username=kodiutils.get_setting('username'), password=kodiutils.get_setting('password'), tenant=kodiutils.get_setting('tenant'), token_path=kodiutils.get_tokens_path())
def __init__(self): """ Initialise object """ auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path()) self._api = ContentApi(auth, cache_path=kodiutils.get_cache_path()) # Workaround for Raspberry Pi 3 and older kodiutils.set_global_setting('videoplayer.useomxplayer', True)
def __init__(self): """ Initialise object. """ auth = AuthApi(username=kodiutils.get_setting('username'), password=kodiutils.get_setting('password'), tenant=kodiutils.get_setting('tenant'), token_path=kodiutils.get_tokens_path()) self._entitlements = auth.list_entitlements() self._channel_api = ChannelApi(auth) self._epg_api = EpgApi(auth)
def index(): """ Show the profile selection, or go to the main menu. """ auth = Auth(kodiutils.get_tokens_path()) tokens = auth.get_tokens() if tokens: select_profile() else: show_login_menu()
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 __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
def verify_credentials(): """ Verify if the user has credentials and if they are valid. """ retry = False while True: # Check if the user has credentials if retry or not kodiutils.get_setting( 'username') or not kodiutils.get_setting('password'): # Ask user to fill in his credentials if not kodiutils.yesno_dialog(message=kodiutils.localize( 30701)): # You need to configure your credentials... # The user doesn't want to do this. Abort to Home screen. return False kodiutils.open_settings() try: # Create Auth object so we actually do a login. Auth(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_setting('loginprovider'), kodiutils.get_setting('profile'), kodiutils.get_tokens_path()) return True except InvalidLoginException: kodiutils.ok_dialog(message=kodiutils.localize( 30203)) # Your credentials are not valid! retry = True except NoStreamzSubscriptionException: kodiutils.ok_dialog(message=kodiutils.localize( 30201)) # Your Streamz account has no valid subscription! retry = True except NoTelenetSubscriptionException: kodiutils.ok_dialog(message=kodiutils.localize( 30202)) # Your Telenet account has no valid subscription! retry = True except LoginErrorException as exc: kodiutils.ok_dialog(message=kodiutils.localize( 30702, code=exc.code)) # Unknown error while logging in: {code} return False except HTTPError as exc: kodiutils.ok_dialog(message=kodiutils.localize( 30702, code='HTTP %d' % exc.response.status_code) ) # Unknown error while logging in: {code} return False
def play(item): """ Play the requested item. :type item: string """ # Workaround for Raspberry Pi 3 and older omxplayer = kodiutils.get_global_setting('videoplayer.useomxplayer') if omxplayer is False: kodiutils.set_global_setting('videoplayer.useomxplayer', True) try: # Check if we have credentials if not kodiutils.get_setting( 'username') or not kodiutils.get_setting('password'): confirm = kodiutils.yesno_dialog( message=kodiutils.localize(30701) ) # To watch a video, you need to enter your credentials. Do you want to enter them now? if confirm: kodiutils.open_settings() kodiutils.end_of_directory() return # Fetch an auth token now try: auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path()) # Get stream information resolved_stream = ContentApi(auth).get_stream_by_uuid(item) except (InvalidLoginException, AuthenticationException) as ex: _LOGGER.error(ex) kodiutils.ok_dialog( message=kodiutils.localize(30702, error=str(ex))) kodiutils.end_of_directory() return except GeoblockedException: kodiutils.ok_dialog(heading=kodiutils.localize(30709), message=kodiutils.localize( 30710)) # This video is geo-blocked... return except UnavailableException: kodiutils.ok_dialog(heading=kodiutils.localize(30711), message=kodiutils.localize( 30712)) # The video is unavailable... return # Play this item kodiutils.play(resolved_stream)
def _resolve_stream(uuid): """ Resolve the stream for the requested item :type uuid: string """ try: # Check if we have credentials if not kodiutils.get_setting( 'username') or not kodiutils.get_setting('password'): confirm = kodiutils.yesno_dialog( message=kodiutils.localize(30701) ) # To watch a video, you need to enter your credentials. Do you want to enter them now? if confirm: kodiutils.open_settings() kodiutils.end_of_directory() return None # Fetch an auth token now try: auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path()) # Get stream information resolved_stream = ContentApi(auth).get_stream_by_uuid(uuid) return resolved_stream except (InvalidLoginException, AuthenticationException) as ex: _LOGGER.error(ex) kodiutils.ok_dialog( message=kodiutils.localize(30702, error=str(ex))) kodiutils.end_of_directory() return None except GeoblockedException: kodiutils.ok_dialog(heading=kodiutils.localize(30709), message=kodiutils.localize( 30710)) # This video is geo-blocked... return None except UnavailableException: kodiutils.ok_dialog(heading=kodiutils.localize(30711), message=kodiutils.localize( 30712)) # The video is unavailable... return None
def __init__(self): """ Initialise object """ self._auth = Auth(kodiutils.get_tokens_path())
def __init__(self, ): """ Initialise object """ auth = Auth(kodiutils.get_tokens_path()) self._api = Api(auth.get_tokens())
def __init__(self, *args, **kwargs): super(TestAuth, self).__init__(*args, **kwargs) self._auth = AuthApi(kodiutils.get_setting('username'), kodiutils.get_setting('password'), kodiutils.get_tokens_path())