def parseUrl(): params = ParameterHandler() # If no function is set, we set it to the default "load" function if params.exist('function'): sFunction = params.getValue('function') if sFunction == 'spacer': return True elif sFunction == 'clearCache': from resources.lib.handler.requestHandler import cRequestHandler cRequestHandler('dummy').clearCache() return elif sFunction == 'changeWatched': changeWatched(params) return elif sFunction == 'updateMeta': updateMeta(params) return elif sFunction == 'searchAlter': searchAlter(params) return else: sFunction = 'load' # Test if we should run a function on a special site if not params.exist('site'): xbmc.executebuiltin('XBMC.RunPlugin(%s?function=clearCache)' % sys.argv[0]) # As a default if no site was specified, we run the default starting gui with all plugins showMainMenu(sFunction) return sSiteName = params.getValue('site') logger.info (params.getAllParameters()) if params.exist('playMode'): from resources.lib.gui.hoster import cHosterGui url = False playMode = params.getValue('playMode') isHoster = params.getValue('isHoster') url = params.getValue('url') manual = params.exist('manual') if cConfig().getSetting('hosterSelect')=='auto' and playMode != 'jd' and playMode != 'pyload' and not manual: cHosterGui().streamAuto(playMode, sSiteName, sFunction) else: cHosterGui().stream(playMode, sSiteName, sFunction, url) return logger.info("Call function '%s' from '%s'" % (sFunction, sSiteName)) # If the hoster gui is called, run the function on it and return if sSiteName == 'cHosterGui': showHosterGui(sFunction) # If global search is called elif sSiteName == 'globalSearch': searchGlobal() elif sSiteName == 'favGui': showFavGui(sFunction) # If addon settings are called elif sSiteName == 'xStream': oGui = cGui() oGui.openSettings() oGui.updateDirectory() # If the urlresolver settings are called elif sSiteName == 'urlresolver': import urlresolver urlresolver.display_settings() # If metahandler settings are called elif sSiteName == 'metahandler': import metahandler metahandler.display_settings() else: # Else load any other site as plugin and run the function plugin = __import__(sSiteName, globals(), locals()) function = getattr(plugin, sFunction) function()
metaget = metahandlers.MetaData() metaget.change_watched(video_type, title, imdb_id, season=season, episode=episode) xbmc.executebuiltin("Container.Refresh") elif mode == 'resolver_settings': import urlresolver urlresolver.display_settings() elif mode == 'meta_settings': print "Metahandler Settings" import metahandler metahandler.display_settings() elif mode == 'delete_favs': dialog = xbmcgui.Dialog() ret = dialog.yesno( 'Delete Favourites', 'Do you wish to delete %s PFTV Favourites?' % video_type.upper(), '', 'This cannot be undone!') if ret == True: addon.log("Deleting favourites: %s" % video_type) if video_type == 'all': cache.delete('favourites_%s' % VideoType_Movies) cache.delete('favourites_%s' % VideoType_TV) cache.delete('favourites_%s' % VideoType_Season)
elif mode==500: #Browsing options menu BrowseListMenu(section) elif mode==1000: #Browse by A-Z menu BrowseAlphabetMenu(section) elif mode==2000: #Browse by genre BrowseByGenreMenu(section) elif mode==3000: #Show the results of the menus selected GetFilteredResults(section, genre, letter, sort, page) elif mode==4000: #TV Show season list TVShowSeasonList(url, title, year, update) elif mode==5000: #TVShow episode list TVShowEpisodeList(season, imdbnum) elif mode==6000: #Get search terms GetSearchQuery(section) elif mode==7000: #Get search results Search(section, query) elif mode==8000: #Browse Favorites BrowseFavorites(section) elif mode==8888: #Save to favorites SaveFav(section, title, url, img, year) elif mode==7777: #Delete favorite DeleteFav(section, title, url) xbmc.executebuiltin('Container.Refresh') elif mode==9988: #Metahandler Settings print "Metahandler Settings" import metahandler metahandler.display_settings() elif mode==9999: #Open URL Resolver Settings urlresolver.display_settings() elif mode==10000: #Install meta pack install_metapack(title)
def parseUrl(): params = ParameterHandler() # If no function is set, we set it to the default "load" function if params.exist('function'): sFunction = params.getValue('function') if sFunction == 'spacer': return True elif sFunction == 'clearCache': from resources.lib.handler.requestHandler import cRequestHandler cRequestHandler('dummy').clearCache() return elif sFunction == 'changeWatched': changeWatched(params) return elif sFunction == 'updateMeta': updateMeta(params) return else: sFunction = 'load' # Test if we should run a function on a special site if params.exist('site'): sSiteName = params.getValue('site') logger.info(params.getAllParameters()) if params.exist('playMode'): from resources.lib.gui.hoster import cHosterGui url = False playMode = params.getValue('playMode') isHoster = params.getValue('isHoster') if isHoster == 'true': url = params.getValue('url') if cConfig().getSetting( 'autoPlay' ) == 'true' and playMode != 'jd' and playMode != 'pyload': cHosterGui().streamAuto(playMode, sSiteName, sFunction) else: cHosterGui().stream(playMode, sSiteName, sFunction, url) return else: logger.info("Call function '%s' from '%s'" % (sFunction, sSiteName)) # If the hoster gui is called, run the function on it and return if sSiteName == 'cHosterGui': showHosterGui(sFunction) return # If global search is called elif sSiteName == 'globalSearch': searchGlobal() return elif sSiteName == 'favGui': showFavGui(sFunction) return # If addon settings are called elif sSiteName == 'xStream': oGui = cGui() oGui.openSettings() oGui.updateDirectory() return # If the urlresolver settings are called elif sSiteName == 'urlresolver': import urlresolver urlresolver.display_settings() return # If metahandler settings are called elif sSiteName == 'metahandler': import metahandler metahandler.display_settings() return else: # Else load any other site as plugin and run the function plugin = __import__(sSiteName, globals(), locals()) function = getattr(plugin, sFunction) function() else: xbmc.executebuiltin('XBMC.RunPlugin(%s?function=clearCache)' % sys.argv[0]) # As a default if no site was specified, we run the default starting gui with all plugins showMainMenu(sFunction)
def parseUrl(): import urlparse netloc = [urlparse.urlparse(sys.argv[0]).netloc, ''] #if xbmc.getInfoLabel('Container.PluginName') not in netloc: # sys.exit() # return params = ParameterHandler() logger.info(params.getAllParameters()) # If no function is set, we set it to the default "load" function if params.exist('function'): sFunction = params.getValue('function') if sFunction == 'spacer': return True elif sFunction == 'clearCache': from resources.lib.handler.requestHandler import cRequestHandler cRequestHandler('dummy').clearCache() return elif sFunction == 'changeWatched': changeWatched(params) return elif sFunction == 'updateMeta': updateMeta(params) return elif sFunction == 'searchAlter': searchAlter(params) return elif sFunction == 'updateXstream': from resources.lib import updateManager updateManager.xStreamUpdate() return elif sFunction == 'updateUrlResolver': from resources.lib import updateManager updateManager.urlResolverUpdate() return elif sFunction == 'updateAll': from resources.lib import updateManager updateManager.xStreamUpdate() updateManager.urlResolverUpdate() return elif params.exist('remoteplayurl'): try: import urlresolver remotePlayUrl = params.getValue('remoteplayurl') sLink = urlresolver.resolve(remotePlayUrl) if sLink: xbmc.executebuiltin("PlayMedia(" + sLink + ")") else: logger.info("Could not play remote url '%s'" % sLink) except urlresolver.resolver.ResolverError as e: logger.info('ResolverError: %s' % e) return else: sFunction = 'load' # Test if we should run a function on a special site if not params.exist('site'): xbmc.executebuiltin('XBMC.RunPlugin(%s?function=clearCache)' % sys.argv[0]) xStreamUpdate = True if cConfig().getSetting('githubUpdateXstream') == 'true' else False urlResolverUpdate = True if cConfig().getSetting('githubUpdateUrlResolver') == 'true' else False if xStreamUpdate and urlResolverUpdate: xbmc.executebuiltin('XBMC.RunPlugin(%s?function=updateAll)' % sys.argv[0]) elif xStreamUpdate: xbmc.executebuiltin('XBMC.RunPlugin(%s?function=updateXstream)' % sys.argv[0]) elif urlResolverUpdate: xbmc.executebuiltin('XBMC.RunPlugin(%s?function=updateUrlResolver)' % sys.argv[0]) # As a default if no site was specified, we run the default starting gui with all plugins showMainMenu(sFunction) return sSiteName = params.getValue('site') if params.exist('playMode'): from resources.lib.gui.hoster import cHosterGui url = False playMode = params.getValue('playMode') isHoster = params.getValue('isHoster') url = params.getValue('url') manual = params.exist('manual') if cConfig().getSetting( 'hosterSelect') == 'Auto' and playMode != 'jd' and playMode != 'jd2' and playMode != 'pyload' and not manual: cHosterGui().streamAuto(playMode, sSiteName, sFunction) else: cHosterGui().stream(playMode, sSiteName, sFunction, url) return logger.info("Call function '%s' from '%s'" % (sFunction, sSiteName)) # If the hoster gui is called, run the function on it and return if sSiteName == 'cHosterGui': showHosterGui(sFunction) # If global search is called elif sSiteName == 'globalSearch': searchterm = False if params.exist('searchterm'): searchterm = params.getValue('searchterm') searchGlobal(searchterm) elif sSiteName == 'favGui': showFavGui(sFunction) # If addon settings are called elif sSiteName == 'xStream': oGui = cGui() oGui.openSettings() oGui.updateDirectory() # If the urlresolver settings are called elif sSiteName == 'urlresolver': import urlresolver urlresolver.display_settings() # If metahandler settings are called elif sSiteName == 'metahandler': import metahandler metahandler.display_settings() elif sSiteName == 'settings': oGui = cGui() for folder in settingsGuiElements(): oGui.addFolder(folder) oGui.setEndOfDirectory() else: # Else load any other site as plugin and run the function plugin = __import__(sSiteName, globals(), locals()) function = getattr(plugin, sFunction) function()
def parseUrl(): oInputParameterHandler = ParameterHandler() # If no function is set, we set it to the default "load" function if oInputParameterHandler.exist("function"): sFunction = oInputParameterHandler.getValue("function") if sFunction == 'spacer': return True if sFunction == 'changeWatched': if cConfig().getSetting('metahandler')=='true': #videoType, name, imdbID, season=season, episode=episode, year=year, watched=watched try: from metahandler import metahandlers meta = metahandlers.MetaData() #print oInputParameterHandler.getAllParameters() params = oInputParameterHandler season = '' episode = '' mediaType = params.getValue('mediaType') imdbID = params.getValue('imdbID') name = params.getValue('title') if params.exist('season'): season = params.getValue('season') if params.exist('episode'): episode = params.getValue('episode') if imdbID: meta.change_watched(mediaType, name, imdbID, season=season, episode=episode) xbmc.executebuiltin("XBMC.Container.Refresh") except: META = False logger.info("Could not import package 'metahandler'") return if sFunction == 'updateMeta': if cConfig().getSetting('metahandler')=='true': #videoType, name, imdbID, season=season, episode=episode, year=year, watched=watched try: import resources.lib.handler.metaHandler as metahandlers #from metahandler import metahandlers except: logger.info("Could not import package 'metaHandler'") return meta = metahandlers.MetaData() params = oInputParameterHandler season = '' episode = '' mediaType = params.getValue('mediaType') imdbID = params.getValue('imdbID') name = str(params.getValue('title')) year = params.getValue('year') # show meta search input oGui = cGui() sSearchText = oGui.showKeyBoard(name) if (sSearchText != False and sSearchText != ''): if mediaType == 'movie': try: foundInfo = meta.search_movies(sSearchText) except: logger.info('error or nothing found') foundInfo = False elif mediaType == 'tvshow': foundInfo = metahandlers.TheTVDB().get_matching_shows(sSearchText) else: return else: return if not foundInfo: oGui.showInfo('xStream', 'Suchanfrage lieferte kein Ergebnis') return # select possible match dialog = xbmcgui.Dialog() items = [] for item in foundInfo: if mediaType == 'movie': items.append(str(item['title'].encode('utf-8'))+' ('+str(item['year'])+')') elif mediaType == 'tvshow': items.append(str(item[1])) else: return index = dialog.select('Film/Serie wählen', items) if index > -1: item = foundInfo[index] else: return False if not imdbID: imdbID = '' if not year: year = '' if mediaType == 'movie': meta.update_meta(mediaType, name, imdbID, new_imdb_id=str(item['imdb_id']), new_tmdb_id=str(item['tmdb_id']), year=year) elif mediaType == 'tvshow': meta.update_meta(mediaType, name, imdbID, new_imdb_id=str(item[2]), year=year) #print oInputParameterHandler.getAllParameters() #if params.exist('season'): # season = params.getValue('season') #if params.exist('episode'): # episode = params.getValue('episode') #meta.update_meta(mediaType, name, imdbID, season=season, episode=episode) xbmc.executebuiltin("XBMC.Container.Refresh") return else: sFunction = "load" # Test if we should run a function on a special site if oInputParameterHandler.exist('site'): sSiteName = oInputParameterHandler.getValue('site') logger.info (oInputParameterHandler.getAllParameters()) if oInputParameterHandler.exist('playMode'): playMode = oInputParameterHandler.getValue('playMode') if cConfig().getSetting('autoPlay')=='true' and playMode != 'jd': cHosterGui().streamAuto(playMode, sSiteName, sFunction) else: cHosterGui().stream(playMode, sSiteName, sFunction) return else: logger.info("Call function '%s' from '%s'" % (sFunction, sSiteName)) # If the hoster gui is called, run the function on it and return if sSiteName == 'cHosterGui': showHosterGui(sFunction) return # If global search is called if sSiteName == 'globalSearch': searchGlobal() return if sSiteName == 'favGui': showFavGui(sFunction) return # If addon settings are called if sSiteName == 'xStream': oGui = cGui() oGui.openSettings() oGui.updateDirectory() return # If the urlresolver settings are called if sSiteName == 'urlresolver': import urlresolver urlresolver.display_settings() return # If metahandler settings are called if sSiteName == 'metahandler': import metahandler metahandler.display_settings() return # Else load any other site as plugin and run the function plugin = __import__(sSiteName, globals(), locals()) function = getattr(plugin, sFunction) function() else: # As a default if no site was specified, we run the default starting gui with all plugins showMainMenu(sFunction)