def isProviderReady(handle: int, _options: dict):
    """Validate that the provider from handle ID exists, can be connected to, and that stored authentication works

    :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

    # check if authentication works with the current provider settings
    providerReady = False
    try:
        providerReady = Server(mediaProvider).Authenticate()
    except:
        pass

    xbmcmediaimport.setProviderReady(handle, providerReady)
def isProviderReady(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

    # check if authentication works with the current provider settings
    try:
        providerReady = Server(mediaProvider).Authenticate(force=True)
    except:
        providerReady = False

    xbmcmediaimport.setProviderReady(handle, providerReady)
Exemple #3
0
def is_provider_ready(handle, _):
    # retrieve the media provider
    media_provider = xbmcmediaimport.getProvider(handle)
    if not media_provider:
        log("cannot retrieve media provider", xbmc.LOGERROR)
        xbmcmediaimport.setProviderReady(handle, False)
        return

    # prepare the media provider settings
    if not media_provider.prepareSettings():
        log("cannot prepare media provider settings", xbmc.LOGERROR)
        xbmcmediaimport.setProviderReady(handle, False)
        return

    # TODO(stub): check if the configuration of the media provider is valid / complete

    xbmcmediaimport.setProviderReady(handle, True)