def lookupProvider(handle: int, _options: dict): """Find provider from handle ID, authenticate to it, and set as active :param handle: Handle id from input :type handle: int :param _options: Options/parameters passed in with the call, unused :type _options: dict """ # retrieve the media provider mediaProvider = xbmcmediaimport.getProvider(handle) if not mediaProvider: log("cannot retrieve media provider", xbmc.LOGERROR) return # prepare the media provider settings if not mediaProvider.prepareSettings(): log("cannot prepare media provider settings", xbmc.LOGERROR) return providerFound = False try: providerFound = Server(mediaProvider).Authenticate() except: pass xbmcmediaimport.setProviderFound(handle, providerFound)
def lookup_provider(handle, _): # retrieve the media provider media_provider = xbmcmediaimport.getProvider(handle) if not media_provider: log("cannot retrieve media provider", xbmc.LOGERROR) return settings = media_provider.prepareSettings() if not settings: log("cannot prepare media provider settings", xbmc.LOGERROR) return # TODO(stub): check if the media provider is active xbmcmediaimport.setProviderFound(handle, True)
def lookupProvider(handle, options): # retrieve the media provider mediaProvider = xbmcmediaimport.getProvider(handle) if not mediaProvider: log('cannot retrieve media provider', xbmc.LOGERROR) return basePath = mediaProvider.getBasePath() providerFound = False try: if emby.api.server.Server.GetInfo(basePath): providerFound = True except: pass xbmcmediaimport.setProviderFound(handle, providerFound)
def lookupProvider(handle, options): # retrieve the media provider mediaProvider = xbmcmediaimport.getProvider(handle) if not mediaProvider: log('cannot retrieve media provider', xbmc.LOGERROR) return # prepare the media provider settings if not mediaProvider.prepareSettings(): log('cannot prepare media provider settings', xbmc.LOGERROR) return providerFound = False try: providerFound = Server(mediaProvider).Authenticate() except: pass xbmcmediaimport.setProviderFound(handle, providerFound)
def lookupProvider(handle, _): # retrieve the media provider mediaProvider = xbmcmediaimport.getProvider(handle) if not mediaProvider: log('cannot retrieve media provider', xbmc.LOGERROR) xbmcmediaimport.setProviderFound(handle, False) return settings = mediaProvider.prepareSettings() if not settings: log('cannot prepare media provider settings', xbmc.LOGERROR) xbmcmediaimport.setProviderFound(handle, False) return baseUrl = ProviderSettings.GetUrl(settings) providerFound = False try: if emby.api.server.Server.GetInfo(baseUrl): providerFound = True except: pass xbmcmediaimport.setProviderFound(handle, providerFound)