def is_import_ready(handle, _): # retrieve the media import media_import = xbmcmediaimport.getImport(handle) if not media_import: log("cannot retrieve media import", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # prepare and get the media import settings import_settings = media_import.prepareSettings() if not import_settings: log("cannot prepare media import settings", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # retrieve the media provider media_provider = xbmcmediaimport.getProvider(handle) if not media_provider: log("cannot retrieve media provider", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # prepare the media provider settings if not media_provider.prepareSettings(): log("cannot prepare media provider settings", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # TODO(stub): check if the configuration of the media import is valid / complete xbmcmediaimport.setImportReady(handle, True)
def isImportReady(handle, options): # retrieve the media import mediaImport = xbmcmediaimport.getImport(handle) if not mediaImport: log('cannot retrieve media import', xbmc.LOGERROR) return # prepare and get the media import settings importSettings = mediaImport.prepareSettings() if not importSettings: log('cannot prepare media import settings', xbmc.LOGERROR) return # 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 try: embyServer = Server(mediaProvider) except: return # check if the chosen library views exist selectedViews = ImportSettings.GetLibraryViews(importSettings) matchingViews = getMatchingLibraryViews(embyServer, mediaImport.getMediaTypes(), selectedViews) xbmcmediaimport.setImportReady(handle, len(matchingViews) > 0)
def isImportReady(handle: int, _options: dict): """Validate that MediaImport at handle ID and associated provider are ready :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 import mediaImport = xbmcmediaimport.getImport(handle) if not mediaImport: log("cannot retrieve media import", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # prepare and get the media import settings importSettings = mediaImport.prepareSettings() if not importSettings: log("cannot prepare media import settings", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # retrieve the media provider mediaProvider = xbmcmediaimport.getProvider(handle) if not mediaProvider: log("cannot retrieve media provider", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return # prepare the media provider settings if not mediaProvider.prepareSettings(): log("cannot prepare media provider settings", xbmc.LOGERROR) xbmcmediaimport.setImportReady(handle, False) return try: server = Server(mediaProvider) except: pass importReady = False # check if authentication works with the current provider settings if server.Authenticate(): # check if the chosen library sections exist selectedLibrarySections = getLibrarySectionsFromSettings(importSettings) matchingLibrarySections = getMatchingLibrarySections( server.PlexServer(), mediaImport.getMediaTypes(), selectedLibrarySections ) importReady = len(matchingLibrarySections) > 0 xbmcmediaimport.setImportReady(handle, importReady)
def isImportReady(handle, options): # retrieve the media import mediaImport = xbmcmediaimport.getImport(handle) if not mediaImport: log('cannot retrieve media import', xbmc.LOGERROR) return # prepare and get the media import settings importSettings = mediaImport.prepareSettings() if not importSettings: log('cannot prepare media import settings', xbmc.LOGERROR) return # 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 embyServer = None try: embyServer = Server(mediaProvider) except: return importReady = False # check if authentication works with the current provider settings if embyServer.Authenticate(): # check if the chosen library views exist selectedViews = getLibraryViewsFromSettings(importSettings) matchingViews = getMatchingLibraryViews(embyServer, mediaImport.getMediaTypes(), selectedViews) importReady = len(matchingViews) > 0 xbmcmediaimport.setImportReady(handle, importReady)