def load(): ADDON = addon() oGui = cGui() if ADDON.getSetting('token_alldebrid') == "": oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'getToken', '[COLOR red]Les utilisateurs d\'Alldebrid cliquez ici.\nPour les autres ceci n\'est pas necessaire car l\'ancienne methode est toujours fonctionnel.[/COLOR]', 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showSearch', 'Recherche', 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showMenuFilms', 'Films', 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showMenuSeries', 'Séries', 'series.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showMenuMangas', 'Animés', 'animes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showMenuAutre', 'Autres', 'tv.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def load(): addons = addon() if (addons.getSetting('hoster_onefichier_username') == '') and (addons.getSetting('hoster_onefichier_password') == ''): oGui = cGui() oGui.addText(SITE_IDENTIFIER, "[COLOR %s]%s[/COLOR]" % ("red", "Nécessite Un Compte 1Fichier Premium ou Gratuit")) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER,'opensetting', addons.VSlang(30023), 'none.png', oOutputParameterHandler) oGui.setEndOfDirectory() else: if (GestionCookie().Readcookie('onefichier') != ''): showFile(URL_FILE) else: oPremiumHandler = cPremiumHandler('onefichier') Connection = oPremiumHandler.Authentificate() if (Connection == False): oGui = cGui() oGui.addText(SITE_IDENTIFIER, "[COLOR %s]%s[/COLOR]" % ("red", "Connexion refusée")) oGui.setEndOfDirectory() else: showFile(URL_FILE)
def RecapchaBypass():#Ouverture de Chrome Launcher s'il est intallez ADDON = addon() oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sThumb = oInputParameterHandler.getValue('sThumb') Token_Alldebrid = ADDON.getSetting('token_alldebrid') if Token_Alldebrid == "": RecapchaBypassOld(sUrl) else: sUrl_Bypass = "******"+Token_Alldebrid+"&link="+sUrl oRequestHandler = cRequestHandler(sUrl_Bypass) sHtmlContent = oRequestHandler.request() oParser = cParser() sPattern1 = '"https([^"]+)"' aResult3 = oParser.parse(sHtmlContent, sPattern1) if (aResult3[0] == True): for aEntry in aResult3[1]: sHosterUrl = 'https'+str(aEntry) oHoster = cHosterGui().checkHoster(sHosterUrl) if (oHoster != False): oHoster.setDisplayName(sMovieTitle) oHoster.setFileName(sMovieTitle) cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumb) oGui.setEndOfDirectory()
def load(): oGui = cGui() addons = addon() oPremiumHandler = cPremiumHandler('uptobox') if (addons.getSetting('hoster_uptobox_username') == '') and (addons.getSetting('hoster_uptobox_password') == ''): oGui.addText(SITE_IDENTIFIER, '[COLOR red]' + 'Nécessite Un Compte Uptobox Premium ou Gratuit' + '[/COLOR]') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER,'opensetting', addons.VSlang(30023), 'none.png', oOutputParameterHandler) else: if (GestionCookie().Readcookie('uptobox') != ''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showFile', 'Mes Fichiers et Dossiers', 'genres.png', oOutputParameterHandler) else: Connection = oPremiumHandler.Authentificate() if (Connection == False): dialog().VSinfo('Connexion refusée') return oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom/') oGui.addDir(SITE_IDENTIFIER, 'showFile', 'Mes Fichiers et Dossiers', 'genres.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def __importPlugin(self, sName, sCat): pluginData = {} #oConfig = cConfig() addons = addon() sPluginSettingsName = 'plugin_' + sName bPlugin = addons.getSetting(sPluginSettingsName) #multicherche # if sLabel == 'search5': # bPlugin = 'true' if sCat == '1': sSearch = 'URL_SEARCH_MOVIES' elif sCat == '2': sSearch = 'URL_SEARCH_SERIES' elif sCat == '3': sSearch = 'URL_SEARCH_MISC' else : sSearch = 'URL_SEARCH' if (bPlugin == 'true'): try: plugin = __import__('resources.sites.%s' % sName, fromlist=[sName]) pluginData['identifier'] = plugin.SITE_IDENTIFIER pluginData['name'] = plugin.SITE_NAME pluginData['search'] = getattr(plugin, sSearch) return pluginData except Exception, e: #cConfig().log("cant import plugin: " + str(sName)) return False
def getAvailablePlugins(self,force = False): #oConfig = cConfig() addons = addon() #sFolder = self.getRootFolder() #sFolder = os.path.join(sFolder, 'resources/sites') sFolder = "special://home/addons/plugin.video.vstream/resources/sites" # xbox hack sFolder = sFolder.replace('\\', '/') #cConfig().log("Sites Folder " + sFolder) VSlog("Sites Folder " + sFolder) aFileNames = self.__getFileNamesFromFolder(sFolder) aPlugins = [] for sFileName in aFileNames: # wir versuchen das plugin zu importieren aPlugin = self.__importPlugin(sFileName) if (aPlugin[0] != False): sSiteName = aPlugin[0] sPluginSettingsName = aPlugin[1] sSiteDesc = aPlugin[2] # existieren zu diesem plugin die an/aus settings bPlugin = addons.getSetting(sPluginSettingsName) if (bPlugin != ''): # settings gefunden if (bPlugin == 'true') or (force == True): aPlugins.append(self.__createAvailablePluginsItem(sSiteName, sFileName, sSiteDesc)) else: # settings nicht gefunden, also schalten wir es trotzdem sichtbar aPlugins.append(self.__createAvailablePluginsItem(sSiteName, sFileName, sSiteDesc)) return aPlugins
def service(): ADDON = addon() intervalle = ADDON.getSetting('heure_verification') enregistrementIsActif = ADDON.getSetting('enregistrement_activer') if enregistrementIsActif == 'false': return PathProgrammation = "special://userdata/addon_data/plugin.video.vstream/Enregistrement" path = "".join([PathProgrammation]) if not xbmcvfs.exists(path): xbmcvfs.mkdir(path) ListeEnregistrement = xbmcvfs.listdir(path) ADDON.setSetting('path_enregistrement_programmation', path) EnregistrementEnCours = False monitor = xbmc.Monitor() while not monitor.abortRequested() and not EnregistrementEnCours == True: if monitor.waitForAbort(int(intervalle)): break heure = datetime.now().strftime('%d-%H-%M') + '.py' if heure in str(ListeEnregistrement): heure = path + '/' + heure heure = xbmc.translatePath(heure) EnregistrementEnCours = True VSlog('python ' + heure) command ='python ' + heure proc = subprocess.Popen(command, stdout=subprocess.PIPE) p_status = proc.wait()
def load(): oGui = cGui() addons = addon() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', URL_WEB) oGui.addDir(SITE_IDENTIFIER, 'showWeb', addons.VSlang(30332), 'tv.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', MOVIE_IPTVSITE) oGui.addDir(SITE_IDENTIFIER, 'showIptvSite', 'Iptv (Sites)', 'tv.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('radio', 'showGenres', addons.VSlang(30203) +' (Genres)', 'music.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', URL_RADIO) oGui.addDir('radio', 'showAZ', addons.VSlang(30203) +' (A-Z)', 'music.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', URL_RADIO) oGui.addDir('radio', 'showWeb', addons.VSlang(30203), 'music.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('lsdb', 'load', 'Liveset Database', 'music.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def setSetting(id, value): addons = addon() setting = addons.getSetting(id) # Si le parametre existe, on autorise la modification if (setting != '') : addons.setSetting(id, value) return True return False
def ouTMyTmdb(): addons = addon() addons.setSetting('tmdb_session', '') addons.setSetting('tmdb_account', '') dialog().VSinfo(addons.VSlang(30320)) VSupdate() showMyTmdb() return
def load(): oGui = cGui() addons = addon() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'showSearch', '%s (TMDB)' % addons.VSlang(30330), 'search.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'movie/popular') oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30425), 'comments.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'movie/now_playing') oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30426), 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'movie/top_rated') oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30427), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'genre/movie/list') oGui.addDir(SITE_IDENTIFIER, 'showGenreMovie', addons.VSlang(30428), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'tv/popular') oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30429), 'comments.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'tv/on_the_air') oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30430), 'series.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'tv/top_rated') oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30431), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'genre/tv/list') oGui.addDir(SITE_IDENTIFIER, 'showGenreTV', addons.VSlang(30432), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'person/popular') oGui.addDir(SITE_IDENTIFIER, 'showActors', addons.VSlang(30433), 'actor.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('topimdb', 'load', 'Top Imdb', 'star.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'showFolderList', 'Listes TMDB', 'listes.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def getUpdate(self): addons = addon() service_time = addons.getSetting('service_time') service_version = addons.getSetting('service_version') #service_version = "" #Si pas d'heure indique = premiere install if not (service_time): #On memorise la date d'aujourdhui addons.setSetting('service_time', str(datetime.datetime.now())) #Mais on force la maj avec une date a la con service_time = '2000-09-23 10:59:50.877000' if not (service_version): #version de l'addon addons.setSetting('service_version', str(addons.getAddonInfo("version"))) service_version = addons.getAddonInfo("version") #si addon = 0.7.0 et service_version 0.6.35 pas de mise ajour. if (addons.getAddonInfo("version") > service_version): addons.setSetting('service_version', str(addons.getAddonInfo("version"))) service_version = addons.getAddonInfo("version") if (service_time): #delay mise a jour time_sleep = datetime.timedelta(hours=72) time_now = datetime.datetime.now() time_service = self.__strptime(service_time, "%Y-%m-%d %H:%M:%S.%f") #pour test #if (time_sleep): if (time_now - time_service > time_sleep): #verifier la nouvelle version sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/releases/latest' oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() result = json.loads(sHtmlContent) #pour test #if (result['tag_name']): if (result['tag_name'] > service_version): addons.setSetting('service_futur', str(result['tag_name'])) addons.setSetting('home_update', str('true')) addons.setSetting('service_time', str(datetime.datetime.now())) dialog().VSinfo("Mise à jour disponible") else: addons.setSetting('service_time', str(datetime.datetime.now())) addons.setSetting('home_update', str('false')) VSlog('Prochaine verification de MAJ le : ' + str(time_sleep + time_service) ) return
def getUpdate_old(self): addons = addon() service_time = addons.getSetting('service_time') #Si pas d'heure indique = premiere install if not (service_time): #On memorise la date d'aujourdhui addons.setSetting('service_time', str(datetime.datetime.now())) #Mais on force la maj avec une date a la con service_time = '2000-09-23 10:59:50.877000' if (service_time): #delay mise a jour time_sleep = datetime.timedelta(hours=72) time_now = datetime.datetime.now() time_service = self.__strptime(service_time, "%Y-%m-%d %H:%M:%S.%f") #pour test #if (time_sleep): if (time_now - time_service > time_sleep): #test les fichier pour mise a jour #self.checkupdate() result = self.resultGit() sDown = 0 if result: for i in result: try: rootpath = self.getRootPath(i['path']) if self.checksize(rootpath,i['size']): sDown = sDown+1 break #Si on en trouve un, pas besoin de tester les autres. except: VSlog('erreur : verification MAJ' ) return if (sDown != 0): addons.setSetting('home_update', str('true')) addons.setSetting('service_time', str(datetime.datetime.now())) dialog().VSinfo("Mise à jour disponible") else: #cConfig().showInfo('vStream', 'Fichier a jour') addons.setSetting('service_time', str(datetime.datetime.now())) addons.setSetting('home_update', str('false')) else: VSlog('Prochaine verification de MAJ le : ' + str(time_sleep + time_service) ) #Pas besoin de memoriser la date, a cause du cache kodi > pas fiable. return
def load(): oGui = cGui() addons = addon() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'showGenres', addons.VSlang(30203) +' (Genres)', 'music.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'showAZ', addons.VSlang(30203) +' (A-Z)', 'music.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'showWeb', addons.VSlang(30203), 'music.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def getContext(): addons = addon() dialogs = dialog() tmdb_account = addons.getSetting('tmdb_account') if tmdb_account == "": dialogs.VSerror(addons.VSlang(30442)) return False, False, False disp = [] lang = [] fow = [] yn = [] disp.append('vote') fow.append('vote') yn.append(True) lang.append(addons.VSlang(30443)) disp.append('account/%s/watchlist' % tmdb_account) fow.append('watchlist') yn.append(True) lang.append(addons.VSlang(30444)) disp.append('account/%s/favorite' % tmdb_account) fow.append('favorite') yn.append(True) lang.append(addons.VSlang(30445)) disp.append('account/%s/watchlist' % tmdb_account) fow.append('watchlist') yn.append(False) lang.append(addons.VSlang(30446)) disp.append('account/%s/favorite' % tmdb_account) fow.append('favorite') yn.append(False) lang.append(addons.VSlang(30447)) ret = dialogs.select('TMDB',lang) if ret > -1: return disp[ret], fow[ret], yn[ret] return False
def getToken(): ADDON = addon() oGui = cGui() username = oGui.showKeyBoard(heading="Rentrer votre nom d'utilisateurs") password = oGui.showKeyBoard(heading="Rentrer votre mots de passe") oRequestHandler = cRequestHandler('https://api.alldebrid.com/user/login?agent=mySoft&username='******'&password='******'"token":"(.+?)"' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) VSlog(aResult) ADDON.setSetting('token_alldebrid', ''.join(aResult[1])) dialog().VSinfo('Token Ajouter', "Extreme-Download", 15) oGui.setEndOfDirectory()
def showSearch(): oGui = cGui() addons = addon() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'search/movie') oGui.addDir(SITE_IDENTIFIER, 'showSearchMovie', addons.VSlang(30423), 'search.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'search/tv') oGui.addDir(SITE_IDENTIFIER, 'showSearchSerie', addons.VSlang(30424), 'search.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'search/person') oGui.addDir(SITE_IDENTIFIER, 'showSearchActor', addons.VSlang(30450), 'search.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def programmation_enregistrement(self, sUrl): oGui = cGui() ADDON = addon() if 'firstonetv' in sUrl or 'bouygtel' in sUrl or 'heroku' in sUrl: sUrl = sUrl.replace('|Referer=','" -headers "Referer:').replace('&User-Agent=Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/48.0.2564.116+Chrome/48.0.2564.116+Safari/537.36&X-Requested-With=ShockwaveFlash/28.0.0.137&Origin=https://www.firstonetv.live','" -headers "User-Agent:Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/48.0.2564.116+Chrome/48.0.2564.116+Safari/537.36" -headers "X-Requested-With:ShockwaveFlash/28.0.0.137" -headers "Origin:https://www.firstonetv.live" -sn -c:v copy -c:a copy') header = '-fflags +genpts+igndts -y -i "' + sUrl elif '.m3u8' in sUrl: header = '-fflags +genpts+igndts -y -i "' + sUrl +'"' else: header = '-re -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 4294 -timeout 2000000000 -f mpegts -re -flags +global_header -fflags +genpts+igndts -y -i "' + sUrl +'" -headers "User-Agent: Mozilla/5.0+(X11;+Linux+i686)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Ubuntu+Chromium/48.0.2564.116+Chrome/48.0.2564.116+Safari/537.36" -sn -c:v libx264 -c:a copy -map 0 -segment_format mpegts -segment_time -1' pathEnregistrement = ADDON.getSetting('path_enregistrement_programmation') currentPath = ADDON.getSetting('path_enregistrement').replace('\\','/') ffmpeg = ADDON.getSetting('path_ffmpeg').replace('\\','/') heureFichier = oGui.showKeyBoard(heading="Heure du debut d'enregistrement au format Date-Heure-Minute") heureFin = oGui.showKeyBoard(heading="Heure du fin d'enregistrement au format Heure-Minute") titre = oGui.showKeyBoard(heading="Titre de l'enregistrement").replace("'","\\'") heureDebut = GetTimeObject(heureFichier,'%d-%H-%M') heureFin = GetTimeObject(heureFin,'%H-%M') durer = heureFin - heureDebut marge = ADDON.getSetting('marge_auto') timedelta = datetime.timedelta(minutes=int(marge)) durer = durer + timedelta realPath = xbmc.translatePath(pathEnregistrement + '/' + str(heureFichier) + '.py').replace('\\','\\\\') f = xbmcvfs.File(realPath,'w') read = f.write('''#-*- coding: utf-8 -*- import os,subprocess command = '"'''+ffmpeg+'''" '''+header+''' -t '''+str(durer)+''' "'''+currentPath+titre+'''.mkv"' proc = subprocess.Popen(command, stdout=subprocess.PIPE) p_status = proc.wait() f = open("'''+currentPath+'''/test.txt",'w') f.write('Finit avec code erreur ' + str(p_status)) f.close()''') f.close() oDialog = dialog().VSinfo('Redemarrer Kodi pour prendre en compte la planification','Vstream',10) oGui.setEndOfDirectory()
def GetURL_MAIN(): ADDON = addon() MemorisedHost = '' oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') Sources = oInputParameterHandler.getValue('function') # z = oInputParameterHandler.getAllParameter() # VSlog(z) # quand vstream load tous les sites on passe >> globalSources # quand vstream load a partir du menu home on passe >> callplugin # quand vstream fabrique une liste de plugin pour menu(load site globalRun and call function search) >> search # quand l'url ne contient pas celle déjà enregistrer dans settings et que c'est pas dlprotect on active. if not (Sources == 'callpluging' or Sources == 'globalSources' or Sources == 'search') and not ADDON.getSetting('ZT')[6:] in sUrl and not 'dl-protect1.com' in sUrl: oRequestHandler = cRequestHandler(URL_HOST) sHtmlContent = oRequestHandler.request() MemorisedHost = oRequestHandler.getRealUrl() if MemorisedHost is not None and MemorisedHost != '': ADDON.setSetting('ZT', MemorisedHost) VSlog("ZT url >> " + str(MemorisedHost) + ' sauvegarder >> ' + ADDON.getSetting('ZT')) else: VSlog("Url non changer car egal a None le site peux etre surchager utilisation de >> ADDON.getSetting('ZT')") return ADDON.getSetting('ZT') else: # si pas de zt dans settings on récup l'url une fois dans le site if not ADDON.getSetting('ZT') and not (Sources == 'callpluging' or Sources == 'globalSources' or Sources == 'search'): oRequestHandler = cRequestHandler(URL_HOST) sHtmlContent = oRequestHandler.request() MemorisedHost = oRequestHandler.getRealUrl() if MemorisedHost is not None and MemorisedHost != '': ADDON.setSetting('ZT', MemorisedHost) VSlog("ZT url vide >> " + str(MemorisedHost) + ' sauvegarder >> ' + ADDON.getSetting('ZT')) else: VSlog("Url non changer car egal a None le site peux etre surchager utilisation de >> ADDON.getSetting('ZT')") return ADDON.getSetting('ZT') else: VSlog("ZT pas besoin d'url") return ADDON.getSetting('ZT')
def getWatchlist(): grab = cTMDb() addons = addon() tmdb_session = addons.getSetting('tmdb_session') tmdb_account = addons.getSetting('tmdb_account') if not tmdb_session: return if not tmdb_account: return oInputParameterHandler = cInputParameterHandler() sCat = oInputParameterHandler.getValue('sCat') if not sCat: return #dans le doute si meta active sTMDB = oInputParameterHandler.getValue('sTmdbId') sSeason = oInputParameterHandler.getValue('sSeason') sEpisode = oInputParameterHandler.getValue('sEpisode') sCat = sCat.replace('1', 'movie').replace('2', 'tv') if not sTMDB: sTMDB = grab.get_idbyname(oInputParameterHandler.getValue('sFileName'), '', sCat) if not sTMDB: return sPost = {"media_type": sCat, "media_id": sTMDB, 'watchlist': True} sAction = 'account/%s/watchlist' % tmdb_account data = grab.getPostUrl(sAction, sPost) if len(data) > 0: dialog().VSinfo(data['status_message']) return
def SearchBA(self): url = "https://www.googleapis.com/youtube/v3/search?part=id,snippet&q=%s&maxResults=1&relevanceLanguage=fr&key=%s" % (self.search, self.key) req = urllib2.Request(url) try: gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1) response = urllib2.urlopen(req,context=gcontext) except: response = urllib2.urlopen(req) sHtmlContent = response.read() result = json.loads(sHtmlContent) response.close() try: ids = result['items'][0]['id']['videoId'] url = 'http://www.youtube.com/watch?v=%s' % ids from resources.hosters.youtube import cHoster hote = cHoster() hote.setUrl(url) api_call = hote.getMediaLink()[1] if not api_call: return oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(self.search.replace('+',' ')) oGuiElement.setMediaUrl(api_call) oGuiElement.setThumbnail(oGuiElement.getIcon()) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) oPlayer.startPlayer() except: dialog().VSinfo(addon().VSlang(30204)) return return
def getAvailablePlugins(self): #oConfig = cConfig() addons = addon() sText = self.getText() if not sText: return False sCat = self.getCat() if not sCat: return False #historique try: if (addons.getSetting("history-view") == 'true'): meta = {} meta['title'] = sText meta['disp'] = sCat cDb().insert_history(meta) except: pass #sFolder = self.getRootFolder() #sFolder = os.path.join(sFolder, 'resources/sites') sFolder = "special://home/addons/plugin.video.vstream/resources/sites" # xbox hack sFolder = sFolder.replace('\\', '/') VSlog("Sites Folder: " + sFolder) aFileNames = self.__getFileNamesFromFolder(sFolder) aPlugins = [] for sFileName in aFileNames: aPlugin = self.__importPlugin(sFileName, sCat) if aPlugin: aPlugins.append(aPlugin) return aPlugins
def UptomyAccount(): addons = addon() if (addons.getSetting('hoster_uptobox_username') == '') and (addons.getSetting('hoster_uptobox_password') == ''): return oInputParameterHandler = cInputParameterHandler() sMediaUrl = oInputParameterHandler.getValue('sMediaUrl') oPremiumHandler = cPremiumHandler('uptobox') sHtmlContent = oPremiumHandler.GetHtml(URL_MAIN) cookies = GestionCookie().Readcookie('uptobox') aResult = re.search('<form id="fileupload" action="([^"]+)"', sHtmlContent, re.DOTALL) if (aResult): upUrl = aResult.group(1).replace('upload?', 'remote?') if upUrl.startswith('//'): upUrl = 'https:' + upUrl fields = {'urls': '["' + sMediaUrl + '"]'} mpartdata = MPencode(fields) req = urllib2.Request(upUrl, mpartdata[1], headers) req.add_header('Content-Type', mpartdata[0].replace(',', ';')) req.add_header('Cookie', cookies) req.add_header('Content-Length', len(mpartdata[1])) # penible ce dialog auth xbmc.executebuiltin('Dialog.Close(all,true)') xbmcgui.Dialog().notification('Requête envoyée', 'vous pouvez faire autre chose', xbmcgui.NOTIFICATION_INFO, 4000, False) try: rep = urllib2.urlopen(req) except UrlError: return '' sHtmlContent = rep.read() rep.close() sPattern = '{"id":.+?,(?:"size":|"progress":)([0-9]+)' oParser = cParser() aResult = oParser.parse(sHtmlContent, sPattern) if (aResult[0] == True): total = aResult[1][0] del aResult[1][0] dialog = xbmcgui.DialogProgressBG() dialog.create(SITE_NAME, 'Transfert de fichiers sur votre compte Uptobox') for aEntry in aResult[1]: dialog.update( int(aEntry) * 100 / int(total), 'Upload en cours...') xbmc.sleep(500) dialog.close() else: # penible ce dialog auth xbmc.executebuiltin('Dialog.Close(all,true)') xbmcgui.Dialog().notification('Info upload', 'Fichier introuvable', xbmcgui.NOTIFICATION_INFO, 2000, False) else: # penible ce dialog auth xbmc.executebuiltin('Dialog.Close(all,true)') xbmcgui.Dialog().notification('Info upload', 'Erreur pattern', xbmcgui.NOTIFICATION_ERROR, 2000, False)
def showFilmActor(): oGui = cGui() grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') result = grab.getUrl(sUrl, iPage) total = len(result) if (total > 0): total = len(result['cast']) progress_ = progress().VScreate(SITE_NAME) for i in result['cast']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break # Mise en forme des infos (au format meta imdb) i = grab._format(i, '') sId, sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i['tmdb_id'], i['title'], i['genre'], i['cover_url'], i['backdrop_url'], i['plot'], i['year'] if not isMatrix(): sTitle = sTitle.encode("utf-8") oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://tmdb/%s' % sId) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sTmdbId', sId) oOutputParameterHandler.addParameter('type', 'film') if not isMatrix(): oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sTitle)) else: oOutputParameterHandler.addParameter('searchtext', sTitle) cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('films.png') oGuiElement.setMeta(1) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(1) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) # changement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showSeriesEpisode(): grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sSeason = oInputParameterHandler.getValue('sSeason') # sId = oInputParameterHandler.getValue('sId') if sSeason == False: sSeason = sUrl.split('/')[-1] if sFanart == False: sFanart = '' oGui = cGui() # recherche saison complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) # oOutputParameterHandler.addParameter('type', 'serie') search = '%s S%02d' % (sMovieTitle, int(sSeason)) # oOutputParameterHandler.addParameter('searchtext', search) if not isMatrix(): oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(search)) else: oOutputParameterHandler.addParameter('searchtext', search) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('searchMovie') oGuiElement.setTitle(addons.VSlang(30415)) oGuiElement.setCat(2) oGuiElement.setIcon("searchtmdb.png") oGui.addFolder(oGuiElement, oOutputParameterHandler) result = grab.getUrl(sUrl) total = len(result) if (total > 0 and 'episodes' in result): total = len(result['episodes']) progress_ = progress().VScreate(SITE_NAME) for i in result['episodes']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break # sId, sTitle, sOtitle, sThumb, sFanart = i['id'], i['name'], i['original_name'], i['poster_path'], i['backdrop_path'] sEpNumber = i['episode_number'] # Mise en forme des infos (au format meta imdb) i = grab._format(i, '') sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i['title'], i['genre'], i['cover_url'], i['backdrop_url'], i['plot'], i['year'] if not isMatrix(): sTitle = sTitle.encode("utf-8") sTitle = 'S%s E%s %s' % (sSeason, str(sEpNumber), sTitle) sExtraTitle = ' S' + "%02d" % int(sSeason) + 'E' + "%02d" % int(sEpNumber) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle + '|' + sExtraTitle) # Pour compatibilite Favoris oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) oOutputParameterHandler.addParameter('sSeason', sSeason) oOutputParameterHandler.addParameter('sEpisode', sEpNumber) oOutputParameterHandler.addParameter('type', 'serie') if not isMatrix(): oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sMovieTitle)) else: oOutputParameterHandler.addParameter('searchtext', sMovieTitle) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) # tchnagement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showSeries(sSearch=''): grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() iPage = 1 term = '' if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if (oInputParameterHandler.exist('sSearch')): sSearch = oInputParameterHandler.getValue('sSearch') if sSearch: result = grab.getUrl('search/tv', iPage, 'query=' + sSearch) sUrl = '' else: sUrl = oInputParameterHandler.getValue('siteUrl') if (oInputParameterHandler.exist('genre')): term = 'with_genres=' + oInputParameterHandler.getValue('genre') if (oInputParameterHandler.exist('session_id')): term += 'session_id=' + oInputParameterHandler.getValue('session_id') result = grab.getUrl(sUrl, iPage, term) oGui = cGui() try: total = len(result) if (total > 0): total = len(result['results']) progress_ = progress().VScreate(SITE_NAME) for i in result['results']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break # Mise en forme des infos (au format meta imdb) i = grab._format(i, '') sId, sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i['tmdb_id'], i['title'], i['genre'], i['cover_url'], i['backdrop_url'], i['plot'], i['year'] if not isMatrix(): sTitle = sTitle.encode("utf-8") sSiteUrl = 'tv/' + str(sId) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sSiteUrl) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sId) if isMatrix(): oOutputParameterHandler.addParameter('searchtext', sTitle) else: oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sTitle)) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName(SITE_IDENTIFIER) # a activer pour saisons oGuiElement.setFunction('showSeriesSaison') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) if (iPage > 0): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() if sSearch: oOutputParameterHandler.addParameter('sSearch', sSearch) oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) if (oInputParameterHandler.exist('genre')): oOutputParameterHandler.addParameter('genre', oInputParameterHandler.getValue('genre')) oGui.addNext(SITE_IDENTIFIER, 'showSeries', 'Page ' + str(iNextPage), oOutputParameterHandler) except TypeError: oGui.addText(SITE_IDENTIFIER, '[COLOR red]Aucun résultat n\'a été trouvé.[/COLOR]') # changement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
hour = path + '/' + hour hour = VSPath(hour) recordInProgress = True VSlog('python ' + hour) command = 'python ' + hour proc = subprocess.Popen(command, stdout=subprocess.PIPE) p_status = proc.wait() server_thread.join() if __name__ == '__main__': service() if isMatrix(): if addon().getSetting('plugin_toonanime') == "true" or addon().getSetting('plugin_kaydo_ws') == "true": class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): """Handle requests in a separate thread.""" def runServer(): from resources.lib.proxy.ProxyHTTPRequestHandler import ProxyHTTPRequestHandler server_address = ('127.0.0.1', 2424) httpd = ThreadingHTTPServer(server_address, ProxyHTTPRequestHandler) server_thread = threading.Thread(target=httpd.serve_forever) server_thread.start() VSlog("Server Start") monitor = xbmc.Monitor()
class cFav: DIALOG = dialog() ADDON = addon() #effacement direct par menu def delFavouritesMenu(self): cDb().del_favorite() return True #avec confirmation pour les autres def delFavourites(self): if self.DIALOG.VSyesno( "Voulez vous vraiment supprimer toute cette liste"): cDb().del_favorite() return True def getFavourites(self): oGui = cGui() #Comptages des favoris row = cDb().get_favorite() compt = [0, 0, 0, 0, 0, 0, 0, 0] for i in row: compt[int(i[5])] = compt[int(i[5])] + 1 # sTitle = '[COLOR khaki]Vous avez %s marque page[/COLOR]' % (len(row)) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'http://') # oGui.addText(SITE_IDENTIFIER, sTitle) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '1') oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30120), str(compt[1])), 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '2') oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s/%s (%s)') % (self.ADDON.VSlang(30121), self.ADDON.VSlang(30122), str(compt[2])), 'mark.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('sCat', '3') # oGui.addDir(SITE_IDENTIFIER, 'getFav()', 'Pages', 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '6') oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30332), str(compt[6])), 'mark.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('sCat', '7') # oGui.addDir(SITE_IDENTIFIER, 'getFav', 'Recherche Visuelle (' + str(compt[7]) + ')', 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() total = compt[3] + compt[4] + compt[5] oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30410), str(total)), 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sAll', 'true') oGui.addDir(SITE_IDENTIFIER, 'delFavourites', self.ADDON.VSlang(30209), 'trash.png', oOutputParameterHandler) #A virer dans les versions future, pour le moment c'est juste pr supprimer les liens bugges if compt[0] > 0: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '0') oGui.addDir( SITE_IDENTIFIER, 'getFav', '[COLOR red]Erreur /!\ lien a supprimer !!! (' + str(compt[0]) + ')[/COLOR]', 'mark.png', oOutputParameterHandler) oGui.setEndOfDirectory() def getFav(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() #aParams = oInputParameterHandler.getAllParameter() row = cDb().get_favorite() if (oInputParameterHandler.exist('sCat')): sCat = oInputParameterHandler.getValue('sCat') gen = (x for x in row if x[5] in sCat) else: sCat = '5' gen = (x for x in row if x[5] not in ('1', '2', '6')) for data in gen: try: title = data[1].encode('utf-8') except: title = data[1] try: thumbnail = data[6].encode('utf-8') except: thumbnail = data[6] try: siteurl = urllib.unquote_plus(data[2]) site = data[3] function = data[4] cat = data[5] fanart = data[7] if thumbnail == '': thumbnail = 'False' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteurl) oOutputParameterHandler.addParameter('sMovieTitle', title) oOutputParameterHandler.addParameter('searchtext', title) oOutputParameterHandler.addParameter('sThumbnail', thumbnail) #Dans ajouter source c'est bien sThumb donc... oOutputParameterHandler.addParameter('sThumb', thumbnail) if (function == 'play'): oHoster = cHosterGui().checkHoster(siteurl) oOutputParameterHandler.addParameter( 'sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter( 'sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sMediaUrl', siteurl) oGuiElement = cGuiElement() oGuiElement.setSiteName(site) oGuiElement.setFunction(function) oGuiElement.setTitle(title) oGuiElement.setFileName(title) oGuiElement.setIcon("mark.png") if (cat == '1'): cGui.CONTENT = 'movies' oGuiElement.setMeta(cat) oGuiElement.setCat(1) elif (cat == '2'): cGui.CONTENT = 'tvshows' oGuiElement.setMeta(cat) oGuiElement.setCat(2) else: oGuiElement.setMeta(0) oGuiElement.setCat(cat) oGuiElement.setThumbnail(thumbnail) oGuiElement.setFanart(fanart) #self.createContexMenuDelFav(oGuiElement, oOutputParameterHandler) oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'delFavouritesMenu', self.ADDON.VSlang(30412)) if (function == 'play'): oGui.addHost(oGuiElement, oOutputParameterHandler) else: oGui.addFolder(oGuiElement, oOutputParameterHandler) #oGui.addFav(site, function, title, "mark.png", thumbnail, fanart, oOutputParameterHandler) except: oGui.addDir(SITE_IDENTIFIER, 'DoNothing', '[COLOR red]ERROR[/COLOR]', 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', sCat) oGui.addDir(SITE_IDENTIFIER, 'delFavourites', self.ADDON.VSlang(30211), 'trash.png', oOutputParameterHandler) oGui.setEndOfDirectory() return def setFavorite(self): oInputParameterHandler = cInputParameterHandler() if oInputParameterHandler.getValue('sId') == 'kepliz_com': self.DIALOG.VSinfo('Error', 'Non possible pour ce site') return if int(oInputParameterHandler.getValue('sCat')) < 1: self.DIALOG.VSinfo('Error', 'Mise en Favoris non possible pour ce lien') return meta = {} meta['siteurl'] = oInputParameterHandler.getValue('siteUrl') meta['site'] = oInputParameterHandler.getValue('sId') meta['fav'] = oInputParameterHandler.getValue('sFav') meta['cat'] = oInputParameterHandler.getValue('sCat') #ListItem.title contient des code de couleurs, sMovieTitle le titre en plus "propre" #Inutile a la prochaine version, car plus de couleurs a la base. if oInputParameterHandler.getValue('sMovieTitle'): meta['title'] = oInputParameterHandler.getValue('sMovieTitle') else: meta['title'] = xbmc.getInfoLabel('ListItem.title') meta['icon'] = xbmc.getInfoLabel('ListItem.Art(thumb)') meta['fanart'] = xbmc.getInfoLabel('ListItem.Art(fanart)') try: cDb().insert_favorite(meta) except: pass
class cFav: DIALOG = dialog() ADDON = addon() # Suppression d'un bookmark, d'une catégorie, ou tous les bookmarks def delBookmark(self): oInputParameterHandler = cInputParameterHandler() if not self.DIALOG.VSyesno(self.ADDON.VSlang(30456)): return False sAll = oInputParameterHandler.exist('sAll') sCat = oInputParameterHandler.getValue('sCat') siteUrl = oInputParameterHandler.getValue('siteUrl') sTitle = oInputParameterHandler.getValue('sCleanTitle') # sTitle = cUtil().CleanName(sTitle) cDb().del_bookmark(siteUrl, sTitle, sCat, sAll) return True # Suppression d'un bookmark depuis un Widget def delBookmarkMenu(self): if not self.DIALOG.VSyesno(self.ADDON.VSlang(30456)): return False sTitle = xbmc.getInfoLabel('ListItem.Property(sCleanTitle)') siteUrl = xbmc.getInfoLabel('ListItem.Property(siteUrl)') cDb().del_bookmark(siteUrl, sTitle) return True def getBookmarks(self): oGui = cGui() # Comptages des marque-pages row = cDb().get_bookmark() compt = [0, 0, 0, 0, 0, 0, 0, 0] for i in row: compt[int(i[5])] = compt[int(i[5])] + 1 oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '1') oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30120), str(compt[1])), 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '2') oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s/%s (%s)') % (self.ADDON.VSlang(30121), self.ADDON.VSlang(30122), str(compt[2])), 'mark.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('sCat', '3') # oGui.addDir(SITE_IDENTIFIER, 'getFav()', 'Pages', 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '6') oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30332), str(compt[6])), 'mark.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('sCat', '7') # oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30088), str(compt[7])), 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() total = compt[3] + compt[4] + compt[5] oGui.addDir(SITE_IDENTIFIER, 'getFav', ('%s (%s)') % (self.ADDON.VSlang(30410), str(total)), 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sAll', 'true') oGui.addDir(SITE_IDENTIFIER, 'delBookmark', self.ADDON.VSlang(30209), 'trash.png', oOutputParameterHandler) # A virer dans les versions future, pour le moment c'est juste pr supprimer les liens bugges if compt[0] > 0: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', '0') oGui.addDir(SITE_IDENTIFIER, 'getFav', '[COLOR red]Erreur /!\ lien à supprimer!!! (' + str(compt[0]) + ')[/COLOR]', 'mark.png', oOutputParameterHandler) oGui.setEndOfDirectory() def getFav(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() row = cDb().get_bookmark() if (oInputParameterHandler.exist('sCat')): sCat = oInputParameterHandler.getValue('sCat') gen = (x for x in row if x[5] in sCat) else: sCat = '5' gen = (x for x in row if x[5] not in ('1', '2', '6')) for data in gen: try: title = data[1].encode('utf-8') except: title = data[1] try: thumbnail = data[6].encode('utf-8') except: thumbnail = data[6] try: try: siteurl = data[2].encode('utf-8') except: siteurl = data[2] if xbmc.getInfoLabel('system.buildversion')[0:2] >= '19': siteurl = UnquotePlus(siteurl.decode('utf-8')) title = str(title,'utf-8') else: siteurl = UnquotePlus(siteurl) site = data[3] function = data[4] cat = data[5] fanart = data[7] if thumbnail == '': thumbnail = 'False' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteurl) oOutputParameterHandler.addParameter('sMovieTitle', title) oOutputParameterHandler.addParameter('searchtext', title) oOutputParameterHandler.addParameter('sThumbnail', thumbnail) # Dans ajouter source c'est bien sThumb donc... oOutputParameterHandler.addParameter('sThumb', thumbnail) if (function == 'play'): oHoster = cHosterGui().checkHoster(siteurl) oOutputParameterHandler.addParameter('sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter('sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sMediaUrl', siteurl) oGuiElement = cGuiElement() oGuiElement.setSiteName(site) oGuiElement.setFunction(function) oGuiElement.setTitle(title) oGuiElement.setFileName(title) oGuiElement.setIcon("mark.png") if (cat == '1'): cGui.CONTENT = 'movies' oGuiElement.setMeta(cat) oGuiElement.setCat(1) elif (cat == '2'): cGui.CONTENT = 'tvshows' oGuiElement.setMeta(cat) oGuiElement.setCat(2) else: oGuiElement.setMeta(0) oGuiElement.setCat(cat) oGuiElement.setThumbnail(thumbnail) oGuiElement.setFanart(fanart) oGuiElement.addItemProperties('isBookmark', True) oGui.CreateSimpleMenu(oGuiElement,oOutputParameterHandler, 'cFav', 'cFav', 'delBookmark', self.ADDON.VSlang(30412)) if (function == 'play'): oGui.addHost(oGuiElement, oOutputParameterHandler) else: oGui.addFolder(oGuiElement, oOutputParameterHandler) except: oGui.addDir(SITE_IDENTIFIER, 'DoNothing', '[COLOR red]ERROR[/COLOR]', 'films.png', oOutputParameterHandler) # La suppression n'est pas accessible lors de l'utilisation en Widget if not xbmc.getCondVisibility('Window.IsActive(home)'): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sCat', sCat) oGui.addDir(SITE_IDENTIFIER, 'delBookmark', self.ADDON.VSlang(30211), 'trash.png', oOutputParameterHandler) oGui.setEndOfDirectory() return def setBookmark(self): oInputParameterHandler = cInputParameterHandler() sCat = oInputParameterHandler.getValue('sCat') if oInputParameterHandler.exist('sCat') else xbmc.getInfoLabel('ListItem.Property(sCat)') if int(sCat) not in (1, 2, 5): self.DIALOG.VSinfo('Error', self.ADDON.VSlang(30038)) return meta = {} sSiteUrl = oInputParameterHandler.getValue('siteUrl') if oInputParameterHandler.exist('siteUrl') else xbmc.getInfoLabel('ListItem.Property(siteUrl)') sTitle = oInputParameterHandler.getValue('sMovieTitle') if oInputParameterHandler.exist('sMovieTitle') else xbmc.getInfoLabel('ListItem.Property(sCleanTitle)') sSite = oInputParameterHandler.getValue('sId') if oInputParameterHandler.exist('sId') else xbmc.getInfoLabel('ListItem.Property(sId)') sFav = oInputParameterHandler.getValue('sFav') if oInputParameterHandler.exist('sFav') else xbmc.getInfoLabel('ListItem.Property(sFav)') meta['siteurl'] = sSiteUrl meta['title'] = sTitle meta['site'] = sSite meta['fav'] = sFav meta['cat'] = sCat meta['icon'] = xbmc.getInfoLabel('ListItem.Art(thumb)') meta['fanart'] = xbmc.getInfoLabel('ListItem.Art(fanart)') try: cDb().insert_bookmark(meta) except: pass
def searchGlobal(): cancel = False oGui = cGui() addons = addon() oInputParameterHandler = cInputParameterHandler() sSearchText = oInputParameterHandler.getValue('searchtext') sCat = oInputParameterHandler.getValue('sCat') oHandler = cRechercheHandler() oHandler.setText(sSearchText) oHandler.setCat(sCat) aPlugins = oHandler.getAvailablePlugins() if not aPlugins: return True total = len(aPlugins) #VSlog(str(aPlugins), xbmc.LOGNOTICE) progress_ = progress().VScreate() #kodi 17 vire la fenetre busy qui ce pose au dessus de la barre de Progress try: xbmc.executebuiltin("Dialog.Close(busydialog)") except: pass window(10101).setProperty('search', 'true') oGui.addText('globalSearch', addons.VSlang(30081) % (sSearchText), 'none.png') for count, plugin in enumerate(aPlugins): #text = '%s/%s - %s' % ((count+1), total, plugin['name']) progress_.VSupdatesearch(progress_, total, plugin['name']) if progress_.iscanceled(): cancel = True progress_.close() break #nom du site oGui.addText( plugin['identifier'], '%s. [COLOR olive]%s[/COLOR]' % ((count + 1), plugin['name']), 'sites/%s.png' % (plugin['identifier'])) #recherche import _pluginSearch(plugin, sSearchText) window(10101).setProperty('search', 'false') progress_.VSclose(progress_) #affichage total = len(oGui.searchResults) for count, result in enumerate(oGui.searchResults): text = '%s/%s - %s' % ( (count + 1 / total), total, result['guiElement'].getTitle()) #if(count == 0): # cConfig().updateDialogSearch(dialog, total, text,True) #else: # cConfig().updateDialogSearch(dialog, total, text) #progress_.VSupdatesearch(progress_, total, result['guiElement'].getTitle()) #result['params'].addParameter('VSTRMSEARCH','True') oGui.addFolder(result['guiElement'], result['params']) #VSlog('%s - %s' % (middle,old_label), xbmc.LOGNOTICE) # if progress_.iscanceled(): # if cancel == True: # continue # else: # break #progress_.VSclose(progress_) oGui.setEndOfDirectory() return True
def showLists(): grab = cTMDb() addons = addon() POSTER_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('poster_tmdb')) FANART_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('backdrop_tmdb')) oInputParameterHandler = cInputParameterHandler() iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') sUrl = oInputParameterHandler.getValue('siteUrl') result = grab.getUrl('list/' + sUrl, iPage, '') oGui = cGui() total = len(result) if (total > 0): total = len(result['items']) progress_ = progress().VScreate(SITE_NAME) for i in result['items']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sId, sType, sThumb, sFanart, sVote, sDesc = i['id'], i['media_type'], i['poster_path'], i['backdrop_path'], i['vote_average'], i['overview'] if sThumb: sThumb = POSTER_URL + sThumb else: sThumb = '' if sFanart: sFanart = FANART_URL + sFanart else : sFanart = '' sTitle = "None" if 'name' in i: sTitle = i['name'].encode("utf-8") if 'title' in i: sTitle = i['title'].encode("utf-8") sDisplayTitle = "%s (%s)" % (sTitle, sVote) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://tmdb/%s' % sId) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sId) #oOutputParameterHandler.addParameter('searchtext', sTitle) oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sTitle)) #oGui.addTVDB(SITE_IDENTIFIER, 'showSeriesSaison', sTitle, 'series.png', sThumb, sFanart, oOutputParameterHandler) cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sDisplayTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('series.png') if sType == 'movie': oGuiElement.setMeta(1) oGuiElement.setCat(1) elif sType == 'tv': oGuiElement.setMeta(2) oGuiElement.setCat(2) oGuiElement.setMetaAddon('true') #oGuiElement.setThumbnail(sThumb) #oGuiElement.setPoster(sThumb) #oGuiElement.setFanart(sFanart) oGuiElement.setDescription(sDesc) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showSeries(sSearch=''): grab = cTMDb() addons = addon() POSTER_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('poster_tmdb')) FANART_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('backdrop_tmdb')) oInputParameterHandler = cInputParameterHandler() iPage = 1 term = '' if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if (oInputParameterHandler.exist('sSearch')): sSearch = oInputParameterHandler.getValue('sSearch') if sSearch: result = grab.getUrl('search/tv', iPage, 'query=' + sSearch) sUrl = '' else: sUrl = oInputParameterHandler.getValue('siteUrl') if (oInputParameterHandler.exist('genre')): term = 'with_genres=' + oInputParameterHandler.getValue('genre') if (oInputParameterHandler.exist('session_id')): term += 'session_id=' + oInputParameterHandler.getValue('session_id') result = grab.getUrl(sUrl, iPage, term) oGui = cGui() total = len(result) if (total > 0): total = len(result['results']) progress_ = progress().VScreate(SITE_NAME) for i in result['results']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sId, sTitle, sOtitle, sThumb, sFanart, sDesc = i['id'], i['name'], i['original_name'], i['poster_path'], i['backdrop_path'], i['overview'] if sThumb: sThumb = POSTER_URL + sThumb else: sThumb = '' if sFanart: sFanart = FANART_URL + sFanart else : sFanart = '' sTitle = sTitle.encode("utf-8") sSiteUrl = 'tv/' + str(sId) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sSiteUrl) oOutputParameterHandler.addParameter('sMovieTitle', sTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sId) #oOutputParameterHandler.addParameter('searchtext', sTitle) oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sTitle)) #oGui.addTVDB(SITE_IDENTIFIER, 'showSeriesSaison', sTitle, 'series.png', sThumb, sFanart, oOutputParameterHandler) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sId) oGuiElement.setSiteName(SITE_IDENTIFIER) # a activer pour saisons #oGuiElement.setSiteName('globalSearch') # a desactiver pour saison oGuiElement.setFunction('showSeriesSaison') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setMetaAddon('true') #oGuiElement.setThumbnail(sThumb) #oGuiElement.setPoster(sThumb) #oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) #oGuiElement.setDescription(sDesc) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) if (iPage > 0): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() if sSearch: oOutputParameterHandler.addParameter('sSearch', sSearch) oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) if (oInputParameterHandler.exist('genre')): oOutputParameterHandler.addParameter('genre', oInputParameterHandler.getValue('genre')) oGui.addNext(SITE_IDENTIFIER, 'showSeries', '[COLOR teal]Page ' + str(iNextPage) + ' >>>[/COLOR]', oOutputParameterHandler) #chnagement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
#-*- coding: utf-8 -*- # https://github.com/Kodi-vStream/venom-xbmc-addons from resources.lib.gui.hoster import cHosterGui from resources.lib.gui.gui import cGui from resources.lib.handler.inputParameterHandler import cInputParameterHandler from resources.lib.handler.outputParameterHandler import cOutputParameterHandler from resources.lib.handler.requestHandler import cRequestHandler from resources.lib.parser import cParser from resources.lib.comaddon import progress, addon, VSlog import re sColor = addon().getSetting("deco_color") SITE_IDENTIFIER = 'tfarjo' SITE_NAME = 'Tfarjo' SITE_DESC = 'Films & Séries en streaming VO | VF | VOSTFR' #URL_MAIN = 'https://www5.tfarjo.ws/' #URL_MAIN = 'https://www.filmz.cc/' URL_MAIN = 'https://www.tfarjo.cc/' MOVIE_NEWS = (URL_MAIN + 'films', 'showMovies') MOVIE_MOVIE = (URL_MAIN + 'films', 'showMovies') MOVIE_GENRES = (URL_MAIN, 'showGenres') SERIE_NEWS = (URL_MAIN + 'series', 'showSeries') SERIE_SERIES = (URL_MAIN + 'series', 'showSeries') #SERIE_VFS = (URL_MAIN + 'series/vf', 'showSeries') #SERIE_VOSTFRS = (URL_MAIN + 'series/vostfr', 'showSeries') #pas fiable et pareil que dernier ajouts URL_SEARCH_MOVIES = ('', 'showMovies') URL_SEARCH_SERIES = ('', 'showMovies')
def showSeriesSaison(): oGui = cGui() grab = cTMDb() addons = addon() POSTER_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('poster_tmdb')) FANART_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('backdrop_tmdb')) oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sId = oInputParameterHandler.getValue('sId') if sId == False: sId = sUrl.split('/')[-1] if sFanart == False: sFanart = '' #recherche la serie complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) #oOutputParameterHandler.addParameter('type', 'serie') #oOutputParameterHandler.addParameter('searchtext', sMovieTitle) oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sMovieTitle)) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('searchMovie') oGuiElement.setTitle(addons.VSlang(30414)) oGuiElement.setCat(2) oGuiElement.setIcon("searchtmdb.png") oGui.addFolder(oGuiElement, oOutputParameterHandler) #oGui.addDir('cHome', 'showSearch', addons.VSlang(30414), 'searchtmdb.png', oOutputParameterHandler) #fin result = grab.getUrl(sUrl) total = len(result) if (total > 0): total = len(result['seasons']) progress_ = progress().VScreate(SITE_NAME) for i in result['seasons']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sdate, sNbreEp, sIdSeason, sThumb, SSeasonNum = i['air_date'], i['episode_count'], i['id'], i['poster_path'], i['season_number'] if sThumb: sThumb = POSTER_URL + sThumb else: sThumb = '' sTitle = 'Saison ' + str(SSeasonNum) + ' (' + str(sNbreEp) + ')' sUrl = 'tv/' + sId + '/season/' + str(SSeasonNum) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sSeason', SSeasonNum) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) #oGui.addTVDB(SITE_IDENTIFIER, 'showSeriesEpisode', sTitle, 'series.png', sThumb, sFanart, oOutputParameterHandler) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeriesEpisode') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setMetaAddon('true') #oGuiElement.setThumbnail(sThumb) #oGuiElement.setPoster(sThumb) #oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) #chnagement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showSeriesEpisode(): grab = cTMDb() addons = addon() POSTER_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('poster_tmdb')) FANART_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('backdrop_tmdb')) oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sSeason = oInputParameterHandler.getValue('sSeason') #sId = oInputParameterHandler.getValue('sId') if sSeason == False: sSeason = sUrl.split('/')[-1] if sFanart == False: sFanart = '' oGui = cGui() #recherche saison complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) #oOutputParameterHandler.addParameter('type', 'serie') search = '%s S%02d' % (sMovieTitle, int(sSeason)) #oOutputParameterHandler.addParameter('searchtext', search) oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(search)) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('searchMovie') oGuiElement.setTitle(addons.VSlang(30415)) oGuiElement.setCat(2) oGuiElement.setIcon("searchtmdb.png") oGui.addFolder(oGuiElement, oOutputParameterHandler) #oGui.addDir('cHome', 'showSearch', addons.VSlang(30415), 'searchtmdb.png', oOutputParameterHandler) #fin result = grab.getUrl(sUrl) total = len(result) dialog = progress() dialog.VScreate(SITE_NAME) if (total > 0): total = len(result['episodes']) progress_ = progress().VScreate(SITE_NAME) for i in result['episodes']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break #sId, sTitle, sOtitle, sThumb, sFanart = i['id'], i['name'], i['original_name'], i['poster_path'], i['backdrop_path'] sdate, sIdEp, sEpNumber, sName, sThumb, SResume = i['air_date'], i['id'], i['episode_number'], i['name'], i['still_path'], i['overview'] sName = sName.encode("utf-8") if sName == '': sName = sMovieTitle if sThumb: sThumb = POSTER_URL + sThumb else: sThumb = '' #sTitle = '[COLOR coral]S' + sSeason + 'E' + str(sEpNumber) + '[/COLOR] - ' + sName sTitle = 'S%s E%s %s' % (sSeason, str(sEpNumber) , sName) sExtraTitle = ' S' + "%02d" % int(sSeason) + 'E' + "%02d" % int(sEpNumber) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle + '|' + sExtraTitle) #Pour compatibilite Favoris oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) oOutputParameterHandler.addParameter('sSeason', sSeason) oOutputParameterHandler.addParameter('sEpisode', sEpNumber) oOutputParameterHandler.addParameter('type', 'serie') oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sMovieTitle)) #oGui.addTVDB('globalSearch', 'showHosters', sTitle, 'series.png', sThumb, sFanart, oOutputParameterHandler) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setMetaAddon('true') #oGuiElement.setThumbnail(sThumb) #oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) #tchnagement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def parseUrl(self): #import sys #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() oInputParameterHandler.getAllParameter() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: VSlog('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() plugins = __import__('resources.lib.about', fromlist=['about']).cAbout() function = getattr(plugins, 'getUpdate') function() 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') if (oInputParameterHandler.exist('title')): sTitle = oInputParameterHandler.getValue('title') else: sTitle = "none" VSlog('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName, sTitle) 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 == 'globalRun': __import__('resources.lib.runscript', fromlist=['runscript']) #function = getattr(plugins, sFunction) #function() return if sSiteName == 'globalSources': oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): addons = addon() addons.openSettings() xbmc.executebuiltin("Container.Refresh") 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': addons = addon() addons.openSettings() 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: VSlog('could not load site: ' + sSiteName + ' error: ' + str(e)) import traceback traceback.print_exc() return
class cPremiumHandler: ADDON = addon() DIALOG = dialog() def __init__(self, sHosterIdentifier): self.__sHosterIdentifier = sHosterIdentifier.lower() self.__sDisplayName = 'Premium mode' self.isLogin = False self.__LoginTry = False self.__ssl = False self.__Ispremium = False bIsPremium = self.ADDON.getSetting('hoster_' + str(self.__sHosterIdentifier) + '_premium') if (bIsPremium == 'true'): VSlog("Utilise compte premium pour hoster " + str(self.__sHosterIdentifier)) self.__Ispremium = True else: VSlog("Utilise compte gratuit pour hoster: " + str(self.__sHosterIdentifier)) def isPremiumModeAvailable(self): return self.__Ispremium def getUsername(self): sUsername = self.ADDON.getSetting('hoster_' + str(self.__sHosterIdentifier) + '_username') return sUsername def getPassword(self): sPassword = self.ADDON.getSetting('hoster_' + str(self.__sHosterIdentifier) + '_password') return sPassword def AddCookies(self): cookies = GestionCookie().Readcookie(self.__sHosterIdentifier) return 'Cookie=' + cookies def Checklogged(self, code): if 'uptobox' in self.__sHosterIdentifier: if '//uptobox.com/logout?' in code or 'Success' in code: return True if 'onefichier' in self.__sHosterIdentifier: if 'premium' in code or 'jqueryFileTree' in code or '1fichier.com/logout' in code: # test ok mais pas convaincu.... return True return False def CheckCookie(self): cookies = GestionCookie().Readcookie(self.__sHosterIdentifier) if cookies != '': return True return False def Authentificate(self): # un seul essais par session, pas besoin de bombarder le serveur if self.__LoginTry: return False self.__LoginTry = True if not self.__Ispremium: return False post_data = {} if 'uptobox' in self.__sHosterIdentifier: url = 'https://uptobox.com/login?referer=register' post_data['login'] = self.getUsername() post_data['password'] = self.getPassword() elif 'onefichier' in self.__sHosterIdentifier: url = 'https://1fichier.com/login.pl' post_data['mail'] = self.getUsername() post_data['pass'] = self.getPassword() post_data['lt'] = 'on' post_data['purge'] = 'on' post_data['valider'] = 'Send' elif 'uploaded' in self.__sHosterIdentifier: url = 'http://uploaded.net/io/login' post_data['id'] = self.getUsername() post_data['pw'] = self.getPassword() # si aucun de trouve on retourne else: return False oRequestHandler = cRequestHandler(url) oRequestHandler.setRequestType(1) if 'uptobox' in self.__sHosterIdentifier: oRequestHandler.disableRedirect() oRequestHandler.addHeaderEntry('User-Agent',UA) oRequestHandler.addHeaderEntry('Content-Type',"application/x-www-form-urlencoded") oRequestHandler.addHeaderEntry('Content-Length',str(len(post_data))) for data in post_data: oRequestHandler.addParameters(data, post_data[data]) sHtmlContent = oRequestHandler.request() head = oRequestHandler.getResponseHeader() if 'uptobox' in self.__sHosterIdentifier: if 'Set-Cookie' in head and 'xfss' in head['Set-Cookie']: self.isLogin = True else: self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName) return False elif 'onefichier' in self.__sHosterIdentifier: if 'You are logged in. This page will redirect you.' in sHtmlContent: self.isLogin = True else: self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName) return False elif 'uploaded' in self.__sHosterIdentifier: if sHtmlContent == '': self.isLogin = True else: self.DIALOG.VSinfo('Authentification rate', self.__sDisplayName) return False else: return False # get cookie cookies = '' if 'Set-Cookie' in head: oParser = cParser() sPattern = '(?:^|,) *([^;,]+?)=([^;,\/]+?);' aResult = oParser.parse(str(head['Set-Cookie']), sPattern) # print(aResult) if (aResult[0] == True): for cook in aResult[1]: if 'deleted' in cook[1]: continue cookies = cookies + cook[0] + '=' + cook[1] + ';' # save cookie GestionCookie().SaveCookie(self.__sHosterIdentifier, cookies) self.DIALOG.VSinfo('Authentification reussie', self.__sDisplayName) VSlog('Auhentification reussie') return True def GetHtmlwithcookies(self, url, data, cookies): oRequestHandler = cRequestHandler(url) oRequestHandler.addHeaderEntry('User-Agent',UA) if not (data == None): oRequestHandler.addParametersLine(data) oRequestHandler.addHeaderEntry('Referer', url) oRequestHandler.addHeaderEntry('Cookie', cookies) sHtmlContent = oRequestHandler.request() return sHtmlContent def GetHtml(self, url, data=None): cookies = GestionCookie().Readcookie(self.__sHosterIdentifier) # aucun ne marche sans cookies if (cookies == '') and not self.__LoginTry and self.__Ispremium: self.Authentificate() if not self.isLogin: return '' cookies = GestionCookie().Readcookie(self.__sHosterIdentifier) sHtmlContent = self.GetHtmlwithcookies(url, data, cookies) # Les cookies ne sont plus valables, mais on teste QUE si la personne n'a pas essaye de s'authentifier if not self.Checklogged(sHtmlContent) and not self.__LoginTry and self.__Ispremium: VSlog('Cookies non valables') self.Authentificate() if self.isLogin: cookies = GestionCookie().Readcookie(self.__sHosterIdentifier) sHtmlContent = self.GetHtmlwithcookies(url, data, cookies) else: return '' return sHtmlContent def setToken(self, sToken): self.ADDON.setSetting('hoster_' + str(self.__sHosterIdentifier) + '_token', sToken) def getToken(self): # pas de premium, pas de token if not self.__Ispremium: return None # le token est connu, on le retourne sToken = self.ADDON.getSetting('hoster_' + str(self.__sHosterIdentifier) + '_token') if sToken: return sToken # token alldebrid était connu avec un aute setting if 'alldebrid' in self.__sHosterIdentifier: sToken = self.ADDON.getSetting('token_alldebrid') # ancien nom, à supprimer après quelques temps if sToken: self.ADDON.setSetting('hoster_' + str(self.__sHosterIdentifier) + '_token', sToken) return sToken # Si pas de token pour uptobox, on le récupère depuis le compte if 'uptobox' in self.__sHosterIdentifier: if not self.isLogin: self.Authentificate() # on retrouve le token et on le sauvegarde if self.isLogin: sHtmlContent = self.GetHtml('https://uptobox.com/my_account') sPattern = 'Token:.+?<span class=\'none\'>(.+?)</span>' aResult = cParser().parse(sHtmlContent, sPattern, 1) if aResult[0]: sToken = aResult[1][0] self.ADDON.setSetting('hoster_' + str(self.__sHosterIdentifier) + '_token', sToken) return sToken return None
class cLibrary: ADDON = addon() DIALOG = dialog() def __init__(self): self.__sMovieFolder = self.ADDON.getSetting('Library_folder_Movies') self.__sTVFolder = self.ADDON.getSetting('Library_folder_TVs') if not self.__sMovieFolder: self.__sMovieFolder = 'special://userdata/addon_data/plugin.video.vstream/Films' self.ADDON.setSetting('Library_folder_Movies', self.__sMovieFolder) if not xbmcvfs.exists(self.__sMovieFolder): xbmcvfs.mkdir(self.__sMovieFolder) if not self.__sTVFolder: self.__sTVFolder = 'special://userdata/addon_data/plugin.video.vstream/Series' self.ADDON.setSetting('Library_folder_TVs', self.__sTVFolder) if not xbmcvfs.exists(self.__sTVFolder): xbmcvfs.mkdir(self.__sTVFolder) self.__sTitle = '' def setLibrary(self): oInputParameterHandler = cInputParameterHandler() sHosterIdentifier = oInputParameterHandler.getValue( 'sHosterIdentifier') sFileName = oInputParameterHandler.getValue('sFileName') sMediaUrl = oInputParameterHandler.getValue('sMediaUrl') ret = self.DIALOG.VSselect(['Film', 'Série'], 'Sélectionner une catégorie') if ret == 0: sCat = '1' elif ret == -1: return else: sCat = '2' sMediaUrl = QuotePlus(sMediaUrl) try: sFileName = str(sFileName.encode('latin-1'), 'utf-8') except: pass sFileNameEncode = QuotePlus(sFileName) sLink = 'plugin://plugin.video.vstream/?function=play&site=cHosterGui&sFileName=' + sFileNameEncode + '&sMediaUrl=' + sMediaUrl + '&sHosterIdentifier=' + sHosterIdentifier sTitle = sFileName if sCat == '1': # film #sTitle = cUtil().CleanName(sTitle) sFileName = self.showKeyBoard(sFileName, 'Nom du dossier et du fichier') try: sPath = '/'.join([self.__sMovieFolder, sFileName]) if not xbmcvfs.exists(sPath): xbmcvfs.mkdir(sPath) self.MakeFile(sPath, sTitle, sLink) except: self.DIALOG.VSinfo('Rajout impossible') elif sCat == '2': # serie #sFileName = cUtil().CleanName(sFileName) sFTitle = self.showKeyBoard(sFileName, 'Recommandé Nomdeserie/Saison00') try: sPath = '/'.join([self.__sTVFolder, sFileName]) if not xbmcvfs.exists(sPath): xbmcvfs.mkdir(sPath) sFileName = self.showKeyBoard(sFileName, 'Recommandé NomdeserieS00E00') self.MakeFile(sPath, sFileName, sLink) except: self.DIALOG.VSinfo('Rajout impossible') def MakeFile(self, folder, name, content): stream = '/'.join([folder, str(name)]) + '.strm' f = xbmcvfs.File(stream, 'w') result = f.write(str(content)) f.close() if result: self.DIALOG.VSinfo('Elément rajouté à la librairie') else: self.DIALOG.VSinfo('Rajout impossible') def getLibrary(self): xbmc.executebuiltin( 'Container.Update(special://userdata/addon_data/plugin.video.vstream/)', True) return True def Delfile(self): oInputParameterHandler = cInputParameterHandler() sFile = oInputParameterHandler.getValue('sFile') xbmcvfs.delete(sFile) runClean = self.DIALOG.VSyesno( 'Voulez vous mettre à jour la librairie maintenant (non conseillé)', 'Fichier supprimé') if not runClean: return xbmc.executebuiltin('CleanLibrary(video)') def ShowContent(self): oInputParameterHandler = cInputParameterHandler() sFolder = oInputParameterHandler.getValue('folder') xbmc.executebuiltin('Container.Update(' + sFolder + ')') def showKeyBoard(self, sDefaultText='', Heading=''): keyboard = xbmc.Keyboard(sDefaultText) keyboard.setHeading(Heading) # optional keyboard.doModal() if keyboard.isConfirmed(): sSearchText = keyboard.getText() if (len(sSearchText)) > 0: return sSearchText return False
class cPlayer(xbmc.Player): ADDON = addon() def __init__(self, *args): sPlayerType = self.__getPlayerType() xbmc.Player.__init__(self,sPlayerType) self.Subtitles_file = [] self.SubtitleActive = False oInputParameterHandler = cInputParameterHandler() self.sHosterIdentifier = oInputParameterHandler.getValue('sHosterIdentifier') self.sTitle = oInputParameterHandler.getValue('sFileName') if self.sTitle: self.sTitle = Unquote(self.sTitle) self.sCat = oInputParameterHandler.getValue('sCat') self.sSaison = oInputParameterHandler.getValue('sSeason') self.sSite = oInputParameterHandler.getValue('siteUrl') self.sSource = oInputParameterHandler.getValue('sourceName') self.sFav = oInputParameterHandler.getValue('sourceFav') self.saisonUrl = oInputParameterHandler.getValue('saisonUrl') self.nextSaisonFunc = oInputParameterHandler.getValue('nextSaisonFunc') self.movieUrl = oInputParameterHandler.getValue('movieUrl') self.movieFunc = oInputParameterHandler.getValue('movieFunc') self.sTmdbId = oInputParameterHandler.getValue('sTmdbId') self.playBackEventReceived = False self.playBackStoppedEventReceived = False self.forcestop = False self.multi = False # Plusieurs vidéos se sont enchainées VSlog('player initialized') def clearPlayList(self): oPlaylist = self.__getPlayList() oPlaylist.clear() def __getPlayList(self): return xbmc.PlayList(xbmc.PLAYLIST_VIDEO) def addItemToPlaylist(self, oGuiElement): oGui = cGui() oListItem = oGui.createListItem(oGuiElement) self.__addItemToPlaylist(oGuiElement, oListItem) def __addItemToPlaylist(self, oGuiElement, oListItem): oPlaylist = self.__getPlayList() oPlaylist.add(oGuiElement.getMediaUrl(), oListItem ) def AddSubtitles(self, files): if type(files) is list or type(files) is tuple: self.Subtitles_file = files else: self.Subtitles_file.append(files) def run(self, oGuiElement, sTitle, sUrl): # Lancement d'une vidéo sans avoir arreté la précedente self.tvShowTitle = oGuiElement.getItemValue('tvshowtitle') if self.isPlaying(): self.multi = True self._setWatched() # la vidéo en cours doit être marquée comme VUE self.totalTime = 0 self.currentTime = 0 sPluginHandle = cPluginHandler().getPluginHandle() oGui = cGui() item = oGui.createListItem(oGuiElement) item.setPath(oGuiElement.getMediaUrl()) #Sous titres if (self.Subtitles_file): try: item.setSubtitles(self.Subtitles_file) VSlog('Load SubTitle :' + str(self.Subtitles_file)) self.SubtitleActive = True except: VSlog("Can't load subtitle:" + str(self.Subtitles_file)) player_conf = self.ADDON.getSetting('playerPlay') #Si lien dash, methode prioritaire if splitext(urlparse(sUrl).path)[-1] in [".mpd",".m3u8"]: if isKrypton() == True: addonManager().enableAddon('inputstream.adaptive') item.setProperty('inputstream','inputstream.adaptive') if '.m3u8' in sUrl: item.setProperty('inputstream.adaptive.manifest_type', 'hls') else: item.setProperty('inputstream.adaptive.manifest_type', 'mpd') xbmcplugin.setResolvedUrl(sPluginHandle, True, listitem=item) VSlog('Player use inputstream addon') else: dialog().VSerror('Nécessite kodi 17 minimum') return #1 er mode de lecture elif (player_conf == '0'): self.play(sUrl,item) VSlog('Player use Play() method') #2 eme mode non utilise elif (player_conf == 'neverused'): xbmc.executebuiltin('PlayMedia(' + sUrl + ')') VSlog('Player use PlayMedia() method') #3 eme mode (defaut) else: xbmcplugin.setResolvedUrl(sPluginHandle, True, item) VSlog('Player use setResolvedUrl() method') #Attend que le lecteur demarre, avec un max de 20s for _ in range(20): if self.playBackEventReceived: break xbmc.sleep(1000) #active/desactive les sous titres suivant l'option choisie dans la config if self.getAvailableSubtitleStreams(): if (self.ADDON.getSetting('srt-view') == 'true'): self.showSubtitles(True) else: self.showSubtitles(False) dialog().VSinfo('Des sous-titres sont disponibles', 'Sous-Titres', 4) waitingNext = 0 while self.isPlaying() and not self.forcestop: try: self.currentTime = self.getTime() waitingNext += 1 if waitingNext == 8: # attendre un peu avant de chercher le prochain épisode d'une série self.totalTime = self.getTotalTime() self.infotag = self.getVideoInfoTag() UpNext().nextEpisode(oGuiElement) except Exception as err: VSlog("Exception run: {0}".format(err)) xbmc.sleep(1000) if not self.playBackStoppedEventReceived: self.onPlayBackStopped() #Uniquement avec la lecture avec play() if (player_conf == '0'): r = xbmcplugin.addDirectoryItem(handle=sPluginHandle, url=sUrl, listitem=item, isFolder=False) return r VSlog('Closing player') return True #fonction light servant par exemple pour visualiser les DL ou les chaines de TV def startPlayer(self, window=False): oPlayList = self.__getPlayList() self.play(oPlayList, windowed=window) def onPlayBackEnded(self): self.onPlayBackStopped() #Attention pas de stop, si on lance une seconde video sans fermer la premiere def onPlayBackStopped(self): VSlog('player stopped') # reçu deux fois, on n'en prend pas compte if self.playBackStoppedEventReceived: return self.playBackStoppedEventReceived = True self._setWatched() # MARQUER VU # utilise les informations de la vidéo qui vient d'etre lue # qui n'est pas celle qui a été lancée si plusieurs vidéos se sont enchainées def _setWatched(self): try: if self.isPlaying(): self.totalTime = self.getTotalTime() self.currentTime = self.getTime() self.infotag = self.getVideoInfoTag() if self.totalTime > 0: pourcent = float('%.2f' % (self.currentTime / self.totalTime)) saisonViewing = False #calcul le temp de lecture # Dans le cas ou ont a vu intégralement le contenu, percent = 0.0 # Mais on a tout de meme terminé donc le temps actuel est egal au temps total. if (pourcent > 0.90) or (pourcent == 0.0 and self.currentTime == self.totalTime): # Marquer VU dans la BDD Vstream sTitleWatched = self.infotag.getOriginalTitle() if sTitleWatched: db = cDb() meta = {} meta['title'] = sTitleWatched meta['cat'] = self.sCat db.insert_watched(meta) # RAZ du point de reprise db.del_resume(meta) # Sortie des LECTURE EN COURS pour les films, pour les séries la suppression est manuelle if self.sCat == '1': meta['titleWatched'] = sTitleWatched meta['cat'] = self.sCat db.del_viewing(meta) elif self.sCat == '8': # A la fin de la lecture d'un episode, on met la saison en "Lecture en cours" saisonViewing = True # Marquer VU dans les comptes perso # NE FONCTIONNE PAS SI PLUSIEURS VIDEOS SE SONT ENCHAINEES (cas des épisodes) if not self.multi: tmdb_session = self.ADDON.getSetting('tmdb_session') if tmdb_session: self.__getWatchlist('tmdb') bstoken = self.ADDON.getSetting('bstoken') if bstoken: self.__getWatchlist('trakt') # Sauvegarde du point de lecture pour une reprise elif self.currentTime > 180.0: sTitleWatched = self.infotag.getOriginalTitle() if sTitleWatched: db = cDb() meta = {} meta['title'] = sTitleWatched meta['site'] = self.sSite meta['point'] = self.currentTime meta['total'] = self.totalTime matchedrow = db.insert_resume(meta) # Lecture en cours meta['cat'] = self.sCat meta['site'] = self.sSource meta['sTmdbId'] = self.sTmdbId # Lecture d'un épisode, on sauvegarde la saison if self.sCat == '8': saisonViewing = True else: # Lecture d'un film # les 'divers' de moins de 45 minutes peuvent être de type 'adultes' # pas de sauvegarde en attendant mieux if self.sCat == '5' and self.totalTime < 2700: pass else: meta['title'] = self.sTitle meta['titleWatched'] = sTitleWatched if self.movieUrl and self.movieFunc: meta['siteurl'] = self.movieUrl meta['fav'] = self.movieFunc else: meta['siteurl'] = self.sSite meta['fav'] = self.sFav db.insert_viewing(meta) # Lecture d'un épisode, on met la saison "En cours de lecture" if saisonViewing: meta['cat'] = '4' # saison meta['sTmdbId'] = self.sTmdbId tvShowTitle = cUtil().titleWatched(self.tvShowTitle).replace(' ', '') if self.sSaison: meta['season'] = self.sSaison meta['title'] = self.tvShowTitle + " S" + self.sSaison meta['titleWatched'] = tvShowTitle + "_S" + self.sSaison else: meta['title'] = self.tvShowTitle meta['titleWatched'] = tvShowTitle meta['site'] = self.sSource meta['siteurl'] = self.saisonUrl meta['fav'] = self.nextSaisonFunc db.insert_viewing(meta) except Exception as err: VSlog("ERROR Player_setWatched : {0}".format(err)) #def onPlayBackStarted(self): def onAVStarted(self): VSlog('player started') #Si on recoit une nouvelle fois l'event, c'est que ca buggue, on stope tout if self.playBackEventReceived: self.forcestop = True return self.playBackEventReceived = True # Reprendre la lecture if self.isPlayingVideo() and self.getTime() < 180: # si supérieur à 3 minutes, la gestion de la reprise est assuré par KODI self.infotag = self.getVideoInfoTag() sTitleWatched = self.infotag.getOriginalTitle() if sTitleWatched: db = cDb() meta = {} meta['title'] = sTitleWatched resumePoint, total = db.get_resume(meta) if resumePoint: h = resumePoint//3600 ms = resumePoint-h*3600 m = ms//60 s = ms-m*60 ret = dialog().VSselect(['Reprendre depuis %02d:%02d:%02d' %(h, m, s), 'Lire depuis le début'], 'Reprendre la lecture') if ret == 0: self.seekTime(resumePoint) elif ret == 1: self.seekTime(0.0) # RAZ du point de reprise db.del_resume(meta) def __getWatchlist(self, sAction): if sAction == 'tmdb': plugins = __import__('resources.sites.themoviedb_org', fromlist=['themoviedb_org']) function = getattr(plugins, 'getWatchlist') function() elif sAction == 'trakt': plugins = __import__('resources.lib.trakt', fromlist=['trakt']).cTrakt() function = getattr(plugins, 'getAction') function(Action="SetWatched") return def __getPlayerType(self): sPlayerType = self.ADDON.getSetting('playerType') try: if (sPlayerType == '0'): VSlog('playertype from config: auto') return xbmc.PLAYER_CORE_AUTO if (sPlayerType == '1'): VSlog('playertype from config: mplayer') return xbmc.PLAYER_CORE_MPLAYER if (sPlayerType == '2'): VSlog('playertype from config: dvdplayer') return xbmc.PLAYER_CORE_DVDPLAYER except: return False
class cGuiElement: DEFAULT_FOLDER_ICON = 'icon.png' #COUNT = 0 ADDON = addon() DB = cDb() def __init__(self): #self.__sRootArt = cConfig().getRootArt() self.__sRootArt = 'special://home/addons/plugin.video.vstream/resources/art/' self.__sType = 'Video' self.__sMeta = 0 self.__sPlaycount = 0 self.__sTrailerUrl = '' self.__sMetaAddon = self.ADDON.getSetting('meta-view') self.__sImdb = '' self.__sTmdb = '' self.__sMediaUrl = '' self.__sSiteUrl = '' #contient le titre qui sera coloré self.__sTitle = '' #contient le titre propre self.__sCleanTitle = '' #titre considéré Vu self.__sTitleWatched = '' #contient le titre modifié pour BDD self.__sFileName = '' self.__sDescription = '' self.__sThumbnail = '' self.__sPoster = '' self.__Season = '' self.__Episode = '' self.__sIcon = self.DEFAULT_FOLDER_ICON self.__sFanart = "special://home/addons/plugin.video.vstream/fanart.jpg" self.__sDecoColor = self.ADDON.getSetting("deco_color") #For meta search #TmdbId the movie database https://developers.themoviedb.org/ self.__TmdbId = '' #ImdbId pas d'api http://www.imdb.com/ self.__ImdbId = '' self.__Year = '' self.__aItemValues = {} self.__aProperties = {} self.__aContextElements = [] self.__sSiteName = '' #categorie utiliser pour marque page et recherche. #1 - movies , 2 - tvshow, - 3 misc, #oGuiElement.setCat(1) self.__sCat = '' #cGuiElement.COUNT += 1 #def __len__(self): return self.__sCount # def getCount(self): # return cGuiElement.COUNT def setType(self, sType): self.__sType = sType def getType(self): return self.__sType #utiliser setImdbId def setImdb(self, sImdb): self.__ImdbId = sImdb #utiliser getImdbId def getImdb(self): return self.__ImdbId #utiliser setTmdbId def setTmdb(self, sTmdb): self.__TmdbId = sTmdb #utiliser getTmdbId def getTmdb(self): return self.__TmdbId def setCat(self, sCat): self.__sCat = sCat def getCat(self): return self.__sCat def setMetaAddon(self, sMetaAddon): self.__sMetaAddon = sMetaAddon def getMetaAddon(self): return self.__sMetaAddon def setTrailerUrl(self, sTrailerUrl): self.__sTrailerUrl = sTrailerUrl def getTrailerUrl(self): return self.__sTrailerUrl def setTmdbId(self, data): self.__TmdbId = data def getTmdbId(self): return self.__TmdbId def setImdbId(self, data): self.__ImdbId = data def getImdbId(self): return self.__ImdbId def setYear(self, data): self.__Year = data def setMeta(self, sMeta): self.__sMeta = sMeta def getMeta(self): return self.__sMeta def setMediaUrl(self, sMediaUrl): self.__sMediaUrl = sMediaUrl def getMediaUrl(self): return self.__sMediaUrl def setSiteUrl(self, sSiteUrl): self.__sSiteUrl = sSiteUrl def getSiteUrl(self): return self.__sSiteUrl def setSiteName(self, sSiteName): self.__sSiteName = sSiteName def getSiteName(self): return self.__sSiteName def setFileName(self, sFileName): self.__sFileName = self.str_conv(sFileName) def getFileName(self): return self.__sFileName def setFunction(self, sFunctionName): self.__sFunctionName = sFunctionName def getFunction(self): return self.__sFunctionName def TraiteTitre(self, sTitle): # Format Obligatoire a traiter via le fichier site #------------------------------------------------- # Episode 7 a 9 > Episode 7-9 # Saison 1 à ? > Saison 1-? # Format de date > 11/22/3333 ou 11-22-3333 #convertion unicode ne fonctionne pas avec les accents try: #traitement du titre pour les caracteres speciaux sTitle = sTitle.replace('ʹ', '\'').replace( '—', '-').replace('’', '\'').replace( '…', '...').replace('′', '\'').replace('‘', '\'') #traitement du titre pour retirer le - quand c'est une Saison. Tiret, tiret moyen et cadratin sTitle = sTitle.replace(' - Saison', ' Saison').replace( ' – Saison', ' Saison').replace(' — Saison', ' Saison') sTitle = sTitle.decode("utf-8") except: pass #recherche l'année, uniquement si entre caractere special a cause de 2001 odysse de l'espace ou k2000 string = re.search('([^\w ][0-9]{4}[^\w ])', sTitle) if string: sTitle = sTitle.replace(string.group(0), '') self.__Year = str(string.group(0)[1:5]) self.addItemValues('Year', self.__Year) #recherche une date string = re.search('([\d]{2}[\/|-]\d{2}[\/|-]\d{4})', sTitle) if string: sTitle = sTitle.replace(string.group(0), '') self.__Date = str(string.group(0)) sTitle = "%s (%s) " % (sTitle, self.__Date) #~ #recherche Lang #~ index = { ' vostfr' : ' [VOSTFR]', ' vf' : ' [VF]', ' truefrench' : ' [TrueFrench]' } #~ for cle in index: #~ sTitle=sTitle.replace(cle.upper(), index[cle]).replace(cle, index[cle]).replace('(%s)' % (cle), index[cle]) #~ #recherche Qualiter #~ index = { '1080i' : '(1080)', '1080p' : '(1080)', '1080I' : '(1080)', '1080P' : '(1080)', '720i' : '(720)', '720p' : '(720)', '720I' : '(720)', '720P' : '(720)' } #~ for cle in index: #~ sTitle=sTitle.replace(cle, index[cle]).replace('[%s]' % (cle), index[cle]) #Recherche saison et episode a faire pr serie uniquement if (True): #m = re.search( ur'(?i)(\wpisode ([0-9\.\-\_]+))',sTitle,re.UNICODE) m = re.search( ur'(?i)(?:^|[^a-z])((?:E|(?:\wpisode\s?))([0-9]+(?:[\-\.][0-9\?]+)*))', sTitle, re.UNICODE) if m: #ok y a des episodes sTitle = sTitle.replace(m.group(1), '') ep = m.group(2) if len(ep) == 1: ep = '0' + ep self.__Episode = ep self.addItemValues('Episode', self.__Episode) #pr les saisons m = re.search(ur'(?i)( s(?:aison +)*([0-9]+(?:\-[0-9\?]+)*))', sTitle, re.UNICODE) if m: sTitle = sTitle.replace(m.group(1), '') sa = m.group(2) if len(sa) == 1: sa = '0' + sa self.__Season = sa self.addItemValues('Season', self.__Season) else: #pas d'episode mais y a t il des saisons? m = re.search(ur'(?i)( s(?:aison +)*([0-9]+(?:\-[0-9\?]+)*))', sTitle, re.UNICODE) if m: sTitle = sTitle.replace(m.group(1), '') sa = m.group(2) if len(sa) == 1: sa = '0' + sa self.__Season = sa self.addItemValues('Season', self.__Season) #vire doubles espaces sTitle = re.sub(' +', ' ', sTitle) sTitle = sTitle.replace('()', '').replace('[]', '').replace('- -', '-') #vire espace a la fin et les - (attention, il y a 2 tirets differents meme si invisible a l'oeil nu et un est en unicode) sTitle = re.sub(ur'[- –]+$', '', sTitle) #et en debut if sTitle.startswith(' '): sTitle = sTitle[1:] #recherche les Tags restant : () ou [] sauf tag couleur sTitle = re.sub(ur'([\(|\[](?!\/*COLOR)[^\)\(\]\[]+?[\]|\)])', '[COLOR ' + self.__sDecoColor + ']\\1[/COLOR]', sTitle) #on reformate SXXEXX Titre [tag] (Annee) sTitle2 = '' if self.__Season: sTitle2 = sTitle2 + 'S' + self.__Season if self.__Episode: sTitle2 = sTitle2 + 'E' + self.__Episode #Titre unique pour pour marquer VU (avec numéro de l'épisode pour les séries) self.__sTitleWatched = self.str_conv(sTitle).replace(' ', '') if sTitle2: self.__sTitleWatched += '_' + sTitle2 if sTitle2: sTitle2 = "[COLOR %s]%s[/COLOR] " % (self.__sDecoColor, sTitle2) sTitle2 = sTitle2 + sTitle if self.__Year: sTitle2 = "%s [COLOR %s](%s)[/COLOR]" % ( sTitle2, self.__sDecoColor, self.__Year) #xbmc.log('>>' + sTitle2, xbmc.LOGNOTICE) #on repasse en utf-8 return sTitle2.encode('utf-8') def getEpisodeTitre(self, sTitle): string = re.search('(?i)(e(?:[a-z]+sode\s?)*([0-9]+))', str(sTitle)) if string: sTitle = sTitle.replace(string.group(1), '') self.__Episode = ("%02d" % int(string.group(2))) sTitle = "%s [COLOR %s]E%s[/COLOR]" % (sTitle, self.__sDecoColor, self.__Episode) self.addItemValues('Episode', self.__Episode) return sTitle, True return sTitle, False def setTitle(self, sTitle): self.__sCleanTitle = sTitle if not sTitle.startswith('[COLOR'): self.__sTitle = self.TraiteTitre(sTitle) else: self.__sTitle = sTitle def getTitle(self): return self.__sTitle def getCleanTitle(self): return self.__sCleanTitle # def setTitleWatched(self, sTitleWatched): # self.__sTitleWatched = sTitleWatched def getTitleWatched(self): return self.__sTitleWatched def setDescription(self, sDescription): self.__sDescription = sDescription def getDescription(self): return self.__sDescription def setThumbnail(self, sThumbnail): self.__sThumbnail = sThumbnail def getThumbnail(self): return self.__sThumbnail def setPoster(self, sPoster): self.__sPoster = sPoster def getPoster(self): return self.__sPoster def setFanart(self, sFanart): if (sFanart != ''): self.__sFanart = sFanart def setMovieFanart(self): self.__sFanart = self.__sFanart def setTvFanart(self): self.__sFanart = self.__sFanart def setDirectTvFanart(self): self.__sFanart = self.__sFanart def setDirFanart(self, sIcon): self.__sFanart = self.__sFanart def getFanart(self): return self.__sFanart def setIcon(self, sIcon): try: self.__sIcon = unicode(sIcon, 'utf-8') except: self.__sIcon = sIcon self.__sIcon = self.__sIcon.encode("utf-8") self.__sIcon = urllib.quote_plus(self.__sIcon, safe=':/') def getIcon(self): #if 'http' in self.__sIcon: # return urllib.unquote_plus(self.__sIcon) folder = "special://home/addons/plugin.video.vstream/resources/art" path = "/".join([folder, self.__sIcon]) #return os.path.join(unicode(self.__sRootArt, 'utf-8'), self.__sIcon) return path def addItemValues(self, sItemKey, mItemValue): self.__aItemValues[sItemKey] = mItemValue def getWatched(self): #Fonctionne pour marquer lus un dossier if not self.getTitleWatched(): return 0 meta = {} meta['title'] = self.getTitleWatched() meta['site'] = self.getSiteUrl() data = self.DB.get_watched(meta) return data def str_conv(self, data): if isinstance(data, str): # Must be encoded in UTF-8 data = data.decode('utf8') import unicodedata data = unicodedata.normalize('NFKD', data).encode('ascii', 'ignore') #cherche la saison et episode puis les balises [color]titre[/color] #data, saison = self.getSaisonTitre(data) #data, episode = self.getEpisodeTitre(data) #supprimer les balises data = re.sub(r'\[.*\]|\(.*\)', r'', str(data)) data = data.replace('VF', '').replace('VOSTFR', '').replace('FR', '') #data=re.sub(r'[0-9]+?', r'', str(data)) data = data.replace( '-', ' ' ) #on garde un espace pour que Orient-express ne devienne pas Orientexpress pour la recherche tmdb data = data.replace('Saison', '').replace('saison', '').replace( 'Season', '').replace('Episode', '').replace('episode', '') data = re.sub('[^%s]' % (string.ascii_lowercase + string.digits), ' ', data.lower()) #data = urllib.quote_plus(data) #data = data.decode('string-escape') return data def getInfoLabel(self): meta = { 'title': xbmc.getInfoLabel('ListItem.title'), #'label': xbmc.getInfoLabel('ListItem.title'), 'originaltitle': xbmc.getInfoLabel('ListItem.originaltitle'), 'year': xbmc.getInfoLabel('ListItem.year'), 'genre': xbmc.getInfoLabel('ListItem.genre'), 'director': xbmc.getInfoLabel('ListItem.director'), 'country': xbmc.getInfoLabel('ListItem.country'), 'rating': xbmc.getInfoLabel('ListItem.rating'), 'votes': xbmc.getInfoLabel('ListItem.votes'), 'mpaa': xbmc.getInfoLabel('ListItem.mpaa'), 'duration': xbmc.getInfoLabel('ListItem.duration'), 'trailer': xbmc.getInfoLabel('ListItem.trailer'), 'writer': xbmc.getInfoLabel('ListItem.writer'), 'studio': xbmc.getInfoLabel('ListItem.studio'), 'tagline': xbmc.getInfoLabel('ListItem.tagline'), 'plotoutline': xbmc.getInfoLabel('ListItem.plotoutline'), 'plot': xbmc.getInfoLabel('ListItem.plot'), 'cover_url': xbmc.getInfoLabel('ListItem.Art(thumb)'), 'backdrop_url': xbmc.getInfoLabel('ListItem.Art(fanart)'), 'imdb_id': xbmc.getInfoLabel('ListItem.IMDBNumber'), 'season': xbmc.getInfoLabel('ListItem.season'), 'episode': xbmc.getInfoLabel('ListItem.episode') } if 'title' in meta and meta['title']: meta['title'] = self.getTitle() for key, value in meta.items(): self.addItemValues(key, value) if 'backdrop_url' in meta and meta['backdrop_url']: self.addItemProperties('fanart_image', meta['backdrop_url']) self.__sFanart = meta['backdrop_url'] if 'trailer' in meta and meta['trailer']: meta['trailer'] = meta['trailer'].replace(u'\u200e', '').replace( u'\u200f', '') self.__sTrailerUrl = meta['trailer'] if 'cover_url' in meta and meta['cover_url']: self.__sThumbnail = meta['cover_url'] self.__sPoster = meta['cover_url'] return def getMetadonne(self): sTitle = self.__sFileName #sTitle = self.__sTitle.decode('latin-1').encode("utf-8") #sTitle = re.sub(r'\[.*\]|\(.*\)', r'', str(self.__sFileName)) #sTitle = sTitle.replace('VF', '').replace('VOSTFR', '').replace('FR', '') #get_meta(self, media_type, name, imdb_id='', tmdb_id='', year='', overlay=6, update=False): metaType = self.getMeta() # non media -> pas de fanart if metaType == 0: self.addItemProperties('fanart_image', '') return # Integrale de films, on nettoie le titre pour la recherche if metaType == 3: sTitle = sTitle.replace('integrale', '') sTitle = sTitle.replace('2 films', '') sTitle = sTitle.replace('6 films', '') sTitle = sTitle.replace('7 films', '') sTitle = sTitle.replace('trilogie', '') sTitle = sTitle.replace('trilogy', '') sTitle = sTitle.replace('quadrilogie', '') sTitle = sTitle.replace('pentalogie', '') sTitle = sTitle.replace('octalogie', '') sTitle = sTitle.replace('hexalogie', '') sTitle = sTitle.replace('tetralogie', '') sType = str(metaType).replace('1', 'movie').replace('2', 'tvshow').replace( '3', 'movie') if sType: from resources.lib.tmdb import cTMDb grab = cTMDb() args = (sType, sTitle) kwargs = {} if (self.__ImdbId): kwargs['imdb_id'] = self.__ImdbId if (self.__TmdbId): kwargs['tmdb_id'] = self.__TmdbId if (self.__Year): kwargs['year'] = self.__Year if (self.__Season): kwargs['season'] = self.__Season if (self.__Episode): kwargs['episode'] = self.__Episode meta = grab.get_meta(*args, **kwargs) else: return #Pour les films # if self.getMeta() == 1: # try: # from metahandler import metahandlers # grab = metahandlers.MetaData(preparezip=False, tmdb_api_key=cConfig().getSetting('api_tmdb')) # args = ("movie", self.__sFileName) # kwargs = {} # if (self.__TmdbId) or (self.__Year): # if (self.__ImdbId): # kwargs['imdb_id'] = self.__ImdbId # if (self.__TmdbId): # kwargs['tmdb_id'] = self.__TmdbId # if (self.__Year): # kwargs['year'] = self.__Year # meta = grab.get_meta(*args, **kwargs) # except: # return #Pour les series # elif self.getMeta() == 2: # try: # from metahandler import metahandlers # grab = metahandlers.MetaData(preparezip=False, tmdb_api_key=cConfig().getSetting('api_tmdb')) # Nom a nettoyer ? #attention l'annee peut mettre le bordel a cause des differences de sortie # args = ("tvshow", self.__sFileName) # kwargs = {} # if (self.__TmdbId) or (self.__Year): # dict = {} # if (self.__ImdbId): # kwargs['imdb_id'] = self.__ImdbId # if (self.__TmdbId): # kwargs['tmdb_id'] = self.__TmdbId # if (self.__Year): # kwargs['year'] = self.__Year # meta = grab.get_meta(*args, **kwargs) # except: # return # else: # return del meta['playcount'] del meta['trailer'] if meta['title']: meta['title'] = self.getTitle() for key, value in meta.items(): self.addItemValues(key, value) if meta['imdb_id']: self.__ImdbId = meta['imdb_id'] try: if meta['tmdb_id']: self.__TmdbId = meta['tmdb_id'] except: pass try: if meta['tvdb_id']: self.__TmdbId = meta['tvdb_id'] except: pass # Si fanart trouvé dans les meta alors on l'utilise, sinon on n'en met pas if meta['backdrop_url']: self.addItemProperties('fanart_image', meta['backdrop_url']) self.__sFanart = meta['backdrop_url'] else: self.addItemProperties('fanart_image', '') # if meta['trailer_url']: # meta['trailer'] = meta['trailer'].replace(u'\u200e', '').replace(u'\u200f', '') # self.__sTrailerUrl = meta['trailer'] # Pas de changement de cover pour les coffrets de films if metaType != 3: if 'cover_url' in meta and meta['cover_url']: self.__sThumbnail = meta['cover_url'] self.__sPoster = meta['cover_url'] return def getItemValues(self): self.__aItemValues['Title'] = self.getTitle() self.__aItemValues['Plot'] = self.getDescription() #tmdbid if self.getTmdbId(): self.addItemProperties('TmdbId', str(self.getTmdbId())) # - Video Values: # - genre : string (Comedy) # - year : integer (2009) # - episode : integer (4) # - season : integer (1) # - top250 : integer (192) # - tracknumber : integer (3) # - rating : float (6.4) - range is 0..10 # - watched : depreciated - use playcount instead # - playcount : integer (2) - number of times this item has been played # - overlay : integer (2) - range is 0..8. See GUIListItem.h for values # - cast : list (Michal C. Hall) # - castandrole : list (Michael C. Hall|Dexter) # - director : string (Dagur Kari) # - mpaa : string (PG-13) # - plot : string (Long Description) # - plotoutline : string (Short Description) # - title : string (Big Fan) # - originaltitle : string (Big Fan) # - sorttitle : string (Big Fan) # - duration : string (3:18) # - studio : string (Warner Bros.) # - tagline : string (An awesome movie) - short description of movie # - writer : string (Robert D. Siegel) # - tvshowtitle : string (Heroes) # - premiered : string (2005-03-04) # - status : string (Continuing) - status of a TVshow # - code : string (tt0110293) - IMDb code # - aired : string (2008-12-07) # - credits : string (Andy Kaufman) - writing credits # - lastplayed : string (Y-m-d h:m:s = 2009-04-05 23:16:04) # - album : string (The Joshua Tree) # - artist : list (['U2']) # - votes : string (12345 votes) # - trailer : string (/home/user/trailer.avi) # - dateadded : string (Y-m-d h:m:s = 2009-04-05 23:16:04) if self.getMetaAddon() == 'true': self.getMetadonne() #Used only if there is data in db, overwrite getMetadonne() w = self.getWatched() if w == 1: self.addItemValues('playcount', w) return self.__aItemValues def addItemProperties(self, sPropertyKey, mPropertyValue): self.__aProperties[sPropertyKey] = mPropertyValue def getItemProperties(self): return self.__aProperties def addContextItem(self, oContextElement): self.__aContextElements.append(oContextElement) def getContextItems(self): return self.__aContextElements
def checkdownload(self): addons = addon() dialogs = dialog() if dialogs.VSyesno("Êtes-vous sûr?"): service_futur = addons.getSetting('service_futur') service_version = addons.getSetting('service_version') if not service_futur: return self.getUpdate() if not service_version: return self.getUpdate() #result = self.resultGit() sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/compare/%s...%s' % ( service_version, service_futur) #pour test #sUrl = 'https://api.github.com/repos/Kodi-vStream/venom-xbmc-addons/compare/0.6.3...0.6.31' oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() result = json.loads(sHtmlContent) progress_ = progress() progress_.VScreate('Update') addons = addon() #site = '' sdown = 0 add = 0 dell = 0 schange = 0 text = '' listitems = [] if result: #boucle download fichier total = len(result['files']) for i in result['files']: if 'plugin.video.vstream' in i['filename']: progress_.VSupdate(progress_, total) rootpath = self.getRootPath(i['filename']) try: self.__download(i['raw_url'], rootpath) #site += "Add: [B]%s[/B] | Del: [B]%s[/B] | [COLOR green]%s[/COLOR][CR]" % (i['additions'], i['deletions'], i['filename'].encode("utf-8")) add += i['additions'] dell += i['deletions'] sdown = sdown + 1 schange += i['changes'] except: #site += "[COLOR red]"+i['filename'].encode("utf-8")+"[/COLOR][CR]" sdown = sdown + 1 pass progress_.VSclose(progress_) #donner fichier sContent = "Ajouter (%s) | Supprimer (%s) | Changement (%s) [CR]Fichiers mise à jour %s / %s" % ( add, dell, schange, sdown, total) listitem = xbmcgui.ListItem(label="vStream", label2=sContent) icon = "special://home/addons/plugin.video.vstream/resources/art/update.png" listitem.setArt({'icon': icon, 'thumb': icon}) listitems.append(listitem) #boucle commit for i in result['commits']: try: #text += "[B]%s[/B]: %s[CR]" % (i['commit']['author']['name'], i['commit']['message'].encode("utf-8")) icon = i['author']['avatar_url'] login = i['author']['login'] desc = i['commit']['message'].encode("utf-8") listitem = xbmcgui.ListItem(label=login, label2=desc) listitem.setArt({'icon': icon, 'thumb': icon}) except: #text += "[B]%s[/B]: nop[CR]" % (i['commit']['author']['name']) listitem = xbmcgui.ListItem(label='None', label2='none') pass listitems.append(listitem) #sContent = "Changement (%s) | Fichiers mise à jour %s / %s [CR]" % (schange, sdown, total) #sContent += "%s" % (text.encode("utf-8")) #sContent += "%s" % (site) addons.setSetting('service_time', str(datetime.datetime.now())) addons.setSetting('service_version', str(service_futur)) addons.setSetting('home_update', str('false')) #fin = dialog().VSok(sContent) #fin = self.TextBoxes(sContent) fin = self.Box(listitems) return
class cHome: addons = addon() def load(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() if (self.addons.getSetting('home_update') == 'true'): oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showUpdate', '%s (%s)' % (self.addons.VSlang(30418), self.addons.getSetting('service_futur')), 'update.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showSearchText', self.addons.VSlang(30076), 'search.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('themoviedb_org', 'load', self.addons.VSlang(30088), 'searchtmdb.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('cFav', 'getBookmarks', self.addons.VSlang(30207), 'mark.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showMovies', self.addons.VSlang(30120), 'films.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showSeries', self.addons.VSlang(30121), 'series.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showAnimes', self.addons.VSlang(30122), 'animes.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showDramas', self.addons.VSlang(30124), 'dramas.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showDocs', self.addons.VSlang(30112), 'doc.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showSports', self.addons.VSlang(30113), 'sport.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showNets', self.addons.VSlang(30114), 'buzz.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('freebox', 'load', self.addons.VSlang(30115), 'tv.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showReplay', self.addons.VSlang(30117), 'replay.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showUsers', self.addons.VSlang(30455), 'user.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'ShowTools', self.addons.VSlang(30033), 'download.png', oOutputParameterHandler) if (self.addons.getSetting('history-view') == 'true'): oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('cHome', 'showHistory', self.addons.VSlang(30308), 'annees.png', oOutputParameterHandler) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('globalSources', 'globalSources', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) view = False if (self.addons.getSetting('active-view') == 'true'): view = self.addons.getSetting('accueil-view') oGui.setEndOfDirectory(view) def showUpdate(self): try: from resources.lib.about import cAbout cAbout().checkdownload() except: pass return def showSearchText(self): oGui = cGui() sSearchText = oGui.showKeyBoard(heading=self.addons.VSlang(30076)) if sSearchText: self.showSearch(sSearchText) oGui.setEndOfDirectory() else: return False def showSearch(self, searchtext=cInputParameterHandler().getValue('searchtext')): if not searchtext: return self.showSearchText() window(10101).clearProperty('search_text') oGui = cGui() oGui.addText('globalSearch', self.addons.VSlang(30077) % searchtext, 'none.png') # utilisation de guielement pour ajouter la bonne catégorie # Recherche globale films oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oOutputParameterHandler.addParameter('searchtext', searchtext) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.addons.VSlang(30078)) oGuiElement.setFileName(self.addons.VSlang(30078)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) # oGuiElement.setThumbnail(sThumbnail) # oGuiElement.setFanart(sFanart) oGuiElement.setCat(1) oGui.addFolder(oGuiElement, oOutputParameterHandler) # Recherche globale séries oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oOutputParameterHandler.addParameter('searchtext', searchtext) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.addons.VSlang(30079)) oGuiElement.setFileName(self.addons.VSlang(30079)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) # oGuiElement.setThumbnail(sThumbnail) # oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGui.addFolder(oGuiElement, oOutputParameterHandler) # Recherche globale Animés oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.addons.VSlang(30118)) oGuiElement.setFileName(self.addons.VSlang(30118)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) # oGuiElement.setThumbnail(sThumbnail) # oGuiElement.setFanart(sFanart) oGuiElement.setCat(3) oGui.addFolder(oGuiElement, oOutputParameterHandler) # Recherche globale Dramas oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.addons.VSlang(30123)) oGuiElement.setFileName(self.addons.VSlang(30123)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) # oGuiElement.setThumbnail(sThumbnail) # oGuiElement.setFanart(sFanart) oGuiElement.setCat(4) oGui.addFolder(oGuiElement, oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oOutputParameterHandler.addParameter('searchtext', searchtext) # Recherche globale divers oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.addons.VSlang(30080)) oGuiElement.setFileName(self.addons.VSlang(30080)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) # oGuiElement.setThumbnail(sThumbnail) # oGuiElement.setFanart(sFanart) oGuiElement.setCat(5) oGui.addFolder(oGuiElement, oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'http://venom') # oOutputParameterHandler.addParameter('searchtext', searchtext) # oOutputParameterHandler.addParameter('disp', 'search10') # oOutputParameterHandler.addParameter('readdb', 'True') # oGui.addDir('globalSearch', 'showSearchText', 'self.addons.VSlang(30417), 'search.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showReplay(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'REPLAYTV_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30117), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'REPLAYTV_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30117), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'REPLAYTV_REPLAYTV') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showMovies(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_HD') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30160)), 'hd.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_VIEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30102)), 'views.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_COMMENTS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30103)), 'comments.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_NOTES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30104)), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_ANNEES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30106)), 'annees.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_LIST') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30111)), 'listes.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_VF') # oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30107)), 'vf.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_VOSTFR') # oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30120), self.addons.VSlang(30108)), 'vostfr.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_MOVIE') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showSeries(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_ANNEES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), self.addons.VSlang(30106)), 'annees.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_LIST') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), self.addons.VSlang(30111)), 'listes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_VFS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), self.addons.VSlang(30107)), 'vf.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_VOSTFRS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), self.addons.VSlang(30108)), 'vostfr.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_DRAMAS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30121), 'Dramas'), 'dramas.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SERIE_SERIES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showAnimes(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30122), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30122), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_ANNEES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30122), self.addons.VSlang(30106)), 'annees.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_VFS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30122), self.addons.VSlang(30107)), 'vf.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_VOSTFRS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30122), self.addons.VSlang(30108)), 'vostfr.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_ENFANTS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30122), self.addons.VSlang(30109)), 'enfants.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'ANIM_ANIMS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showDramas(self): oGui = cGui() # Affiche les Nouveautés Dramas oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'DRAMA_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30124), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) # Affiche les Genres Dramas oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'DRAMA_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30124), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'DRAMA_ANNEES') # oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30124), self.addons.VSlang(30106)), 'annees.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'DRAMA_VFS') # oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30124), self.addons.VSlang(30107)), 'vf.png', oOutputParameterHandler) # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'DRAMA_VOSTFRS') # oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30124), self.addons.VSlang(30108)), 'vostfr.png', oOutputParameterHandler) # Affiche les Sources Dramas oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'DRAMA_DRAMAS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showDocs(self): oGui = cGui() # Affiche les Nouveautés Documentaires oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'DOC_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30112), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) # Affiche les Genres Documentaires oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'DOC_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30112), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) # Affiche les Sources Documentaires oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'DOC_DOCS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'doc.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showSports(self): oGui = cGui() # Affiche les Nouveautés Sportives # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'SPORT_NEWS') # oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30113), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) # Affiche les live Sportifs oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SPORT_LIVE') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30113), self.addons.VSlang(30119)), 'news.png', oOutputParameterHandler) # Affiche les Genres Sportifs oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SPORT_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30113), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) # Affiche les Sources Sportives oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'SPORT_SPORTS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'sport.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showNets(self): oGui = cGui() # Affiche les Nouveautés Vidéos oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'NETS_NEWS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30114), self.addons.VSlang(30101)), 'news.png', oOutputParameterHandler) # Affiche les Genres Vidéos oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'NETS_GENRES') oGui.addDir(SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.addons.VSlang(30114), self.addons.VSlang(30105)), 'genres.png', oOutputParameterHandler) # Affiche les Sources Vidéos oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'NETS_NETS') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.addons.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showUsers(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('themoviedb_org', 'showMyTmdb', 'TMDB', 'tmdb.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('cTrakt', 'getLoad', self.addons.VSlang(30214), 'trakt.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('siteuptobox', 'load', self.addons.VSlang(30325), 'sites/siteuptobox.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir('siteonefichier', 'load', self.addons.VSlang(30327), 'sites/siteonefichier.png', oOutputParameterHandler) oGui.setEndOfDirectory() def ShowTools(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('cLibrary', 'getLibrary', self.addons.VSlang(30300), 'library.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir('cDownload', 'getDownload', self.addons.VSlang(30202), 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'showHostDirect', self.addons.VSlang(30469), 'search.png', oOutputParameterHandler) oGui.setEndOfDirectory() def showHistory(self): oGui = cGui() row = cDb().get_history() if row: oGui.addText(SITE_IDENTIFIER, self.addons.VSlang(30416)) else: oGui.addText(SITE_IDENTIFIER) for match in row: oOutputParameterHandler = cOutputParameterHandler() # code to get type with disp sType = self.addons.getSetting('search' + match[2][-1:] + '_type') if sType: oOutputParameterHandler.addParameter('type', sType) window(10101).setProperty('search_type', sType) oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oOutputParameterHandler.addParameter('searchtext', match[1]) # oOutputParameterHandler.addParameter('disp', match[2]) # oOutputParameterHandler.addParameter('readdb', 'False') oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('globalSearch') try: oGuiElement.setTitle('- ' + match[1]) except: oGuiElement.setTitle('- ' + str(match[1], 'utf-8')) oGuiElement.setFileName(match[1]) oGuiElement.setCat(match[2]) oGuiElement.setIcon('search.png') oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, 'cHome', 'delSearch', self.addons.VSlang(30412)) oGui.addFolder(oGuiElement, oOutputParameterHandler) if row: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(SITE_IDENTIFIER, 'delSearch', self.addons.VSlang(30413), 'search.png', oOutputParameterHandler) oGui.setEndOfDirectory() def delSearch(self): cDb().del_history() return True def callpluging(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sSiteUrl = oInputParameterHandler.getValue('siteUrl') oPluginHandler = cSiteHandler() aPlugins = oPluginHandler.getAvailablePlugins(sSiteUrl) for aPlugin in aPlugins: try: # exec('import ' + aPlugin[1]) # exec('sSiteUrl = ' + aPlugin[1] + '.' + sVar) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', aPlugin[0]) icon = 'sites/%s.png' % (aPlugin[2]) oGui.addDir(aPlugin[2], aPlugin[3], aPlugin[1], icon, oOutputParameterHandler) except: pass oGui.setEndOfDirectory() def showHostDirect(self): # fonction de recherche oGui = cGui() sUrl = oGui.showKeyBoard(heading=self.addons.VSlang(30045)) if (sUrl != False): oHoster = cHosterGui().checkHoster(sUrl) if (oHoster != False): oHoster.setDisplayName(self.addons.VSlang(30046)) oHoster.setFileName(self.addons.VSlang(30046)) cHosterGui().showHoster(oGui, oHoster, sUrl, '') oGui.setEndOfDirectory()
def showMyTmdb(): oGui = cGui() grab = cTMDb() addons = addon() tmdb_session = addons.getSetting('tmdb_session') if tmdb_session == '': oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'https://') oGui.addDir(SITE_IDENTIFIER, 'getToken', addons.VSlang(30305), 'tmdb.png', oOutputParameterHandler) else: # pas de deco possible avec l'api donc on test l'username sinon ont supprime tous result = grab.getUrl('account', '1', 'session_id=' + tmdb_session) if 'username' in result and result['username']: # pas de menu sans ID user c'est con addons.setSetting('tmdb_account', str(result['id'])) sUsername = result['username'] oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'https://') oGui.addText(SITE_IDENTIFIER, (addons.VSlang(30306)) % (sUsername)) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/favorite/movies oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/favorite/movies' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30434), 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/rated/movies oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/rated/movies' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30435), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/watchlist/movies oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/watchlist/movies' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30436), 'views.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/favorite/tv oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/favorite/tv' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30437), 'series.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/rated/tv oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/rated/tv' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30438), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/watchlist/tv oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/watchlist/tv' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30440), 'views.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/rated/tv/episodes oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/rated/tv/episodes' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30439), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() # /account/{account_id}/lists oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/lists' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showUserLists', addons.VSlang(30441), 'listes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'ouTMyTmdb', addons.VSlang(30309), 'listes.png', oOutputParameterHandler) else: ouTMyTmdb() oGui.setEndOfDirectory()
URL_WEB = 'https://raw.githubusercontent.com/Kodi-vStream/venom-xbmc-addons/Beta/repo/resources/webtv2.m3u' URL_RADIO = 'https://raw.githubusercontent.com/Kodi-vStream/venom-xbmc-addons/master/repo/resources/radio.m3u' MOVIE_IPTVSITE = (True, 'showIptvSite') UA = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36' headers = {'User-Agent': UA, 'Accept': '*/*', 'Connection': 'keep-alive'} icon = 'tv.png' #/home/lordvenom/.kodi/ #sRootArt = cConfig().getRootArt() sRootArt = "special://home/addons/plugin.video.vstream/resources/art/tv" ADDON = addon() class track(): def __init__(self, length, title, path, icon,data=''): self.length = length self.title = title self.path = path self.icon = icon self.data = data def load(): oGui = cGui() addons = addon() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', URL_WEB)
def showSeriesSaison(): oGui = cGui() grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') sMovieTitle = oInputParameterHandler.getValue('sMovieTitle') sFanart = oInputParameterHandler.getValue('sFanart') sTmdbId = oInputParameterHandler.getValue('sTmdbId') sId = oInputParameterHandler.getValue('sId') if sId == False: sId = sUrl.split('/')[-1] if sFanart == False: sFanart = '' # recherche la serie complete oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sMovieTitle) # oOutputParameterHandler.addParameter('type', 'serie') # oOutputParameterHandler.addParameter('searchtext', sMovieTitle) if not isMatrix(): oOutputParameterHandler.addParameter('searchtext', cUtil().CleanName(sMovieTitle)) else: oOutputParameterHandler.addParameter('searchtext', sMovieTitle) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('searchMovie') oGuiElement.setTitle(addons.VSlang(30414)) oGuiElement.setCat(2) oGuiElement.setIcon("searchtmdb.png") oGui.addFolder(oGuiElement, oOutputParameterHandler) result = grab.getUrl(sUrl) total = len(result) if (total > 0): total = len(result['seasons']) progress_ = progress().VScreate(SITE_NAME) for i in result['seasons']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sNbreEp, SSeasonNum = i['episode_count'], i['season_number'] # Mise en forme des infos (au format meta imdb) i = grab._format(i, '') sTitle, sGenre, sThumb, sFanart, sDesc, sYear = i['title'], i['genre'], i['cover_url'], i['backdrop_url'], i['plot'], i['year'] sTitle = 'Saison ' + str(SSeasonNum) + ' (' + str(sNbreEp) + ')' sUrl = 'tv/' + str(sId) + '/season/' + str(SSeasonNum) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sMovieTitle', sMovieTitle) oOutputParameterHandler.addParameter('sThumb', sThumb) oOutputParameterHandler.addParameter('sId', sId) oOutputParameterHandler.addParameter('sSeason', SSeasonNum) oOutputParameterHandler.addParameter('sFanart', sFanart) oOutputParameterHandler.addParameter('sTmdbId', sTmdbId) cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setTmdbId(sTmdbId) oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showSeriesEpisode') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sMovieTitle) oGuiElement.setIcon('series.png') oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) oGuiElement.setDescription(sDesc) oGuiElement.setYear(sYear) oGuiElement.setGenre(sGenre) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) # changement mode view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def showMyTmdb(): oGui = cGui() grab = cTMDb() addons = addon() tmdb_session = addons.getSetting('tmdb_session') if tmdb_session == '': oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'https://') oGui.addDir(SITE_IDENTIFIER, 'getToken', addons.VSlang(30305), 'trakt.png', oOutputParameterHandler) else : #pas de deco possible avec l'api donc on test l'username sinon ont supprime tous result = grab.getUrl('account', '1', 'session_id=' + tmdb_session) if 'username' in result and result['username']: #pas de menu sans ID user c'est con addons.setSetting('tmdb_account', str(result['id'])) sUsername = result['username'] oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'https://') oGui.addText(SITE_IDENTIFIER, (addons.VSlang(30306)) % (sUsername)) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/favorite/movies oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/favorite/movies' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30434), 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/rated/movies oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/rated/movies' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30435), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/watchlist/movies oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/watchlist/movies' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showMovies', addons.VSlang(30436), 'views.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/favorite/tv oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/favorite/tv' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30437), 'series.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/rated/tv oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/rated/tv' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30438), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/watchlist/tv oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/watchlist/tv' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30440), 'views.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/rated/tv/episodes oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/rated/tv/episodes' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showSeries', addons.VSlang(30439), 'notes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() #/account/{account_id}/lists oOutputParameterHandler.addParameter('session_id', tmdb_session) oOutputParameterHandler.addParameter('siteUrl', 'account/%s/lists' % int(result['id'])) oGui.addDir(SITE_IDENTIFIER, 'showUserLists', addons.VSlang(30441), 'listes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://') oGui.addDir(SITE_IDENTIFIER, 'ouTMyTmdb', addons.VSlang(30309), 'listes.png', oOutputParameterHandler) else : ouTMyTmdb() oGui.setEndOfDirectory()
def showActors(sSearch=''): oGui = cGui() grab = cTMDb() addons = addon() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if (oInputParameterHandler.exist('sSearch')): sSearch = oInputParameterHandler.getValue('sSearch') if sSearch: # format obligatoire evite de modif le format de l'url dans la lib >> _call # a cause d'un ? pas ou il faut pour ça >> invalid api key result = grab.getUrl(sUrl, iPage, 'query=' + sSearch) else: result = grab.getUrl(sUrl, iPage) total = len(result) if (total > 0): total = len(result['results']) progress_ = progress().VScreate(SITE_NAME) # récup le nombre de page pour NextPage nbrpage = result['total_pages'] for i in result['results']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sName, sThumb = i['name'], i['profile_path'] if sThumb: POSTER_URL = grab.poster sThumb = POSTER_URL + sThumb else: sThumb = '' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sThumb', sThumb) if not isMatrix(): sName = sName.encode('utf-8') oOutputParameterHandler.addParameter('siteUrl', 'person/' + str(i['id']) + '/movie_credits') sTitle = str(sName) oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showFilmActor') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sName) oGuiElement.setIcon('actors.png') oGuiElement.setMeta(0) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) if (int(iPage) < int(nbrpage)): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() # ajoute param sSearch pour garder le bon format d'url avec grab url if sSearch: oOutputParameterHandler.addParameter('sSearch', sSearch) oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) oGui.addNext(SITE_IDENTIFIER, 'showActors', 'Page ' + str(iNextPage), oOutputParameterHandler) view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
class cGui: SITE_NAME = 'cGui' CONTENT = 'files' searchResults = [] listing = [] ADDON = addon() if isKrypton(): CONTENT = 'addons' def addNewDir(self, Type, sId, sFunction, sLabel, sIcon, sThumbnail='', sDesc='', oOutputParameterHandler='', sMeta=0, sCat=None): oGuiElement = cGuiElement() # dir ou link => CONTENT par défaut = files if Type != 'dir' and Type != 'link': cGui.CONTENT = Type oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) if sThumbnail == '': oGuiElement.setThumbnail(oGuiElement.getIcon()) else: oGuiElement.setThumbnail(sThumbnail) oGuiElement.setPoster(sThumbnail) oGuiElement.setMeta(sMeta) oGuiElement.setDescription(sDesc) if sCat is not None: oGuiElement.setCat(sCat) # Pour addLink on recupere le sCat precedent. elif Type == 'link': oInputParameterHandler = cInputParameterHandler() sCat = oInputParameterHandler.getValue('sCat') if sCat: oGuiElement.setCat(sCat) oOutputParameterHandler.addParameter('sFav', sFunction) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) try: self.addFolder(oGuiElement, oOutputParameterHandler) except: pass def addMovie(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler=''): self.addNewDir('movies', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 1, 1) def addTV(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler=''): self.addNewDir('tvshows', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 2, 2) def addAnime(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler=''): self.addNewDir('tvshows', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 4, 2) def addMisc(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler=''): if sThumbnail or sDesc: type = 'videos' else: type = 'files' self.addNewDir(type, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 0, 5) def addMoviePack(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler=''): self.addNewDir('movies', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 3, 1) def addDir(self, sId, sFunction, sLabel, sIcon, oOutputParameterHandler='', sDesc=""): self.addNewDir('dir', sId, sFunction, sLabel, sIcon, '', sDesc, oOutputParameterHandler, 0, None) def addLink(self, sId, sFunction, sLabel, sThumbnail, sDesc, oOutputParameterHandler=''): sIcon = sThumbnail self.addNewDir('link', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 0, None) # Affichage d'un épisode, sans recherche de Métadonnées, et menu adapté def addEpisode(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler=''): self.addNewDir('episodes', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 0, 2) # Affichage d'une personne (acteur, réalisateur, ..) def addPerson(self, sId, sFunction, sLabel, sIcon, sThumbnail, oOutputParameterHandler=''): sThumbnail = '' sDesc = '' self.addNewDir('artists', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 7, None) # Affichage d'un réseau de distribution du média def addNetwork(self, sId, sFunction, sLabel, sIcon, oOutputParameterHandler=''): sThumbnail = '' sDesc = '' self.addNewDir('files', sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler, 8, None) def addNext(self, sId, sFunction, sLabel, oOutputParameterHandler): oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle('[COLOR teal]' + sLabel + ' >>>[/COLOR]') oGuiElement.setIcon('next.png') oGuiElement.setThumbnail(oGuiElement.getIcon()) oGuiElement.setMeta(0) oGuiElement.setCat(5) self.createContexMenuPageSelect(oGuiElement, oOutputParameterHandler) self.createContexMenuViewBack(oGuiElement, oOutputParameterHandler) self.addFolder(oGuiElement, oOutputParameterHandler) # utiliser oGui.addText(SITE_IDENTIFIER) def addNone(self, sId): return self.addText(sId) def addText(self, sId, sLabel='', sIcon='none.png'): # Pas de texte lors des recherches globales if window(10101).getProperty('search') == 'true': return oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction('DoNothing') if not sLabel: sLabel = self.ADDON.VSlang(30204) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(oGuiElement.getIcon()) oGuiElement.setMeta(0) oOutputParameterHandler = cOutputParameterHandler() self.addFolder(oGuiElement, oOutputParameterHandler) # non utiliser depuis le 22/04 def addMovieDB(self, sId, sFunction, sLabel, sIcon, sThumbnail, sFanart, oOutputParameterHandler=''): cGui.CONTENT = 'movies' oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setMeta(1) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.addFolder(oGuiElement, oOutputParameterHandler) # non utiliser 22/04 def addTVDB(self, sId, sFunction, sLabel, sIcon, sThumbnail, sFanart, oOutputParameterHandler=''): cGui.CONTENT = 'tvshows' oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.addFolder(oGuiElement, oOutputParameterHandler) # afficher les liens non playable def addFolder(self, oGuiElement, oOutputParameterHandler='', _isFolder=True): # recherche append les reponses if window(10101).getProperty('search') == 'true': import copy cGui.searchResults.append({ 'guiElement': oGuiElement, 'params': copy.deepcopy(oOutputParameterHandler) }) return # Des infos a rajouter ? params = { 'siteUrl': oGuiElement.setSiteUrl, 'sTmdbId': oGuiElement.setTmdbId, 'sYear': oGuiElement.setYear } try: for sParam, callback in params.iteritems(): value = oOutputParameterHandler.getValue(sParam) if value: callback(value) except AttributeError: for sParam, callback in params.items(): value = oOutputParameterHandler.getValue(sParam) if value: callback(value) oListItem = self.createListItem(oGuiElement) oListItem.setProperty('IsPlayable', 'false') sCat = oGuiElement.getCat() if sCat: cGui.sCat = sCat oOutputParameterHandler.addParameter('sCat', sCat) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) oOutputParameterHandler.addParameter('sTitleWatched', oGuiElement.getTitleWatched()) if sCat: # 1 = movies, moviePack; 2 = series, animes, episodes; 5 = MISC if oGuiElement.getMeta(): self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuba(oGuiElement, oOutputParameterHandler) if not oListItem.getProperty('isBookmark'): self.createContexMenuBookmark(oGuiElement, oOutputParameterHandler) if sCat in (1, 2): if self.ADDON.getSetting('bstoken') != '': self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler) if self.ADDON.getSetting('tmdb_account') != '': self.createContexMenuTMDB(oGuiElement, oOutputParameterHandler) self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) self.listing.append((sItemUrl, oListItem, _isFolder)) # Vider les paramètres pour être recyclé oOutputParameterHandler.clearParameter() # affiche les liens playable def addHost(self, oGuiElement, oOutputParameterHandler=''): oInputParameterHandler = cInputParameterHandler() cGui.CONTENT = 'files' if oOutputParameterHandler.getValue('siteUrl'): sSiteUrl = oOutputParameterHandler.getValue('siteUrl') oGuiElement.setSiteUrl(sSiteUrl) # On récupere le sCat du fichier précédent. sCat = oInputParameterHandler.getValue('sCat') if sCat: oGuiElement.setCat(sCat) oListItem = self.createListItem(oGuiElement) oListItem.setProperty('IsPlayable', 'true') oListItem.setProperty('Video', 'true') oListItem.addStreamInfo('video', {}) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) oOutputParameterHandler.addParameter('sTitleWatched', oGuiElement.getTitleWatched()) self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) self.listing.append((sItemUrl, oListItem, False)) def createListItem(self, oGuiElement): oListItem = listitem(oGuiElement.getTitle()) # voir : https://kodi.wiki/view/InfoLabels oListItem.setInfo(oGuiElement.getType(), oGuiElement.getItemValues()) oListItem.setArt({ 'poster': oGuiElement.getPoster(), 'thumb': oGuiElement.getThumbnail(), 'icon': oGuiElement.getIcon(), 'fanart': oGuiElement.getFanart() }) aProperties = oGuiElement.getItemProperties() for sPropertyKey, sPropertyValue in aProperties.items(): oListItem.setProperty(sPropertyKey, str(sPropertyValue)) return oListItem # Marquer vu/Non vu def createContexMenuWatch(self, oGuiElement, oOutputParameterHandler=''): self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'setWatched', self.ADDON.VSlang(30206)) def createContexMenuPageSelect(self, oGuiElement, oOutputParameterHandler): oContext = cContextElement() oContext.setFile('cGui') oContext.setSiteName('cGui') oContext.setFunction('selectPage') oContext.setTitle(self.ADDON.VSlang(30017)) oOutputParameterHandler.addParameter('OldFunction', oGuiElement.getFunction()) oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) def createContexMenuViewBack(self, oGuiElement, oOutputParameterHandler): oContext = cContextElement() oContext.setFile('cGui') oContext.setSiteName('cGui') oContext.setFunction('viewBack') oContext.setTitle(self.ADDON.VSlang(30018)) oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) # marque page def createContexMenuBookmark(self, oGuiElement, oOutputParameterHandler=''): oOutputParameterHandler.addParameter('sCleanTitle', oGuiElement.getCleanTitle()) oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oOutputParameterHandler.addParameter('sFav', oGuiElement.getFunction()) oOutputParameterHandler.addParameter('sCat', oGuiElement.getCat()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'setBookmark', self.ADDON.VSlang(30210)) def createContexMenuTrakt(self, oGuiElement, oOutputParameterHandler=''): oOutputParameterHandler.addParameter('sImdbId', oGuiElement.getImdbId()) oOutputParameterHandler.addParameter('sTmdbId', oGuiElement.getTmdbId()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) sType = cGui.CONTENT.replace('tvshows', 'shows') oOutputParameterHandler.addParameter('sType', sType) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cTrakt', 'cTrakt', 'getAction', self.ADDON.VSlang(30214)) def createContexMenuTMDB(self, oGuiElement, oOutputParameterHandler=''): oOutputParameterHandler.addParameter('sImdbId', oGuiElement.getImdbId()) oOutputParameterHandler.addParameter('sTmdbId', oGuiElement.getTmdbId()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'themoviedb_org', 'themoviedb_org', 'getAction', 'TMDB') def createContexMenuDownload(self, oGuiElement, oOutputParameterHandler='', status='0'): if status == '0': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'StartDownloadOneFile', self.ADDON.VSlang(30215)) if status == '0' or status == '2': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'delDownload', self.ADDON.VSlang(30216)) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'DelFile', self.ADDON.VSlang(30217)) if status == '1': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'StopDownloadList', self.ADDON.VSlang(30218)) if status == '2': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'ReadDownload', self.ADDON.VSlang(30219)) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'ResetDownload', self.ADDON.VSlang(30220)) # Information def createContexMenuinfo(self, oGuiElement, oOutputParameterHandler=''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) oOutputParameterHandler.addParameter('sYear', oGuiElement.getYear()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'viewInfo', self.ADDON.VSlang(30208)) # Bande annonce def createContexMenuba(self, oGuiElement, oOutputParameterHandler=''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) oOutputParameterHandler.addParameter('sYear', oGuiElement.getYear()) oOutputParameterHandler.addParameter('sTrailerUrl', oGuiElement.getTrailer()) oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'viewBA', self.ADDON.VSlang(30212)) # Recherche similaire def createContexMenuSimil(self, oGuiElement, oOutputParameterHandler=''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) oOutputParameterHandler.addParameter('sCat', oGuiElement.getCat()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'viewSimil', self.ADDON.VSlang(30213)) def CreateSimpleMenu(self, oGuiElement, oOutputParameterHandler, sFile, sName, sFunction, sTitle): oContext = cContextElement() oContext.setFile(sFile) oContext.setSiteName(sName) oContext.setFunction(sFunction) oContext.setTitle(sTitle) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) def createContexMenuDelFav(self, oGuiElement, oOutputParameterHandler=''): self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'delBookmarksMenu', self.ADDON.VSlang(30209)) def createContexMenuSettings(self, oGuiElement, oOutputParameterHandler=''): self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'globalParametre', 'globalParametre', 'opensetting', self.ADDON.VSlang(30023)) def __createContextMenu(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] # Menus classiques reglés a la base if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler( ) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % ( sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [(oContextItem.getTitle(), 'RunPlugin(%s)' % sTest)] oListItem.addContextMenuItems(aContextMenus, True) return oListItem def __ContextMenu(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler( ) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % ( sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [(oContextItem.getTitle(), 'RunPlugin(%s)' % sTest)] oListItem.addContextMenuItems(aContextMenus) return oListItem def __ContextMenuPlay(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler( ) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % ( sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [(oContextItem.getTitle(), 'RunPlugin(%s)' % sTest)] oListItem.addContextMenuItems(aContextMenus) return oListItem def __createItemUrl(self, oGuiElement, oOutputParameterHandler=''): if (oOutputParameterHandler == ''): oOutputParameterHandler = cOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sPluginPath = cPluginHandler().getPluginPath() if (len(oGuiElement.getFunction()) == 0): sItemUrl = '%s?site=%s&title=%s&%s' % ( sPluginPath, oGuiElement.getSiteName(), QuotePlus(oGuiElement.getCleanTitle()), sParams) else: sItemUrl = '%s?site=%s&function=%s&title=%s&%s' % ( sPluginPath, oGuiElement.getSiteName(), oGuiElement.getFunction(), QuotePlus(oGuiElement.getCleanTitle()), sParams) return sItemUrl def setEndOfDirectory(self, ForceViewMode=False): iHandler = cPluginHandler().getPluginHandle() # modif 22/06 if not self.listing: self.addText('cGui') xbmcplugin.addDirectoryItems(iHandler, self.listing, len(self.listing)) xbmcplugin.setPluginCategory(iHandler, '') xbmcplugin.setContent(iHandler, cGui.CONTENT) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(iHandler, succeeded=True, cacheToDisc=True) # reglage vue # 50 = liste / 51 grande liste / 500 icone / 501 gallerie / 508 fanart / if ForceViewMode: xbmc.executebuiltin('Container.SetViewMode(' + str(ForceViewMode) + ')') else: if self.ADDON.getSetting('active-view') == 'true': if cGui.CONTENT == 'movies' or cGui.CONTENT == 'artists': # xbmc.executebuiltin('Container.SetViewMode(507)') xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('movie-view')) elif cGui.CONTENT == 'tvshows': xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('serie-view')) elif cGui.CONTENT == 'files' or cGui.CONTENT == 'episodes': xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('default-view')) # bug affichage Kodi 18 del self.listing[:] def updateDirectory(self): # refresh the content xbmc.executebuiltin('Container.Refresh') xbmc.sleep(600) # Nécessaire pour laisser le temps du refresh def viewBA(self): oInputParameterHandler = cInputParameterHandler() sFileName = oInputParameterHandler.getValue('sFileName') sYear = oInputParameterHandler.getValue('sYear') sTrailerUrl = oInputParameterHandler.getValue('sTrailerUrl') sMeta = oInputParameterHandler.getValue('sMeta') from resources.lib.ba import cShowBA cBA = cShowBA() cBA.SetSearch(sFileName) cBA.SetYear(sYear) cBA.SetTrailerUrl(sTrailerUrl) cBA.SetMetaType(sMeta) cBA.SearchBA() def viewBack(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() # sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sTest = '%s?site=%s' % (sPluginPath, sId) xbmc.executebuiltin('Container.Update(%s, replace)' % sTest) def viewInfo(self): if addon().getSetting('information-view') == "false": from resources.lib.config import WindowsBoxes oInputParameterHandler = cInputParameterHandler() sCleanTitle = oInputParameterHandler.getValue( 'sFileName') if oInputParameterHandler.exist( 'sFileName') else xbmc.getInfoLabel( 'ListItem.Property(sCleanTitle)') sMeta = oInputParameterHandler.getValue( 'sMeta') if oInputParameterHandler.exist( 'sMeta') else xbmc.getInfoLabel('ListItem.Property(sMeta)') sYear = oInputParameterHandler.getValue( 'sYear') if oInputParameterHandler.exist( 'sYear') else xbmc.getInfoLabel('ListItem.Year') WindowsBoxes(sCleanTitle, sCleanTitle, sMeta, sYear) else: # On appel la fonction integrer a Kodi pour charger les infos. xbmc.executebuiltin('Action(Info)') def viewSimil(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() sCleanTitle = oInputParameterHandler.getValue( 'sFileName') if oInputParameterHandler.exist( 'sFileName') else xbmc.getInfoLabel( 'ListItem.Property(sCleanTitle)') sCat = oInputParameterHandler.getValue( 'sCat') if oInputParameterHandler.exist( 'sCat') else xbmc.getInfoLabel('ListItem.Property(sCat)') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('searchtext', sCleanTitle) oOutputParameterHandler.addParameter('sCat', sCat) oOutputParameterHandler.addParameter('readdb', 'False') sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, 'globalSearch', 'globalSearch', sParams) # Si lancé depuis la page Home de Kodi, il faut d'abord en sortir pour lancer la recherche if xbmc.getCondVisibility('Window.IsVisible(home)'): xbmc.executebuiltin('ActivateWindow(%d)' % (10028)) xbmc.executebuiltin('Container.Update(%s)' % sTest) return False def selectPage(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() # sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sFunction = oInputParameterHandler.getValue('OldFunction') siteUrl = oInputParameterHandler.getValue('siteUrl') if siteUrl.endswith( '/'): # for the url http.://www.1test.com/annee-2020/page-2/ urlSource = siteUrl.rsplit('/', 2)[0] endOfUrl = siteUrl.rsplit('/', 2)[1] + '/' else: # for the url http.://www.1test.com/annee-2020/page-2 or /page-2.html urlSource = siteUrl.rsplit('/', 1)[0] endOfUrl = siteUrl.rsplit('/', 1)[1] oParser = cParser() oldNum = oParser.getNumberFromString(endOfUrl) newNum = 0 if oldNum: newNum = self.showNumBoard() if newNum: try: siteUrl = urlSource + '/' + endOfUrl.replace(oldNum, newNum, 1) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('Container.Update(%s)' % sTest) except: return False return False def selectPage2(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() sId = oInputParameterHandler.getValue('sId') sFunction = oInputParameterHandler.getValue('OldFunction') siteUrl = oInputParameterHandler.getValue('siteUrl') selpage = self.showNumBoard() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) oOutputParameterHandler.addParameter('Selpage', selpage) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('Container.Update(%s, replace)' % sTest) def setWatched(self): if True: # Use vStream database oInputParameterHandler = cInputParameterHandler() sSite = oInputParameterHandler.getValue('siteUrl') sTitle = oInputParameterHandler.getValue('sTitleWatched') if not sTitle: return meta = {} meta['title'] = sTitle meta['site'] = sSite db = cDb() row = db.get_watched(meta) if row: db.del_watched(meta) db.del_resume(meta) else: db.insert_watched(meta) # To test # updateDirectory() else: # Use kodi buildin feature xbmc.executebuiltin('Action(ToggleWatched)') # Not usefull ? # updateDirectory() def showKeyBoard(self, sDefaultText='', heading=''): keyboard = xbmc.Keyboard(sDefaultText) keyboard.setHeading(heading) keyboard.doModal() if (keyboard.isConfirmed()): sSearchText = keyboard.getText() if (len(sSearchText)) > 0: return sSearchText return False def showNumBoard(self, sDefaultNum=''): dialogs = dialog() numboard = dialogs.numeric(0, self.ADDON.VSlang(30019), sDefaultNum) # numboard.doModal() if numboard is not None: return numboard return False def openSettings(self): return False def showNofication(self, sTitle, iSeconds=0): return False def showError(self, sTitle, sDescription, iSeconds=0): return False def showInfo(self, sTitle, sDescription, iSeconds=0): return False
MOVIE_IPTVSITE = (True, 'showIptvSite') UA = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36' USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' headers = { 'User-Agent': USER_AGENT, 'Accept': '*/*', 'Connection': 'keep-alive' } icon = 'tv.png' #/home/lordvenom/.kodi/ #sRootArt = cConfig().getRootArt() sRootArt = "special://home/addons/plugin.video.vstream/resources/art/tv" ADDON = addon() class track(): def __init__(self, length, title, path, icon, data=''): self.length = length self.title = title self.path = path self.icon = icon self.data = data def load(): oGui = cGui() addons = addon()
class cGui(): SITE_NAME = 'cGui' CONTENT = 'files' searchResults = [] #modif 22/06 listing = [] ADDON = addon() if isKrypton(): CONTENT = 'addons' def addMovie(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler = ''): cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setPoster(sThumbnail) oGuiElement.setMeta(1) oGuiElement.setDescription(sDesc) #oGuiElement.setMovieFanart() oGuiElement.setCat(1) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.addFolder(oGuiElement, oOutputParameterHandler) def addTV(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler = ''): cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setPoster(sThumbnail) oGuiElement.setMeta(2) oGuiElement.setDescription(sDesc) #oGuiElement.setTvFanart() oGuiElement.setCat(2) # if oOutputParameterHandler.getValue('season'): # sSeason = oOutputParameterHandler.getValue('season') # oGuiElement.addItemValues('Season', sSeason) # if oOutputParameterHandler.getValue('episode'): # sSeason = oOutputParameterHandler.getValue('episode') # oGuiElement.addItemValues('Episode', sSeason) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.addFolder(oGuiElement, oOutputParameterHandler) def addMisc(self, sId, sFunction, sLabel, sIcon, sThumbnail, sDesc, oOutputParameterHandler = ''): cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(sThumbnail) #oGuiElement.setPoster(sThumbnail) oGuiElement.setMeta(0) #oGuiElement.setDirFanart(sIcon) oGuiElement.setCat(5) oGuiElement.setDescription(sDesc) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) #self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) self.addFolder(oGuiElement, oOutputParameterHandler) #non utiliser le 18/04 #def addFav(self, sId, sFunction, sLabel, sIcon, sThumbnail, fanart, oOutputParameterHandler = ''): #cGui.CONTENT = "files" #oGuiElement = cGuiElement() #oGuiElement.setSiteName(sId) #oGuiElement.setFunction(sFunction) #oGuiElement.setTitle(sLabel) #oGuiElement.setIcon(sIcon) #oGuiElement.setMeta(0) #oGuiElement.setThumbnail(sThumbnail) #oGuiElement.setFanart(fanart) #self.createContexMenuDelFav(oGuiElement, oOutputParameterHandler) #self.addFolder(oGuiElement, oOutputParameterHandler) def addLink(self, sId, sFunction, sLabel, sThumbnail, sDesc, oOutputParameterHandler = ''): cGui.CONTENT = "files" oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) #oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setPoster(sThumbnail) oGuiElement.setDescription(sDesc) oGuiElement.setMeta(0) #oGuiElement.setDirFanart('') oInputParameterHandler = cInputParameterHandler() sCat = oInputParameterHandler.getValue('sCat') if sCat: oGuiElement.setCat(sCat) self.addFolder(oGuiElement, oOutputParameterHandler) def addDir(self, sId, sFunction, sLabel, sIcon, oOutputParameterHandler = ''): oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(oGuiElement.getIcon()) oGuiElement.setMeta(0) #oGuiElement.setDirFanart(sIcon) oOutputParameterHandler.addParameter('sFav', sFunction) #context parametre if isKrypton(): self.createContexMenuSettings(oGuiElement, oOutputParameterHandler) self.addFolder(oGuiElement, oOutputParameterHandler) def addNext(self, sId, sFunction, sLabel, oOutputParameterHandler): oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon('next.png') oGuiElement.setThumbnail(oGuiElement.getIcon()) oGuiElement.setMeta(0) #oGuiElement.setDirFanart('next.png') oGuiElement.setCat(5) self.createContexMenuPageSelect(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) self.addFolder(oGuiElement, oOutputParameterHandler) #utiliser oGui.addText(SITE_IDENTIFIER) def addNone(self, sId): return self.addText(sId) def addText(self, sId, sLabel="", sIcon='none.png'): oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction('DoNothing') if not sLabel: sLabel = self.ADDON.VSlang(30204) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setThumbnail(oGuiElement.getIcon()) oGuiElement.setMeta(0) oOutputParameterHandler = cOutputParameterHandler() self.addFolder(oGuiElement, oOutputParameterHandler) #non utiliser depuis le 22/04 def addMovieDB(self, sId, sFunction, sLabel, sIcon, sThumbnail, sFanart, oOutputParameterHandler = ''): cGui.CONTENT = "movies" oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setMeta(1) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.addFolder(oGuiElement, oOutputParameterHandler) #non utiliser 22/04 def addTVDB(self, sId, sFunction, sLabel, sIcon, sThumbnail, sFanart, oOutputParameterHandler = ''): cGui.CONTENT = "tvshows" oGuiElement = cGuiElement() oGuiElement.setSiteName(sId) oGuiElement.setFunction(sFunction) oGuiElement.setTitle(sLabel) oGuiElement.setIcon(sIcon) oGuiElement.setMeta(2) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setFanart(sFanart) oGuiElement.setCat(7) if oOutputParameterHandler.getValue('sMovieTitle'): sTitle = oOutputParameterHandler.getValue('sMovieTitle') oGuiElement.setFileName(sTitle) self.addFolder(oGuiElement, oOutputParameterHandler) #afficher les liens non playable def addFolder(self, oGuiElement, oOutputParameterHandler='', _isFolder=True): #recherche append les reponses if window(10101).getProperty('search') == 'true': import copy cGui.searchResults.append({'guiElement':oGuiElement, 'params':copy.deepcopy(oOutputParameterHandler)}) return #Des infos a rajouter ? params = { "siteUrl": oGuiElement.setSiteUrl,#indispensable "sTmdbId": oGuiElement.setTmdbId, "sImbdId": oGuiElement.setImdbId,#inutile ? "sYear": oGuiElement.setYear, } for sParam, callback in params.iteritems(): value = oOutputParameterHandler.getValue(sParam) if value: callback(value) oListItem = self.createListItem(oGuiElement) oListItem.setProperty("IsPlayable", "false") #affiche tag HD # if '1080' in oGuiElement.getTitle(): # oListItem.addStreamInfo('video', { 'aspect': '1.78', 'width':1920, 'height' : 1080 }) # elif '720' in oGuiElement.getTitle(): # oListItem.addStreamInfo('video', { 'aspect': '1.50', 'width':1280, 'height' : 720 }) # elif '2160'in oGuiElement.getTitle(): # oListItem.addStreamInfo('video', { 'aspect': '1.78', 'width':3840, 'height' : 2160 }) #oListItem.addStreamInfo('audio', {'language': 'fr'}) # if oGuiElement.getMeta(): #oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) if oGuiElement.getCat(): oOutputParameterHandler.addParameter('sCat', oGuiElement.getCat()) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) #new context prend en charge les metas if (oGuiElement.getMeta() > 0): if cGui.CONTENT == "movies": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) self.createContexMenuba(oGuiElement, oOutputParameterHandler) self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler) self.createContexMenuTMDB(oGuiElement, oOutputParameterHandler) self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) elif cGui.CONTENT == "tvshows": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) self.createContexMenuba(oGuiElement, oOutputParameterHandler) self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler) self.createContexMenuTMDB(oGuiElement, oOutputParameterHandler) self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle() #modif 22/06 #xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=_isFolder) self.listing.append((sItemUrl, oListItem, _isFolder)) def createListItem(self, oGuiElement): oListItem = listitem(oGuiElement.getTitle()) oListItem.setInfo(oGuiElement.getType(), oGuiElement.getItemValues()) #oListItem.setThumbnailImage(oGuiElement.getThumbnail()) #oListItem.setIconImage(oGuiElement.getIcon()) #krypton et sont comportement oListItem.setArt({'poster': oGuiElement.getPoster(), 'thumb': oGuiElement.getThumbnail(), 'icon': oGuiElement.getIcon(), 'fanart': oGuiElement.getFanart() }) aProperties = oGuiElement.getItemProperties() for sPropertyKey in aProperties.keys(): oListItem.setProperty(sPropertyKey, aProperties[sPropertyKey]) return oListItem #affiche les liens playable def addHost(self, oGuiElement, oOutputParameterHandler=''): if isKrypton(): cGui.CONTENT = 'movies' if oOutputParameterHandler.getValue('siteUrl'): sSiteUrl = oOutputParameterHandler.getValue('siteUrl') oGuiElement.setSiteUrl(sSiteUrl) oListItem = self.createListItem(oGuiElement) oListItem.setProperty("IsPlayable", "true") oListItem.setProperty("Video", "true") oListItem.addStreamInfo('video', {}) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle() #modif 13/09 #xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=False) self.listing.append((sItemUrl, oListItem, False)) #Marquer vu/Non vu def createContexMenuWatch(self, oGuiElement, oOutputParameterHandler= ''): self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'setWatched', self.ADDON.VSlang(30206)) def createContexMenuPageSelect(self, oGuiElement, oOutputParameterHandler): #sSiteUrl = oGuiElement.getSiteName() oContext = cContextElement() oContext.setFile('cGui') oContext.setSiteName('cGui') oContext.setFunction('selectpage') oContext.setTitle('[COLOR azure]Selectionner page[/COLOR]') oOutputParameterHandler.addParameter('OldFunction', oGuiElement.getFunction()) oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) oContext = cContextElement() oContext.setFile('cGui') oContext.setSiteName('cGui') oContext.setFunction('viewback') oContext.setTitle('[COLOR azure]Retour Site[/COLOR]') oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) #marque page def createContexMenuFav(self, oGuiElement, oOutputParameterHandler= ''): oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oOutputParameterHandler.addParameter('sFav', oGuiElement.getFunction()) oOutputParameterHandler.addParameter('sCat', oGuiElement.getCat()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'setFavorite', self.ADDON.VSlang(30207)) def createContexMenuTrakt(self, oGuiElement, oOutputParameterHandler= ''): oOutputParameterHandler.addParameter('sImdbId', oGuiElement.getImdbId()) oOutputParameterHandler.addParameter('sTmdbId', oGuiElement.getTmdbId()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) sType = cGui.CONTENT.replace('tvshows', 'shows') oOutputParameterHandler.addParameter('sType', sType) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cTrakt', 'cTrakt', 'getAction', self.ADDON.VSlang(30214)) def createContexMenuTMDB(self, oGuiElement, oOutputParameterHandler= ''): oOutputParameterHandler.addParameter('sImdbId', oGuiElement.getImdbId()) oOutputParameterHandler.addParameter('sTmdbId', oGuiElement.getTmdbId()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'themoviedb_org', 'themoviedb_org', 'getAction', 'TMDB') def createContexMenuDownload(self, oGuiElement, oOutputParameterHandler= '', status = '0'): if status == '0': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'StartDownloadOneFile', self.ADDON.VSlang(30215)) if status == '0' or status == '2': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'delDownload', self.ADDON.VSlang(30216)) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'DelFile', self.ADDON.VSlang(30217)) if status == '1': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'StopDownloadList', self.ADDON.VSlang(30218)) if status == '2': self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'ReadDownload', self.ADDON.VSlang(30219)) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cDownload', 'cDownload', 'ResetDownload', self.ADDON.VSlang(30220)) #Information def createContexMenuinfo(self, oGuiElement, oOutputParameterHandler= ''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) oOutputParameterHandler.addParameter('sId', oGuiElement.getSiteName()) oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'viewinfo', self.ADDON.VSlang(30208)) def createContexMenuba(self, oGuiElement, oOutputParameterHandler= ''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'viewBA', self.ADDON.VSlang(30212)) def createContexMenuSimil(self, oGuiElement, oOutputParameterHandler= ''): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sFileName', oGuiElement.getFileName()) oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) oOutputParameterHandler.addParameter('sCat', oGuiElement.getCat()) self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cGui', oGuiElement.getSiteName(), 'viewsimil', self.ADDON.VSlang(30213)) def CreateSimpleMenu(self,oGuiElement, oOutputParameterHandler, file, name, function, title): oContext = cContextElement() oContext.setFile(file) oContext.setSiteName(name) oContext.setFunction(function) oContext.setTitle(title) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) def createContexMenuDelFav(self, oGuiElement, oOutputParameterHandler= ''): self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cFav', 'cFav', 'delFavouritesMenu', self.ADDON.VSlang(30209)) def createContexMenuSettings(self, oGuiElement, oOutputParameterHandler= ''): self.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'globalParametre', 'globalParametre', 'opensetting', self.ADDON.VSlang(30023)) def __createContextMenu(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] #Menus classiques reglés a la base if (len(oGuiElement.getContextItems()) > 0): for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oListItem.addContextMenuItems(aContextMenus, True) return oListItem def __ContextMenu(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if (len(oGuiElement.getContextItems()) > 0): for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oListItem.addContextMenuItems(aContextMenus) #oListItem.addContextMenuItems(aContextMenus, True) return oListItem def __ContextMenuPlay(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if (len(oGuiElement.getContextItems()) > 0): for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oListItem.addContextMenuItems(aContextMenus) #oListItem.addContextMenuItems(aContextMenus, True) return oListItem def setEndOfDirectory(self, ForceViewMode = False): iHandler = cPluginHandler().getPluginHandle() #modif 22/06 if not self.listing: self.addText('cGui') xbmcplugin.addDirectoryItems(iHandler, self.listing, len(self.listing)) xbmcplugin.setPluginCategory(iHandler, "") xbmcplugin.setContent(iHandler, cGui.CONTENT) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(iHandler, succeeded=True, cacheToDisc=True) #reglage vue #50 = liste / 51 grande liste / 500 icone / 501 gallerie / 508 fanart / if (ForceViewMode): xbmc.executebuiltin('Container.SetViewMode(' + str(ForceViewMode) + ')') else: if (self.ADDON.getSetting('active-view') == 'true'): if cGui.CONTENT == "movies": #xbmc.executebuiltin('Container.SetViewMode(507)') xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('movie-view')) elif cGui.CONTENT == "tvshows": xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('serie-view')) elif cGui.CONTENT == "files": xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('default-view')) #bug affichage Kodi 18 del self.listing [:] def updateDirectory(self): xbmc.executebuiltin("Container.Refresh") def viewback(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sTest = '%s?site=%s' % (sPluginPath, sId) xbmc.executebuiltin('XBMC.Container.Update(%s, replace)' % sTest ) def viewsimil(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() sFileName = oInputParameterHandler.getValue('sFileName') sTitle = oInputParameterHandler.getValue('sTitle') sCat = oInputParameterHandler.getValue('sCat') oOutputParameterHandler = cOutputParameterHandler() #oOutputParameterHandler.addParameter('searchtext', sFileName) oOutputParameterHandler.addParameter('searchtext', util.cUtil().CleanName(sTitle)) oOutputParameterHandler.addParameter('sCat', sCat) oOutputParameterHandler.addParameter('readdb', 'False') sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, 'globalSearch', 'globalSearch', sParams) xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest ) return False def selectpage(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() #sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sFunction = oInputParameterHandler.getValue('OldFunction') siteUrl = oInputParameterHandler.getValue('siteUrl') oParser = cParser() oldNum = oParser.getNumberFromString(siteUrl) newNum = 0 if oldNum: newNum = self.showNumBoard() if newNum: try: siteUrl = siteUrl.replace(oldNum, newNum) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest ) except: return False return False def selectpage2(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') siteUrl = oInputParameterHandler.getValue('siteUrl') sFunction = oInputParameterHandler.getValue('OldFunction') selpage = self.showNumBoard() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) oOutputParameterHandler.addParameter('Selpage', selpage) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('XBMC.Container.Update(%s, replace)' % sTest ) def setWatched(self): oInputParameterHandler = cInputParameterHandler() aParams = oInputParameterHandler.getAllParameter() # import xbmc # xbmc.log(str(aParams)) sSite = oInputParameterHandler.getValue('siteUrl') sTitle = xbmc.getInfoLabel('ListItem.label') meta = {} meta['title'] = sTitle meta['site'] = sSite row = cDb().get_watched(meta) if row: cDb().del_watched(meta) cDb().del_resume(meta) else: cDb().insert_watched(meta) xbmc.executebuiltin( 'Container.Refresh' ) def viewBA(self): oInputParameterHandler = cInputParameterHandler() sFileName = oInputParameterHandler.getValue('sFileName') from resources.lib.ba import cShowBA cBA = cShowBA() cBA.SetSearch(sFileName) cBA.SearchBA() def viewinfo(self): from resources.lib.config import WindowsBoxes oGuiElement = cGuiElement() oInputParameterHandler = cInputParameterHandler() sTitle = oInputParameterHandler.getValue('sTitle') sId = oInputParameterHandler.getValue('sId') sFileName = oInputParameterHandler.getValue('sFileName') sYear = oInputParameterHandler.getValue('sYear') sMeta = oInputParameterHandler.getValue('sMeta') #sMeta = 1 >> film sMeta = 2 >> serie sCleanTitle = util.cUtil().CleanName(sFileName) #on vire saison et episode if (True):#sMeta == 2: sCleanTitle = re.sub('(?i).pisode [0-9]+', '', sCleanTitle) sCleanTitle = re.sub('(?i)saison [0-9]+', '', sCleanTitle) sCleanTitle = re.sub('(?i)S[0-9]+E[0-9]+', '', sCleanTitle) sCleanTitle = re.sub('(?i)[S|E][0-9]+', '', sCleanTitle) ui = WindowsBoxes(sTitle, sCleanTitle, sMeta, sYear) def __createItemUrl(self, oGuiElement, oOutputParameterHandler=''): if (oOutputParameterHandler == ''): oOutputParameterHandler = cOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() #cree une id unique # if oGuiElement.getSiteUrl(): # print str(hash(oGuiElement.getSiteUrl())) sPluginPath = cPluginHandler().getPluginPath() if (len(oGuiElement.getFunction()) == 0): sItemUrl = '%s?site=%s&title=%s&%s' % (sPluginPath, oGuiElement.getSiteName(), urllib.quote_plus(oGuiElement.getCleanTitle()), sParams) else: sItemUrl = '%s?site=%s&function=%s&title=%s&%s' % (sPluginPath, oGuiElement.getSiteName(), oGuiElement.getFunction(), urllib.quote_plus(oGuiElement.getCleanTitle()), sParams) #print sItemUrl return sItemUrl def showKeyBoard(self, sDefaultText='', heading = ''): keyboard = xbmc.Keyboard(sDefaultText) keyboard.setHeading(heading) keyboard.doModal() if (keyboard.isConfirmed()): sSearchText = keyboard.getText() if (len(sSearchText)) > 0: return sSearchText return False def showNumBoard(self, sDefaultNum=''): dialogs = dialog() numboard = dialogs.numeric(0, 'Entrer la page', sDefaultNum) #numboard.doModal() if numboard != None: return numboard return False def openSettings(self): return False def showNofication(self, sTitle, iSeconds=0): return False def showError(self, sTitle, sDescription, iSeconds=0): return False def showInfo(self, sTitle, sDescription, iSeconds=0): return False
def opensetting(): addon().openSettings()
def showActors(sSearch = ''): oGui = cGui() grab = cTMDb() addons = addon() POSTER_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('poster_tmdb')) FANART_URL = ('https://image.tmdb.org/t/p/%s') % (addons.getSetting('backdrop_tmdb')) oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') iPage = 1 if (oInputParameterHandler.exist('page')): iPage = oInputParameterHandler.getValue('page') if (oInputParameterHandler.exist('sSearch')): sSearch = oInputParameterHandler.getValue('sSearch') if sSearch: #format obligatoire evite de modif le format de l'url dans la lib >> _call #a cause d'un ? pas ou il faut pour ça >> invalid api key result = grab.getUrl(sUrl,iPage,'query=' + sSearch) else: result = grab.getUrl(sUrl, iPage) total = len(result) dialog = progress() dialog.VScreate(SITE_NAME) if (total > 0): total = len(result['results']) progress_ = progress().VScreate(SITE_NAME) #récup le nombre de page pour NextPage nbrpage = result['total_pages'] for i in result['results']: progress_.VSupdate(progress_, total) if progress_.iscanceled(): break sName, sThumb = i['name'], i['profile_path'] if sThumb: sThumb = POSTER_URL + sThumb else: sThumb = '' oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('sThumb', sThumb) sName = sName.encode('utf-8') oOutputParameterHandler.addParameter('siteUrl', 'person/' + str(i['id']) + '/movie_credits') #oGui.addMovieDB(SITE_IDENTIFIER, 'showFilmActor', '[COLOR red]'+str(sName)+'[/COLOR]', '', sThumb, '', oOutputParameterHandler) sTitle = '[COLOR red]' + str(sName) + '[/COLOR]' oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setFunction('showFilmActor') oGuiElement.setTitle(sTitle) oGuiElement.setFileName(sName) oGuiElement.setIcon('actors.png') oGuiElement.setMeta(0) oGuiElement.setThumbnail(sThumb) oGuiElement.setPoster(sThumb) oGuiElement.setCat(7) oGui.addFolder(oGuiElement, oOutputParameterHandler) progress_.VSclose(progress_) if (int(iPage) < int(nbrpage)): iNextPage = int(iPage) + 1 oOutputParameterHandler = cOutputParameterHandler() #ajoute param sSearch pour garder le bon format d'url avec grab url if sSearch: oOutputParameterHandler.addParameter('sSearch', sSearch) oOutputParameterHandler.addParameter('siteUrl', sUrl) oOutputParameterHandler.addParameter('page', iNextPage) oGui.addNext(SITE_IDENTIFIER, 'showActors', '[COLOR teal]Page ' + str(iNextPage) + ' >>>[/COLOR]', oOutputParameterHandler) view = addons.getSetting('visuel-view') oGui.setEndOfDirectory(view)
def parseUrl(self): # import sys # 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) # Exclue les appels par des plugins qu'on ne sait pas gérer, par exemple : plugin://plugin.video.vstream/extrafanart oPluginHandler = cPluginHandler() # if oPluginHandler.getPluginPath() != 'plugin://plugin.video.vstream/': # cGui().setEndOfDirectory() # return oInputParameterHandler = cInputParameterHandler() if oInputParameterHandler.exist('function'): sFunction = oInputParameterHandler.getValue('function') else: VSlog('call load methode') sFunction = "load" if sFunction == 'setSetting': if oInputParameterHandler.exist('id'): plugin_id = oInputParameterHandler.getValue('id') else: return if oInputParameterHandler.exist('value'): value = oInputParameterHandler.getValue('value') else: return setSetting(plugin_id, value) return if sFunction == 'setSettings': setSettings(oInputParameterHandler) return if sFunction == 'DoNothing': return if not oInputParameterHandler.exist('site'): # mise a jour try: # from resources.lib.about import cAbout # cAbout().getUpdate() plugins = __import__('resources.lib.about', fromlist=['about']).cAbout() function = getattr(plugins, 'getUpdate') function() 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') # if oInputParameterHandler.exist('title'): # sTitle = oInputParameterHandler.getValue('title') # else: # sTitle = 'none' VSlog('load site ' + sSiteName + ' and call function ' + sFunction) # cStatistic().callStartPlugin(sSiteName, sTitle) if isHosterGui(sSiteName, sFunction): return if isGui(sSiteName, sFunction): return if isFav(sSiteName, sFunction): return if isLibrary(sSiteName, sFunction): return if isDl(sSiteName, sFunction): return if isHome(sSiteName, sFunction): return if isTrakt(sSiteName, sFunction): return if sSiteName == 'globalSearch': searchGlobal() return if sSiteName == 'globalRun': __import__('resources.lib.runscript', fromlist=['runscript']) # function = getattr(plugins, sFunction) # function() return if sSiteName == 'globalSources': oGui = cGui() aPlugins = oPluginHandler.getAvailablePlugins(True) if len(aPlugins) == 0: addons = addon() addons.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter( 'siteUrl', 'http://venom') icon = 'sites/%s.png' % (aPlugin[1]) # icon = 'https://imgplaceholder.com/512x512/transparent/fff?text=%s&font-family=Roboto_Bold' % aPlugin[1] oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler) oGui.setEndOfDirectory() return if sSiteName == 'globalParametre': addons = addon() addons.openSettings() 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: progress().VSclose( ) # Referme le dialogue en cas d'exception, sinon blocage de Kodi VSlog('could not load site: ' + sSiteName + ' error: ' + str(e)) import traceback traceback.print_exc() return
class cHosterGui: SITE_NAME = 'cHosterGui' ADDON = addon() DIALOG = dialog() # step 1 - bGetRedirectUrl in ein extra optionsObject verpacken def showHoster(self, oGui, oHoster, sMediaUrl, sThumbnail, bGetRedirectUrl=False): oInputParameterHandler = cInputParameterHandler() sMovieTitle = oInputParameterHandler.getValue('title') oGuiElement = cGuiElement() oGuiElement.setSiteName(self.SITE_NAME) #oGuiElement.setFunction('showHosterMenu') oGuiElement.setFunction('play') oGuiElement.setTitle(oHoster.getDisplayName()) #oGuiElement.setThumbnail(sThumbnail) # if (oInputParameterHandler.exist('sMeta')): # sMeta = oInputParameterHandler.getValue('sMeta') # oGuiElement.setMeta(int(sMeta)) oGuiElement.setFileName(oHoster.getFileName()) oGuiElement.getInfoLabel() if sThumbnail: oGuiElement.setThumbnail(sThumbnail) #oGuiElement.setMeta(1) oGuiElement.setIcon('host.png') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('sMediaUrl', sMediaUrl) #oOutputParameterHandler.addParameter('sThumbnail', oGuiElement.getThumbnail()) oOutputParameterHandler.addParameter('sHosterIdentifier', oHoster.getPluginIdentifier()) oOutputParameterHandler.addParameter('bGetRedirectUrl', bGetRedirectUrl) oOutputParameterHandler.addParameter('sFileName', oHoster.getFileName()) oOutputParameterHandler.addParameter('sTitle', oHoster.getDisplayName()) oOutputParameterHandler.addParameter('sId', 'cHosterGui') oOutputParameterHandler.addParameter('siteUrl', sMediaUrl) #oOutputParameterHandler.addParameter('sFav', 'play') #oOutputParameterHandler.addParameter('sCat', '4') #nouveaux pour la lecture. if (oInputParameterHandler.exist('sCat')): sCat = oInputParameterHandler.getValue('sCat') oGuiElement.setCat(sCat) oOutputParameterHandler.addParameter('sCat', sCat) else: oGuiElement.setCat('4') #existe dans le menu krypton 17 if not isKrypton(): oGui.createContexMenuWatch(oGuiElement, oOutputParameterHandler) #context playlit menu oContext = cContextElement() oContext.setFile('cHosterGui') oContext.setSiteName(self.SITE_NAME) oContext.setFunction('addToPlaylist') oContext.setTitle(self.ADDON.VSlang(30201)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) #Download menu if (oHoster.isDownloadable() == True): oContext = cContextElement() oContext.setFile('cDownload') oContext.setSiteName('cDownload') oContext.setFunction('AddtoDownloadList') oContext.setTitle(self.ADDON.VSlang(30202)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) if (oHoster.isDownloadable() == True): #Beta context download and view menu oContext = cContextElement() oContext.setFile('cDownload') oContext.setSiteName('cDownload') oContext.setFunction('AddtoDownloadListandview') oContext.setTitle(self.ADDON.VSlang(30326)) oContext.setOutputParameterHandler(oOutputParameterHandler) oGuiElement.addContextItem(oContext) #Upload menu uptobox if cInputParameterHandler().getValue( 'site') != 'siteuptobox' and self.ADDON.getSetting( 'hoster_uptobox_premium') == 'true': host = oHoster.getPluginIdentifier() accept = [ 'uptobox', 'uptostream', 'onefichier', 'uploaded', 'uplea' ] for i in accept: if host == i: oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'siteuptobox', 'siteuptobox', 'UptomyAccount', self.ADDON.VSlang(30325)) #onefichier if cInputParameterHandler().getValue( 'site') != 'siteonefichier' and self.ADDON.getSetting( 'hoster_onefichier_premium') == 'true': host = oHoster.getPluginIdentifier() accept = 'onefichier' #les autres ne fonctionnent pas if host == accept: oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'siteonefichier', 'siteonefichier', 'UptomyAccount', '1fichier') #context FAV menu oGui.createContexMenuFav(oGuiElement, oOutputParameterHandler) #context Library menu oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, 'cLibrary', 'cLibrary', 'setLibrary', self.ADDON.VSlang(30324)) #bug oGui.addHost(oGuiElement, oOutputParameterHandler) #oGui.addFolder(oGuiElement, oOutputParameterHandler) def checkHoster(self, sHosterUrl): #securitee if (not sHosterUrl): return False #Petit nettoyage sHosterUrl = sHosterUrl.split('|')[0] #Recuperation du host try: sHostName = sHosterUrl.split('/')[2] except: sHostName = sHosterUrl #L'user a active l'url resolver ? if self.ADDON.getSetting('UserUrlResolver') == 'true': import urlresolver hmf = urlresolver.HostedMediaFile(url=sHosterUrl) if hmf.valid_url(): tmp = self.getHoster('resolver') RH = sHosterUrl.split('/')[2] RH = RH.replace('www.', '') tmp.setRealHost(RH[:3].upper()) return tmp #Gestion classique if ('livestream' in sHostName): return self.getHoster('lien_direct') if ('gounlimited' in sHostName): return self.getHoster('gounlimited') if ('xdrive' in sHostName): return self.getHoster('xdrive') if ('facebook' in sHostName): return self.getHoster('facebook') if ('cloudcartel' in sHostName): return self.getHoster('cloudcartel') if (('raptu.com' in sHostName) or ('rapidvideo' in sHostName)): return self.getHoster('raptu') if ('mixloads' in sHostName): return self.getHoster('mixloads') if ('vidoza.' in sHostName): return self.getHoster('vidoza') if (('youtube' in sHostName) or ('youtu.be' in sHostName)): return self.getHoster('youtube') if ('rutube' in sHostName): return self.getHoster('rutube') if ('vk.com' in sHostName): return self.getHoster('vk') if ('vkontakte' in sHostName): return self.getHoster('vk') if ('vkcom' in sHostName): return self.getHoster('vk') if ('megawatch' in sHostName): return self.getHoster('megawatch') if ('vidto.me' in sHostName): return self.getHoster('vidto') if ('vidtodo.' in sHostName): return self.getHoster('vidtodo') if ('vidstodo.' in sHostName): return self.getHoster('vidtodo') if ('vidzi' in sHostName): return self.getHoster('vidzi') if ('vcstream' in sHostName): return self.getHoster('vidcloud') if ('filetrip' in sHostName): return self.getHoster('filetrip') if ('uptostream' in sHostName): return self.getHoster('uptostream') if (('dailymotion' in sHostName) or ('dai.ly' in sHostName)): if 'stream' in sHosterUrl: return self.getHoster('lien_direct') else: return self.getHoster('dailymotion') if ('filez.' in sHostName): return self.getHoster('flashx') if ('mystream' in sHostName): return self.getHoster('mystream') if ('streamingentiercom/videophp?type=speed' in sHosterUrl): return self.getHoster('speedvideo') if ('speedvideo' in sHostName): return self.getHoster('speedvideo') if ('speedvid' in sHostName): return self.getHoster('speedvid') # if (('netu' in sHostName) or ('hqq' in sHostName)): # return self.getHoster('netu') if ('waaw' in sHostName): return self.getHoster('netu') if ('mail.ru' in sHostName): return self.getHoster('mailru') if ('onevideo' in sHostName): return self.getHoster('onevideo') if ('googlevideo' in sHostName): return self.getHoster('googlevideo') if ('picasaweb' in sHostName): return self.getHoster('googlevideo') if ('googleusercontent' in sHostName): return self.getHoster('googlevideo') if ('playreplay' in sHostName): return self.getHoster('playreplay') if ('flashx' in sHostName): return self.getHoster('flashx') if (('ok.ru' in sHostName) or ('odnoklassniki' in sHostName)): return self.getHoster('ok_ru') if ('vimeo.com' in sHostName): return self.getHoster('vimeo') if ('openload' in sHostName): return self.getHoster('openload') if ('oload.' in sHostName): return self.getHoster('openload') if ('oladblock.' in sHostName): return self.getHoster('openload') if (('thevideo.' in sHostName) or ('video.tt' in sHostName) or ('vev.io' in sHostName)): return self.getHoster('thevideo_me') if ('uqload.' in sHostName): return self.getHoster('uqload') if ('letwatch' in sHostName): return self.getHoster('letwatch') if ('www.amazon' in sHostName): return self.getHoster('amazon') if ('filepup' in sHostName): return self.getHoster('filepup') if ('vimple.ru' in sHostName): return self.getHoster('vimple') if ('wstream.' in sHostName): return self.getHoster('wstream') if ('watchvideo' in sHostName): return self.getHoster('watchvideo') if ('drive.google.com' in sHostName): return self.getHoster('googledrive') if ('docs.google.com' in sHostName): return self.getHoster('googledrive') if ('vidwatch' in sHostName): return self.getHoster('vidwatch') if ('up2stream' in sHostName): return self.getHoster('up2stream') if ('stream.moe' in sHostName): return self.getHoster('streammoe') if ('tune' in sHostName): return self.getHoster('tune') if ('sendvid' in sHostName): return self.getHoster('sendvid') if ('vidup' in sHostName): return self.getHoster('vidup') if ('vidbull' in sHostName): return self.getHoster('vidbull') if ('vidlox' in sHostName): return self.getHoster('vidlox') if ('stagevu' in sHostName): return self.getHoster('stagevu') if (('movshare' in sHostName) or ('wholecloud' in sHostName)): return self.getHoster('wholecloud') if ('gorillavid' in sHostName): return self.getHoster('gorillavid') if ('daclips' in sHostName): return self.getHoster('daclips') if ('estream' in sHostName) and not ('widestream' in sHostName): return self.getHoster('estream') if ('hdvid' in sHostName): return self.getHoster('hdvid') if ('streamango' in sHostName): return self.getHoster('streamango') if ('streamcherry' in sHostName): return self.getHoster('streamango') if ('vshare' in sHostName): return self.getHoster('vshare') if ('giga' in sHostName): return self.getHoster('giga') if ('vidbom' in sHostName): return self.getHoster('vidbom') if ('upvid.' in sHostName): return self.getHoster('upvid') if (('cloudvid' in sHostName) or ('clipwatching.' in sHostName)): #meme code return self.getHoster('cloudvid') if ('megadrive' in sHostName): return self.getHoster('megadrive') if ('downace' in sHostName): return self.getHoster('downace') if ('clickopen' in sHostName): return self.getHoster('clickopen') if ('iframe-secured' in sHostName): return self.getHoster('iframe_secured') if ('iframe-secure' in sHostName): return self.getHoster('iframe_secure') if ('goo.gl' in sHostName or 'bit.ly' in sHostName or 'streamcrypt.net' in sHostName or 'opsktp.com' in sHosterUrl): return self.getHoster('allow_redirects') if ('jawcloud' in sHostName): return self.getHoster('jawcloud') if ('kvid' in sHostName): return self.getHoster('kvid') if ('soundcloud' in sHostName): return self.getHoster('soundcloud') if ('mixcloud' in sHostName): return self.getHoster('mixcloud') if ('ddlfr' in sHostName): return self.getHoster('ddlfr') if ('pdj' in sHostName): return self.getHoster('pdj') if ('vidzstore' in sHostName): return self.getHoster('vidzstore') if ('hd-stream' in sHostName): return self.getHoster('hd_stream') if ('rapidstream' in sHostName): return self.getHoster('rapidstream') if ('beeload' in sHostName): return self.getHoster('beeload') if ('verystream.' in sHostName): return self.getHoster('verystream') if ('archive.' in sHostName): return self.getHoster('archive') #Lien telechargeable a convertir en stream if ('1fichier' in sHostName): return self.getHoster('onefichier') if ('uptobox' in sHostName): return self.getHoster('uptobox') if ('uplea.com' in sHostName): return self.getHoster('uplea') if ('uploaded' in sHostName or 'ul.to' in sHostName): return self.getHoster('uploaded') if ('kaydo.ws' in sHostName): return self.getHoster('lien_direct') if ('fembed' in sHostName): return self.getHoster('lien_direct') #Si aucun hebergeur connu on teste les liens directs if (sHosterUrl[-4:] in '.mp4.avi.flv.m3u8.webm'): return self.getHoster('lien_direct') #Cas special si parametre apres le lien_direct if (sHosterUrl.split('?')[0][-4:] in '.mp4.avi.flv.m3u8.webm'): return self.getHoster('lien_direct') return False def getHoster(self, sHosterFileName): exec "from resources.hosters." + sHosterFileName + " import cHoster" return cHoster() def play(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sHosterIdentifier = oInputParameterHandler.getValue( 'sHosterIdentifier') sMediaUrl = oInputParameterHandler.getValue('sMediaUrl') bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl') sFileName = oInputParameterHandler.getValue('sFileName') sTitle = oInputParameterHandler.getValue('title') #sThumbnail = oInputParameterHandler.getValue('sThumbnail') if not sTitle: sTitle = sFileName if (bGetRedirectUrl == 'True'): sMediaUrl = self.__getRedirectUrl(sMediaUrl) VSlog("Hoster - play " + sMediaUrl) oHoster = self.getHoster(sHosterIdentifier) oHoster.setFileName(sFileName) sHosterName = oHoster.getDisplayName() self.DIALOG.VSinfo(sHosterName, 'Resolve') try: oHoster.setUrl(sMediaUrl) aLink = oHoster.getMediaLink() if (aLink[0] == True): oGuiElement = cGuiElement() oGuiElement.setSiteName(self.SITE_NAME) oGuiElement.setMediaUrl(aLink[1]) oGuiElement.setTitle(sTitle) #oGuiElement.setTitle(oHoster.getFileName()) oGuiElement.getInfoLabel() oPlayer = cPlayer() #sous titres ? if len(aLink) > 2: oPlayer.AddSubtitles(aLink[2]) oPlayer.run(oGuiElement, oHoster.getFileName(), aLink[1]) return else: self.DIALOG.VSerror("Fichier introuvable") return except: self.DIALOG.VSerror("Fichier introuvable") return oGui.setEndOfDirectory() def addToPlaylist(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sHosterIdentifier = oInputParameterHandler.getValue( 'sHosterIdentifier') sMediaUrl = oInputParameterHandler.getValue('sMediaUrl') bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl') sFileName = oInputParameterHandler.getValue('sFileName') if (bGetRedirectUrl == 'True'): sMediaUrl = self.__getRedirectUrl(sMediaUrl) VSlog("Hoster - playlist " + sMediaUrl) oHoster = self.getHoster(sHosterIdentifier) oHoster.setFileName(sFileName) oHoster.setUrl(sMediaUrl) aLink = oHoster.getMediaLink() if (aLink[0] == True): oGuiElement = cGuiElement() oGuiElement.setSiteName(self.SITE_NAME) oGuiElement.setMediaUrl(aLink[1]) oGuiElement.setTitle(oHoster.getFileName()) oPlayer = cPlayer() oPlayer.addItemToPlaylist(oGuiElement) self.DIALOG.VSinfo(str(oHoster.getFileName()), 'Playlist') return oGui.setEndOfDirectory() def __getRedirectUrl(self, sUrl): oRequest = cRequestHandler(sUrl) oRequest.request() return oRequest.getRealUrl()
def __init__(self): self.ADDON = addon() self.__sDisplayName = 'Uptobox' self.__sFileName = self.__sDisplayName self.oPremiumHandler = None self.stream = True
class cRequestHandler: REQUEST_TYPE_GET = 0 REQUEST_TYPE_POST = 1 DIALOG = dialog() ADDON = addon() def __init__(self, sUrl): self.__sUrl = sUrl self.__sRealUrl = '' self.__cType = 0 self.__aParamaters = {} self.__aParamatersLine = '' self.__aHeaderEntries = [] self.removeBreakLines(True) self.removeNewLines(True) self.__setDefaultHeader() self.__timeout = 30 self.__bRemoveNewLines = False self.__bRemoveBreakLines = False self.__sResponseHeader = '' def removeNewLines(self, bRemoveNewLines): self.__bRemoveNewLines = bRemoveNewLines def removeBreakLines(self, bRemoveBreakLines): self.__bRemoveBreakLines = bRemoveBreakLines def setRequestType(self, cType): self.__cType = cType def setTimeout(self, valeur): self.__timeout = valeur def addHeaderEntry(self, sHeaderKey, sHeaderValue): for sublist in self.__aHeaderEntries: if sHeaderKey in sublist: self.__aHeaderEntries.remove(sublist) aHeader = {sHeaderKey: sHeaderValue} self.__aHeaderEntries.append(aHeader) def addParameters(self, sParameterKey, mParameterValue): self.__aParamaters[sParameterKey] = mParameterValue def addParametersLine(self, mParameterValue): self.__aParamatersLine = mParameterValue #egg addMultipartFiled('sess_id':sId,'upload_type':'url','srv_tmp_url':sTmp) def addMultipartFiled(self, fields): mpartdata = MPencode(fields) self.__aParamaters = mpartdata[1] self.addHeaderEntry('Content-Type', mpartdata[0]) self.addHeaderEntry('Content-Length', len(mpartdata[1])) #Je sais plus si elle gere les doublons def getResponseHeader(self): return self.__sResponseHeader # url after redirects def getRealUrl(self): return self.__sRealUrl def GetCookies(self): if 'Set-Cookie' in self.__sResponseHeader: import re #cookie_string = self.__sResponseHeader.getheaders('set-cookie') #c = '' #for i in cookie_string: # c = c + i + ', ' c = self.__sResponseHeader.getheader('set-cookie') c2 = re.findall('(?:^|,) *([^;,]+?)=([^;,\/]+?);', c) if c2: cookies = '' for cook in c2: cookies = cookies + cook[0] + '=' + cook[1] + ';' return cookies return '' def request(self): self.__sUrl = self.__sUrl.replace(' ', '+') return self.__callRequest() def getRequestUri(self): return self.__sUrl + '?' + urllib.urlencode(self.__aParamaters) def __setDefaultHeader(self): self.addHeaderEntry( 'User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0' ) self.addHeaderEntry('Accept-Language', 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3') self.addHeaderEntry('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7') def __callRequest(self): if self.__aParamatersLine: sParameters = self.__aParamatersLine else: sParameters = urllib.urlencode(self.__aParamaters) if (self.__cType == cRequestHandler.REQUEST_TYPE_GET): if (len(sParameters) > 0): if (self.__sUrl.find('?') == -1): self.__sUrl = self.__sUrl + '?' + str(sParameters) sParameters = '' else: self.__sUrl = self.__sUrl + '&' + str(sParameters) sParameters = '' if (len(sParameters) > 0): oRequest = urllib2.Request(self.__sUrl, sParameters) else: oRequest = urllib2.Request(self.__sUrl) for aHeader in self.__aHeaderEntries: for sHeaderKey, sHeaderValue in aHeader.items(): oRequest.add_header(sHeaderKey, sHeaderValue) sContent = '' try: oResponse = urllib2.urlopen(oRequest, timeout=self.__timeout) sContent = oResponse.read() self.__sResponseHeader = oResponse.info() #compressed page ? if self.__sResponseHeader.get('Content-Encoding') == 'gzip': import zlib sContent = zlib.decompress(sContent, zlib.MAX_WBITS | 16) #https://bugs.python.org/issue4773 self.__sRealUrl = oResponse.geturl() self.__sResponseHeader = oResponse.info() oResponse.close() except urllib2.HTTPError, e: if e.code == 503: #Protected by cloudFlare ? from resources.lib import cloudflare if cloudflare.CheckIfActive(e.read()): cookies = self.GetCookies() print 'Page protegee par cloudflare' CF = cloudflare.CloudflareBypass() sContent = CF.GetHtml(self.__sUrl, e.read(), cookies, sParameters, oRequest.headers) self.__sRealUrl, self.__sResponseHeader = CF.GetReponseInfo( ) if not sContent: self.DIALOG.VSerror( "%s (%d),%s" % (self.ADDON.VSlang(30205), e.code, self.__sUrl)) return '' except urllib2.URLError, e: self.DIALOG.VSerror( "%s (%s),%s" % (self.ADDON.VSlang(30205), e.reason, self.__sUrl)) return ''
#-*- coding: utf-8 -*- #Vstream https://github.com/Kodi-vStream/venom-xbmc-addons from resources.lib.gui.hoster import cHosterGui from resources.lib.gui.gui import cGui from resources.lib.handler.inputParameterHandler import cInputParameterHandler from resources.lib.handler.outputParameterHandler import cOutputParameterHandler from resources.lib.handler.requestHandler import cRequestHandler from resources.lib.parser import cParser from resources.lib.comaddon import progress, addon import re sColor = addon().getSetting("deco_color") UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0' SITE_IDENTIFIER = 'tvseriestreaming' SITE_NAME = 'Tv_seriestreaming' SITE_DESC = 'Séries & Animés en Streaming' URL_MAIN = 'https://fr.seriestreaming.site/' SERIE_SERIES = ('http://', 'load') SERIE_NEWS = (URL_MAIN + 'les-nouveaux-episodes', 'showMovies') SERIE_VIEWS = (URL_MAIN + 'top-series', 'showMovies') SERIE_COMMENT = (URL_MAIN + 'le-top-des-meilleures-serie', 'showMovies') SERIE_LIST = (URL_MAIN, 'showAZ') SERIE_GENRES = (True, 'showGenres') SERIE_ANNEES = (True, 'showSerieYears') URL_SEARCH_SERIES = (URL_MAIN + 'search?q=', 'showMovies')
class cPlayer(xbmc.Player): ADDON = addon() DIALOG = dialog() def __init__(self, *args): sPlayerType = self.__getPlayerType() xbmc.Player.__init__(self, sPlayerType) self.Subtitles_file = [] self.SubtitleActive = False oInputParameterHandler = cInputParameterHandler() #aParams = oInputParameterHandler.getAllParameter() #xbmc.log(str(aParams)) self.sHosterIdentifier = oInputParameterHandler.getValue( 'sHosterIdentifier') self.sTitle = oInputParameterHandler.getValue('sTitle') #self.sSite = oInputParameterHandler.getValue('site') self.sSite = oInputParameterHandler.getValue('siteUrl') self.sThumbnail = xbmc.getInfoLabel('ListItem.Art(thumb)') self.playBackEventReceived = False self.playBackStoppedEventReceived = False self.forcestop = False VSlog('player initialized') def clearPlayList(self): oPlaylist = self.__getPlayList() oPlaylist.clear() def __getPlayList(self): return xbmc.PlayList(xbmc.PLAYLIST_VIDEO) def addItemToPlaylist(self, oGuiElement): oGui = cGui() oListItem = oGui.createListItem(oGuiElement) self.__addItemToPlaylist(oGuiElement, oListItem) def __addItemToPlaylist(self, oGuiElement, oListItem): oPlaylist = self.__getPlayList() oPlaylist.add(oGuiElement.getMediaUrl(), oListItem) def AddSubtitles(self, files): if isinstance(files, basestring): self.Subtitles_file.append(files) else: self.Subtitles_file = files def run(self, oGuiElement, sTitle, sUrl): self.totalTime = 0 self.currentTime = 0 sPluginHandle = cPluginHandler().getPluginHandle() oGui = cGui() item = oGui.createListItem(oGuiElement) item.setPath(oGuiElement.getMediaUrl()) #meta = {'label': oGuiElement.getTitle(), 'title': oGuiElement.getTitle()} #item = xbmcgui.ListItem(path=sUrl, iconImage='DefaultVideo.png', thumbnailImage=self.sThumbnail) #item.setInfo(type='Video', infoLabels=meta) #Sous titres if (self.Subtitles_file): try: item.setSubtitles(self.Subtitles_file) VSlog('Load SubTitle :' + str(self.Subtitles_file)) self.SubtitleActive = True except: VSlog("Can't load subtitle:" + str(self.Subtitles_file)) player_conf = self.ADDON.getSetting('playerPlay') #Si lien dash, methode prioritaire if sUrl.endswith('.mpd'): if isKrypton() == True: self.enable_addon('inputstream.adaptive') item.setProperty('inputstreamaddon', 'inputstream.adaptive') item.setProperty('inputstream.adaptive.manifest_type', 'mpd') xbmcplugin.setResolvedUrl(sPluginHandle, True, listitem=item) VSlog('Player use inputstream addon') else: dialog().VSerror('Nécessite kodi 17 minimum') return #1 er mode de lecture elif (player_conf == '0'): self.play(sUrl, item) VSlog('Player use Play() method') #2 eme mode non utilise elif (player_conf == 'neverused'): xbmc.executebuiltin('PlayMedia(' + sUrl + ')') VSlog('Player use PlayMedia() method') #3 eme mode (defaut) else: xbmcplugin.setResolvedUrl(sPluginHandle, True, item) VSlog('Player use setResolvedUrl() method') #Attend que le lecteur demarre, avec un max de 20s for _ in xrange(20): if self.playBackEventReceived: break xbmc.sleep(1000) #active/desactive les sous titres suivant l'option choisie dans la config if (self.SubtitleActive): if (self.ADDON.getSetting('srt-view') == 'true'): self.showSubtitles(True) self.DIALOG.VSinfo('Sous-titres chargés', 'Sous-Titres', 5) else: self.showSubtitles(False) self.DIALOG.VSinfo( 'Sous-titres chargés, vous pouvez les activer', 'Sous-Titres', 15) while self.isPlaying() and not self.forcestop: #while not xbmc.abortRequested: try: self.currentTime = self.getTime() self.totalTime = self.getTotalTime() #xbmc.log(str(self.currentTime)) except: pass #break xbmc.sleep(1000) if not self.playBackStoppedEventReceived: self.onPlayBackStopped() #Uniquement avec la lecture avec play() if (player_conf == '0'): r = xbmcplugin.addDirectoryItem(handle=sPluginHandle, url=sUrl, listitem=item, isFolder=False) #xbmcplugin.endOfDirectory(sPluginHandle, True, False, False) return r VSlog('Closing player') #fonction light servant par exmple pour visualiser les DL ou les chaines de TV def startPlayer(self): oPlayList = self.__getPlayList() self.play(oPlayList) def onPlayBackEnded(self): self.onPlayBackStopped() #Attention pas de stop, si on lance une seconde video sans fermer la premiere def onPlayBackStopped(self): VSlog('player stoped') self.playBackStoppedEventReceived = True #calcul le temp de lecture pourcent = 0 if self.totalTime > 0: pourcent = float('%.2f' % (self.currentTime / self.totalTime)) if (pourcent > 0.90): # Marqué VU dans la BDD Vstream cGui().setWatched() # Marqué VU dans les comptes perso try: tmdb_session = self.ADDON.getSetting('tmdb_session') if tmdb_session: self.__getWatchlist('tmdb') bstoken = self.ADDON.getSetting('bstoken') if bstoken: self.__getWatchlist('trakt') except: pass #xbmc.executebuiltin('Container.Refresh') def onPlayBackStarted(self): VSlog('player started') #Si on recoit une nouvelle fois l'event, c'est que ca buggue, on stope tout if self.playBackEventReceived: self.forcestop = True return self.playBackEventReceived = True def __getWatchlist(self, sAction): if sAction == 'tmdb': plugins = __import__('resources.sites.themoviedb_org', fromlist=['themoviedb_org']) function = getattr(plugins, 'getWatchlist') function() elif sAction == 'trakt': #plugins = __import__('resources.lib.trakt', fromlist=['cTrakt']) plugins = __import__('resources.lib.trakt', fromlist=['trakt']).cTrakt() function = getattr(plugins, 'getWatchlist') function() return def __getPlayerType(self): sPlayerType = self.ADDON.getSetting('playerType') try: if (sPlayerType == '0'): VSlog('playertype from config: auto') return xbmc.PLAYER_CORE_AUTO if (sPlayerType == '1'): VSlog('playertype from config: mplayer') return xbmc.PLAYER_CORE_MPLAYER if (sPlayerType == '2'): VSlog('playertype from config: dvdplayer') return xbmc.PLAYER_CORE_DVDPLAYER except: return False def enable_addon(self, addon): #import json #sCheck = {'jsonrpc': '2.0','id': 1,'method': 'Addons.GetAddonDetails','params': {'addonid':'inputstream.adaptive','properties': ['enabled']}} #response = xbmc.executeJSONRPC(json.dumps(sCheck)) #data = json.loads(response) #if not 'error' in data.keys(): #if data['result']['addon']['enabled'] == False: if xbmc.getCondVisibility( 'System.HasAddon(inputstream.adaptive)') == 0: do_json = '{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{"addonid":"inputstream.adaptive","enabled":true}}' query = xbmc.executeJSONRPC(do_json) VSlog("Activation d'inputstream.adaptive") else: VSlog('inputstream.adaptive déjà activé')
class cHome: ADDON = addon() def load(self): oGui = cGui() if (self.ADDON.getSetting('home_update') == 'true'): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir( SITE_IDENTIFIER, 'showUpdate', '%s (%s)' % (self.ADDON.VSlang(30418), self.ADDON.getSetting('service_futur')), 'update.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir(SITE_IDENTIFIER, 'showMovies', self.ADDON.VSlang(30120), 'films.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir(SITE_IDENTIFIER, 'showSearchText', self.ADDON.VSlang(30076), 'search.png', oOutputParameterHandler) if (self.ADDON.getSetting("history-view") == 'true'): oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir('cHome', 'showHistory', self.ADDON.VSlang(30308), 'annees.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir(SITE_IDENTIFIER, 'showParentalCode', '[COLOR gold]Contrôle Parental[/COLOR]', 'update.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir('cFav', 'getFavourites', self.ADDON.VSlang(30207), 'mark.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir('globalSources', 'globalSources', self.ADDON.VSlang(30138), 'host.png', oOutputParameterHandler) view = False if (self.ADDON.getSetting("active-view") == 'true'): view = self.ADDON.getSetting('accueil-view') oGui.setEndOfDirectory(view) def showUpdate(self): try: from resources.lib.about import cAbout cAbout().checkdownload() except: pass return def showMovies(self): oGui = cGui() oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_NEWS') oGui.addDir( SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.ADDON.VSlang(30120), self.ADDON.VSlang(30101)), 'news.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_HD') oGui.addDir( SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.ADDON.VSlang(30120), self.ADDON.VSlang(30160)), 'hd.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_GENRES') oGui.addDir( SITE_IDENTIFIER, 'callpluging', '%s (%s)' % (self.ADDON.VSlang(30120), self.ADDON.VSlang(30105)), 'genres.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'MOVIE_MOVIE') oGui.addDir(SITE_IDENTIFIER, 'callpluging', self.ADDON.VSlang(30138), 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory() # def showSources(self): # oGui = cGui() # oPluginHandler = cPluginHandler() # aPlugins = oPluginHandler.getAvailablePlugins() # for aPlugin in aPlugins: # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') # icon = 'sites/%s.png' % (aPlugin[1]) # oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler) # oGui.setEndOfDirectory() def showSearchText(self): oGui = cGui() sSearchText = oGui.showKeyBoard() if sSearchText: self.showSearch(sSearchText) oGui.setEndOfDirectory() else: return False def showSearch(self, searchtext=cInputParameterHandler().getValue('searchtext')): if not searchtext: return self.showSearchText() #n'existe plus mais pas sure. #xbmcgui.Window(10101).clearProperty('search_text') window(10101).clearProperty('search_text') oGui = cGui() #print xbmc.getInfoLabel('ListItem.Property(Category)') oGui.addText('globalSearch', self.ADDON.VSlang(30077) % (searchtext), 'none.png') #utilisation de guielement pour ajouter la bonne catégories oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oOutputParameterHandler.addParameter('searchtext', searchtext) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.ADDON.VSlang(30078)) oGuiElement.setFileName(self.ADDON.VSlang(30078)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) #oGuiElement.setThumbnail(sThumbnail) #oGuiElement.setFanart(sFanart) oGuiElement.setCat(1) oGui.addFolder(oGuiElement, oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oOutputParameterHandler.addParameter('searchtext', searchtext) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.ADDON.VSlang(30079)) oGuiElement.setFileName(self.ADDON.VSlang(30079)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) #oGuiElement.setThumbnail(sThumbnail) #oGuiElement.setFanart(sFanart) oGuiElement.setCat(2) oGui.addFolder(oGuiElement, oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oOutputParameterHandler.addParameter('searchtext', searchtext) oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('showSearch') oGuiElement.setTitle(self.ADDON.VSlang(30080)) oGuiElement.setFileName(self.ADDON.VSlang(30080)) oGuiElement.setIcon('search.png') oGuiElement.setMeta(0) #oGuiElement.setThumbnail(sThumbnail) #oGuiElement.setFanart(sFanart) oGuiElement.setCat(3) oGui.addFolder(oGuiElement, oOutputParameterHandler) oGui.setEndOfDirectory() def showHistory(self): oGui = cGui() row = cDb().get_history() if row: oGui.addText(SITE_IDENTIFIER, self.ADDON.VSlang(30416)) else: oGui.addText(SITE_IDENTIFIER) for match in row: oOutputParameterHandler = cOutputParameterHandler() #code to get type with disp type = self.ADDON.getSetting('search' + match[2][-1:] + '_type') if type: oOutputParameterHandler.addParameter('type', type) #xbmcgui.Window(10101).setProperty('search_type', type) window(10101).setProperty('search_type', type) oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oOutputParameterHandler.addParameter('searchtext', match[1]) #oOutputParameterHandler.addParameter('disp', match[2]) #oOutputParameterHandler.addParameter('readdb', 'False') oGuiElement = cGuiElement() oGuiElement.setSiteName('globalSearch') oGuiElement.setFunction('globalSearch') oGuiElement.setTitle("- " + match[1]) oGuiElement.setFileName(match[1]) oGuiElement.setCat(match[2]) oGuiElement.setIcon("search.png") oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler, SITE_IDENTIFIER, 'cHome', 'delSearch', self.ADDON.VSlang(30412)) oGui.addFolder(oGuiElement, oOutputParameterHandler) if row: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://kodistream') oGui.addDir(SITE_IDENTIFIER, 'delSearch', self.ADDON.VSlang(30413), 'search.png', oOutputParameterHandler) oGui.setEndOfDirectory() def delSearch(self): cDb().del_history() return True def callpluging(self): oGui = cGui() oInputParameterHandler = cInputParameterHandler() sSiteUrl = oInputParameterHandler.getValue('siteUrl') oPluginHandler = cSiteHandler() aPlugins = oPluginHandler.getAvailablePlugins(sSiteUrl) for aPlugin in aPlugins: try: #exec "import "+aPlugin[1] #exec "sSiteUrl = "+aPlugin[1]+"."+sVar oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', aPlugin[0]) icon = 'sites/%s.png' % (aPlugin[2]) oGui.addDir(aPlugin[2], aPlugin[3], aPlugin[1], icon, oOutputParameterHandler) except: pass oGui.setEndOfDirectory()