def discoverProvider(handle: int, options: dict): """Prompt user for Plex authentication type, perform server discovery based on their choice, register the provider :param handle: Handle id from input :type handle: int :param options: Options/parameters passed in with the call :type options: dict """ dialog = xbmcgui.Dialog() authenticationChoices = [ localize(32013), # local only localize(32014) # MyPlex ] authenticationChoice = dialog.select(localize(32050), authenticationChoices) if authenticationChoice == 0: # local only provider = discoverProviderLocally(handle, options) elif authenticationChoice == 1: # MyPlex provider = discoverProviderWithMyPlex(handle, options) else: return if not provider: return xbmcmediaimport.setDiscoveredProvider(handle, True, provider)
def discover_provider(handle, options): # TODO(stub): help the user finding a media provider # feel free to use input dialogs etc. to guide the user in the process # TODO(stub): put together a xbmcmediaimport.MediaProvider provider = None # TODO(stub): xbmcmediaimport.MediaProvider(...) xbmcmediaimport.setDiscoveredProvider(handle, True, provider)
def discoverProvider(handle, options): dialog = xbmcgui.Dialog() authenticationChoices = [ localise(32013), # local only localise(32014) # MyPlex ] authenticationChoice = dialog.select(localise(32050), authenticationChoices) if authenticationChoice == 0: # local only provider = dicsoverProviderLocally(handle, options) elif authenticationChoice == 1: # MyPlex provider = dicsoverProviderWithMyPlex(handle, options) else: return if not provider: return xbmcmediaimport.setDiscoveredProvider(handle, True, provider)
def discoverProvider(handle, options): dialog = xbmcgui.Dialog() authenticationChoices = [ localise(32036), # local localise(32037) # Emby Connect ] authenticationChoice = dialog.select(localise(32053), authenticationChoices) if authenticationChoice == 0: # local provider = discoverProviderLocally(handle, options) elif authenticationChoice == 1: # Emby Connect provider = discoverProviderWithEmbyConnect(handle, options) else: return if not provider: return xbmcmediaimport.setDiscoveredProvider(handle, True, provider)
def discoverProvider(handle, options): baseUrl = xbmcgui.Dialog().input(localise(32050), 'http://') if not baseUrl: return log('trying to discover an Emby server at {}...'.format(baseUrl)) try: serverInfo = emby.api.server.Server.GetInfo(baseUrl) if not serverInfo: return except: return providerId = Server.BuildProviderId(serverInfo.id) providerIconUrl = Server.BuildIconUrl(baseUrl) mediaProvider = xbmcmediaimport.MediaProvider(providerId, baseUrl, serverInfo.name, providerIconUrl, emby.constants.SUPPORTED_MEDIA_TYPES) mediaProvider.setIconUrl(kodi.Api.downloadIcon(mediaProvider)) log('Emby server {} successfully discovered at {}'.format(mediaProvider2str(mediaProvider), baseUrl)) xbmcmediaimport.setDiscoveredProvider(handle, True, mediaProvider)