def showUpdate(self): try: from resources.lib.about import cAbout cAbout().checkdownload() except: pass return
def parseUrl(self): oInputParameterHandler = cInputParameterHandler() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: cConfig().log('call load methode') sFunction = "load" if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return #if (isAboutGui(sSiteName, sFunction) == True): #return #try: exec "import " + sSiteName + " as plugin" exec "plugin." + sFunction + "()" #except: # cConfig().log('could not load site: ' + sSiteName ) else: if (cConfig().getSetting("home-view") == 'true'): oHome = cHome() cAbout() exec "oHome." + sFunction + "()" return oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oGuiElement = cGuiElement() oGuiElement.setTitle(aPlugin[0]) oGuiElement.setSiteName(aPlugin[1]) oGuiElement.setDescription(aPlugin[2]) oGuiElement.setFunction(sFunction) oGuiElement.setIcon("icon.png") oGui.addFolder(oGuiElement) oGui.setEndOfDirectory()
def parseUrl(self): self.oConfig.log('call parseUrl methode') oInputParameterHandler = cInputParameterHandler() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: sFunction = "load" if (sFunction =='DoNothing'): return if (not oInputParameterHandler.exist('site')): # mise a jour try: from resources.lib.about import cAbout cAbout().getUpdate() except Exception, e: self.oConfig.log('getUpdate ERROR: ' + e.message) #charge home #plugins = __import__('resources.lib.home', fromlist=['home']).cHome() #function = getattr(plugins, 'showSources') self.oConfig.log('In default.py call load') from resources.sites.server import load load() #server return
def parseUrl(self): oInputParameterHandler = cInputParameterHandler() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: cConfig().log('call load methode') sFunction = "load" if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return #if (isAboutGui(sSiteName, sFunction) == True): #return #try: exec "import " + sSiteName + " as plugin" exec "plugin."+ sFunction +"()" #except: # cConfig().log('could not load site: ' + sSiteName ) else: if (cConfig().getSetting("home-view") == 'true'): oHome = cHome() cAbout() exec "oHome."+ sFunction +"()" return oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oGuiElement = cGuiElement() oGuiElement.setTitle(aPlugin[0]) oGuiElement.setSiteName(aPlugin[1]) oGuiElement.setDescription(aPlugin[2]) oGuiElement.setFunction(sFunction) oGuiElement.setIcon("icon.png") oGui.addFolder(oGuiElement) oGui.setEndOfDirectory()
def showUpdate2(self): try: from resources.lib.about import cAbout link = 'link2' cAbout().checkdownload(link) except: pass return
def parseUrl(self): #xbmc.log('arg :' + str(sys.argv), xbmc.LOGNOTICE) #xbmc.log('Debug 1 >>' + str(xbmc.getInfoLabel('Container().CurrentPage')) , xbmc.LOGNOTICE) #xbmc.log('Debug 2 >>' + str(xbmc.getInfoLabel('Container.FolderPath')) , xbmc.LOGNOTICE) oInputParameterHandler = cInputParameterHandler() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: cConfig().log('call load methode') sFunction = "load" if (sFunction == 'DoNothing'): return if (not oInputParameterHandler.exist('site')): #mise a jour try: from resources.lib.about import cAbout cAbout().getUpdate() #exec "from resources.lib.about import cAbout as plugin" #exec "plugin.getUpdate()" except: pass #charge home plugins = __import__('resources.lib.home', fromlist=['home']).cHome() function = getattr(plugins, 'load') function() return if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isLibrary(sSiteName, sFunction) == True): return if (isDl(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return if (isTrakt(sSiteName, sFunction) == True): return if sSiteName == 'globalSearch': searchGlobal() return if sSiteName == 'globalSources': oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter( 'siteUrl', 'http://venom') icon = 'sites/%s.png' % (aPlugin[1]) oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler) oGui.setEndOfDirectory() return if sSiteName == 'globalParametre': cConfig().showSettingsWindow() return #if (isAboutGui(sSiteName, sFunction) == True): #return #charge sites try: #exec "from resources.sites import " + sSiteName + " as plugin" #exec "plugin."+ sFunction +"()" plugins = __import__('resources.sites.%s' % sSiteName, fromlist=[sSiteName]) function = getattr(plugins, sFunction) function() except Exception as e: cConfig().log('could not load site: ' + sSiteName + ' error: ' + str(e)) import traceback traceback.print_exc() return
def parseUrl(self): #print sys.argv #print 'Debug 1' oInputParameterHandler = cInputParameterHandler() #print 'Debug 2' if (oInputParameterHandler.exist('function')): #print 'Debug 3' sFunction = oInputParameterHandler.getValue('function') else: #print 'Debug 4' cConfig().log('call load methode') sFunction = "load" #print 'Debug 5' if (sFunction == 'DoNothing'): return if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isLibrary(sSiteName, sFunction) == True): return if (isDl(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return #if (isAboutGui(sSiteName, sFunction) == True): #return #try: exec "from resources.sites import " + sSiteName + " as plugin" exec "plugin." + sFunction + "()" #except: # cConfig().log('could not load site: ' + sSiteName ) else: if (cConfig().getSetting("home-view") == 'true'): oHome = cHome() cAbout() exec "oHome." + sFunction + "()" return oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: # oGuiElement = cGuiElement() # oGuiElement.setTitle(aPlugin[0]) # oGuiElement.setSiteName(aPlugin[1]) # oGuiElement.setDescription(aPlugin[2]) # oGuiElement.setFunction(sFunction) # oGuiElement.setIcon("icon.png") # oGui.addFolder(oGuiElement) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'test') oGui.addDir(aPlugin[1], sFunction, aPlugin[0], 'icon.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def parseUrl(self): #print sys.argv #print 'Debug 1' oInputParameterHandler = cInputParameterHandler() #print 'Debug 2' if (oInputParameterHandler.exist('function')): #print 'Debug 3' sFunction = oInputParameterHandler.getValue('function') else: #print 'Debug 4' cConfig().log('call load methode') sFunction = "load" #print 'Debug 5' if (sFunction == 'DoNothing'): return if (not oInputParameterHandler.exist('site')): #mise a jour try: from resources.lib.about import cAbout cAbout().getUpdate() #exec "from resources.lib.about import cAbout as plugin" #exec "plugin.getUpdate()" except: pass #charge home plugins = __import__('resources.lib.home', fromlist=['home']).cHome() function = getattr(plugins, 'load') function() return if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) #cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isLibrary(sSiteName, sFunction) == True): return if (isDl(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return if (isTrakt(sSiteName, sFunction) == True): return if sSiteName == 'globalSearch': searchGlobal() return if sSiteName == 'globalSources': oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter( 'siteUrl', 'http://venom') icon = 'sites/%s.png' % (aPlugin[1]) oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler) oGui.setEndOfDirectory() return if sSiteName == 'globalParametre': oGui = cGui() oGui.openSettings() oGui.updateDirectory() return #if (isAboutGui(sSiteName, sFunction) == True): #return #charge sites try: #exec "from resources.sites import " + sSiteName + " as plugin" #exec "plugin."+ sFunction +"()" plugins = __import__('resources.sites.%s' % sSiteName, fromlist=[sSiteName]) function = getattr(plugins, sFunction) function() except: cConfig().log('could not load site: ' + sSiteName) return
def parseUrl(self): #print sys.argv #print 'Debug 1' oInputParameterHandler = cInputParameterHandler() #print 'Debug 2' if (oInputParameterHandler.exist('function')): #print 'Debug 3' sFunction = oInputParameterHandler.getValue('function') else: #print 'Debug 4' cConfig().log('call load methode') sFunction = "load" #print 'Debug 5' if (sFunction=='DoNothing'): return if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isLibrary(sSiteName, sFunction) == True): return if (isDl(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return #if (isAboutGui(sSiteName, sFunction) == True): #return #try: exec "from resources.sites import " + sSiteName + " as plugin" exec "plugin."+ sFunction +"()" #except: # cConfig().log('could not load site: ' + sSiteName ) else: try: from resources.lib.about import cAbout cAbout().getUpdate() #exec "from resources.lib.about import cAbout as plugin" #exec "plugin.getUpdate()" except: pass if (cConfig().getSetting("home-view") == 'true'): oHome = cHome() exec "oHome."+ sFunction +"()" return oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: # oGuiElement = cGuiElement() # oGuiElement.setTitle(aPlugin[0]) # oGuiElement.setSiteName(aPlugin[1]) # oGuiElement.setDescription(aPlugin[2]) # oGuiElement.setFunction(sFunction) # oGuiElement.setIcon("icon.png") # oGui.addFolder(oGuiElement) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'test') oGui.addDir(aPlugin[1], sFunction, aPlugin[0], 'icon.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def main(self, env): if (env == 'urlresolver'): xbmcaddon.Addon('script.module.urlresolver').openSettings() return elif (env == 'metahandler'): xbmcaddon.Addon('script.module.metahandler').openSettings() return elif (env == 'changelog'): try: sUrl = 'https://raw.githubusercontent.com/Kodi-vStream/venom-xbmc-addons/master/plugin.video.vstream/changelog.txt' oRequest = urllib2.Request(sUrl) oResponse = urllib2.urlopen(oRequest) sContent = oResponse.read() from resources.lib.about import cAbout cAbout().TextBoxes('vStream Changelog', sContent) except: cConfig().error("%s,%s" % (cConfig().getlanguage(30205), sUrl)) return elif (env == 'soutient'): try: sUrl = 'https://raw.githubusercontent.com/Kodi-vStream/venom-xbmc-addons/master/plugin.video.vstream/soutient.txt' oRequest = urllib2.Request(sUrl) oResponse = urllib2.urlopen(oRequest) sContent = oResponse.read() from resources.lib.about import cAbout cAbout().TextBoxes('vStream Soutient', sContent) except: cConfig().error("%s,%s" % (cConfig().getlanguage(30205), sUrl)) return elif (env == 'addon'): dialog = xbmcgui.Dialog() if dialog.yesno('vStream', 'Êtes-vous sûr ?','','','Non', 'Oui'): cached_Cache = cConfig().getFileCache() cached_Cache = xbmc.translatePath(cached_Cache).decode("utf-8") self.ClearDir2(cached_Cache,True) xbmc.executebuiltin("XBMC.Notification(Clear Addon Cache,Successful,5000,"")") return elif (env == 'clean'): dialog = xbmcgui.Dialog() liste = ['Historiques', 'Lecture en cours', 'Marqués vues', 'Marque-Pages', 'Téléchargements'] ret = dialog.select('BDD à supprimer', liste) cached_DB = cConfig().getFileDB() sql_drop = "" if ret > -1: if ret == 0: sql_drop = "DROP TABLE history" elif ret == 1: sql_drop = "DROP TABLE resume" elif ret == 2: sql_drop = "DROP TABLE watched" elif ret == 3: sql_drop = "DROP TABLE favorite" elif ret == 4: sql_drop = "DROP TABLE download" try: db = sqlite.connect(cached_DB) dbcur = db.cursor() dbcur.execute(sql_drop) db.commit() dbcur.close() db.close() xbmc.executebuiltin("XBMC.Notification(Suppression BDD,Successful,5000,"")") except: xbmc.executebuiltin("XBMC.Notification(Suppresion BDD,Error,5000,"")") return elif (env == 'xbmc'): dialog = xbmcgui.Dialog() if dialog.yesno('vStream', 'Êtes-vous sûr ?','','','Non', 'Oui'): temp = xbmc.translatePath('special://temp/').decode("utf-8") self.ClearDir(temp,True) xbmc.executebuiltin("XBMC.Notification(Clear XBMC Cache,Successful,5000,"")") return elif (env == 'fi'): dialog = xbmcgui.Dialog() if dialog.yesno('vStream', 'Êtes-vous sûr ?','','','Non', 'Oui'): xbmc.executebuiltin("XBMC.Notification(Clear .fi Files ,Successful,2000,"")") path = xbmc.translatePath('special://temp/').decode("utf-8") filenames = next(os.walk(path))[2] for i in filenames: if ".fi" in i: os.remove(os.path.join(path, i)) return elif (env == 'uplog'): dialog = xbmcgui.Dialog() if dialog.yesno('vStream', 'Êtes-vous sûr ?','','','Non', 'Oui'): path = xbmc.translatePath('special://logpath/').decode("utf-8") UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0' headers = { 'User-Agent' : UA } filenames = next(os.walk(path))[2] for i in filenames: if 'kodi.log' in i: post_data = {} cUrl = 'http://slexy.org/index.php/submit' logop = open(path + i,'rb') result = logop.read() logop.close() post_data['raw_paste'] = result post_data['author'] = 'kodi.log' post_data['language'] = 'text' post_data['permissions'] = 1 #private post_data['expire'] = 259200 #3j post_data['submit'] = 'Submit+Paste' request = urllib2.Request(cUrl,urllib.urlencode(post_data),headers) reponse = urllib2.urlopen(request) code = reponse.geturl().replace('http://slexy.org/view/','') reponse.close() cConfig().createDialogOK('Ce code doit être transmis lorsque vous ouvrez une issue veuillez le noter:' + ' ' + code) return elif (env == 'search'): from resources.lib.handler.pluginHandler import cPluginHandler valid = '[COLOR green][x][/COLOR]' class XMLDialog(xbmcgui.WindowXMLDialog): def __init__(self, *args, **kwargs): xbmcgui.WindowXMLDialog.__init__( self ) pass def onInit(self): self.container = self.getControl(6) self.button = self.getControl(5) self.getControl(3).setVisible(False) self.getControl(1).setLabel(cConfig().getlanguage(30094)) self.button.setLabel('OK') listitems = [] oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getSearchPlugins() for aPlugin in aPlugins: #teste si deja dans le dsip sPluginSettingsName = 'plugin_' +aPlugin[1] bPlugin = cConfig().getSetting(sPluginSettingsName) icon = os.path.join(unicode(cConfig().getRootArt(), 'utf-8'), 'sites', aPlugin[1]+'.png') stitle = aPlugin[0].replace('[COLOR violet]','').replace('[COLOR orange]','').replace('[/COLOR]','') if (bPlugin == 'true'): stitle = ('%s %s') % (stitle, valid) listitem = xbmcgui.ListItem(label = stitle, label2 = aPlugin[2]) listitem.setArt({'icon' : icon, 'thumb' : icon}) listitem.setProperty('Addon.Summary', aPlugin[2]) listitem.setProperty('sitename', aPlugin[1]) if (bPlugin == 'true'): listitem.select(True) listitems.append(listitem) self.container.addItems(listitems) self.setFocus(self.container) def message(self, message): dialog = xbmcgui.Dialog() dialog.ok(" My message title", message) def onClick(self, controlId): if controlId == 5: self.close() return elif controlId == 99: window = xbmcgui.Window(xbmcgui.getCurrentWindowId()) del window self.close() return elif controlId == 7: window = xbmcgui.Window(xbmcgui.getCurrentWindowId()) del window self.close() return elif controlId == 6: item = self.container.getSelectedItem() if item.isSelected() == True: label = item.getLabel().replace(valid,'') item.setLabel(label) item.select(False) sPluginSettingsName = ('plugin_%s') % (item.getProperty('sitename')) cConfig().setSetting(sPluginSettingsName, str('false')) else : label = ('%s %s') % (item.getLabel(), valid) item.setLabel(label) item.select(True) sPluginSettingsName = ('plugin_%s') % (item.getProperty('sitename')) cConfig().setSetting(sPluginSettingsName, str('true')) return def onFocus(self, controlId): self.controlId = controlId def _close_dialog( self ): self.close() # def onAction( self, action ): # if action.getId() in ( 9, 10, 92, 216, 247, 257, 275, 61467, 61448, ): # self.close() wd = XMLDialog('DialogSelect.xml', cConfig().getAddonPath(), "Default") wd.doModal() del wd return elif (env == 'thumb'): dialog = xbmcgui.Dialog() if dialog.yesno('vStream', 'Êtes-vous sûr ? Ceci effacera toutes les thumbnails ','','','Non', 'Oui'): xbmc.executebuiltin("XBMC.Notification(Clear Thumbnails ,Successful,2000,"")") path = xbmc.translatePath('special://userdata/Thumbnails/').decode("utf-8") path2 = xbmc.translatePath('special://userdata/Database/').decode("utf-8") for i in os.listdir(path): folders = os.path.join(path, i).encode('utf-8') if os.path.isdir(folders): p = next(os.walk(folders))[2] for x in p: os.remove(os.path.join(folders, x).encode('utf-8')) filenames = next(os.walk(path2))[2] for x in filenames: if "exture" in x: con = sqlite.connect(os.path.join(path2, x).encode('utf-8')) cursor = con.cursor() cursor.execute("DELETE FROM texture") con.commit() cursor.close() con.close() return else: return return