def salvar_busquedas(params,url="",category=""): if url == "" and category == "": channel = params.channel url = params.url else: channel = params.get("channel") limite_busquedas = ( 10, 20, 30, 40, )[ int( config.get_setting( "limite_busquedas" ) ) ] matches = [] try: presets = config.get_setting("presets_buscados") if "|" in presets: presets = matches = presets.split("|") for count, preset in enumerate( presets ): if url in preset: del presets[ count ] break if len( presets ) >= limite_busquedas: presets = presets[ : limite_busquedas - 1 ] except: presets = "" presets2 = "" if len(matches)>0: for preset in presets: presets2 = presets2 + "|" + preset presets = url + presets2 elif presets != "": presets = url + "|" + presets else: presets = url config.set_setting("presets_buscados",presets)
def ok_Button_click(item): global params itemlist = [] list_controls = params["list_controls"] dict_values = params["dict_values"] channel = os.path.basename(params["channelpath"]).replace(".py", "") callback = params["callback"] item = params["item"] if callback is None: for v in dict_values: config.set_setting(v,dict_values[v], channel) exec "from channels import " + channel + " as channelmodule" exec "itemlist = channelmodule.mainlist(Item())" return itemlist else: exec "from channels import " + channel + " as cb_channel" exec "itemlist = cb_channel." + callback + "(item,dict_values)" if not type(itemlist)== list: exec "from channels import " + channel + " as channelmodule" exec "itemlist = channelmodule.mainlist(Item())" return itemlist
def check_for_library_format(): logger.info() if config.get_setting("library_version") == 'v4': p_dialog = platformtools.dialog_progress_bg( "Stream On Demand", "Conversione della libreria al nuovo formato...") p_dialog.update(0) import glob for filename in glob.glob(filetools.join(library.MOVIES_PATH, u'/*/*')): os.rename(filename, filename.replace('.nfo', '.sod')) p_dialog.update(50) for filename in glob.glob(filetools.join(library.TVSHOWS_PATH, u'/*/*')): os.rename(filename, filename.replace('.nfo', '.sod')) p_dialog.update(100) xbmc.sleep(2000) p_dialog.close() config.set_setting("library_version", "v5") return
def start(): tecla_guardada = config.get_setting("keymap_edit", "editor_keymap") nuevakey = KeyListener().record_key() if nuevakey and tecla_guardada != nuevakey: from core import filetools from platformcode import platformtools import xbmc file_xml = "special://profile/keymaps/deportesalacarta.xml" data = '<keymap><global><keyboard><key id="%s">' % nuevakey + 'runplugin(plugin://' \ 'plugin.video.deportesalacarta/?ewogICAgImFjdGlvbiI6ICJzdGFydCIsIAogICAgImNoYW5uZWwiOiAibWF0Y2hjZ' \ 'W50ZXIiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D))</key></keyboard></global></keymap>' filetools.write(xbmc.translatePath(file_xml), data) platformtools.dialog_notification("Tecla guardada", "Reinicia Kodi para que se apliquen los cambios") from core import scrapertools config.set_setting("keymap_edit", nuevakey, "editor_keymap") file_idioma = filetools.join(config.get_runtime_path(), 'resources', 'language', 'Spanish', 'strings.xml') data = filetools.read(file_idioma) value_xml = scrapertools.find_single_match(data, '<string id="31100">([^<]+)<') if "tecla" in value_xml: data = data.replace(value_xml, 'Cambiar tecla/botón para abrir la ventana (Guardada: %s)' % nuevakey) elif "key" in value_xml: data = data.replace(value_xml, 'Change key/button to open the window (Saved: %s)' % nuevakey) else: data = data.replace(value_xml, 'Cambiamento di chiave/pulsante per aprire la finestra (Salvato: %s)' % nuevakey) filetools.write(file_idioma, data) return
def borrar_busqueda(item): itemlist = [] presets = config.get_setting("presets_buscados").split("|") presets.remove(item.url) config.set_setting("presets_buscados",'|'.join(presets)) from core import guitools guitools.Refresh()
def ask_set_content(flag, silent=False): logger.info() logger.debug("videolibrary_kodi_flag %s" % config.get_setting("videolibrary_kodi_flag")) logger.debug("videolibrary_kodi %s" % config.get_setting("videolibrary_kodi")) def do_config(): logger.debug("hemos aceptado") config.set_setting("videolibrary_kodi", True) set_content("movie", silent=True) set_content("tvshow", silent=True) add_sources(config.get_setting("videolibrarypath")) add_sources(config.get_setting("downloadpath")) if not silent: heading = "Alfa Auto-configuración" linea1 = "¿Desea que Alfa auto-configure la videteoca de Kodi?" linea2 = "Si pulsa 'No' podra hacerlo desde 'Configuración > Preferencia > Rutas'." if platformtools.dialog_yesno(heading, linea1, linea2): do_config() else: # no hemos aceptado config.set_setting("videolibrary_kodi", False) else: do_config() config.set_setting("videolibrary_kodi_flag", flag)
def search_trailer(item): config.set_setting("subtitulo", "false") item.channel = "trailertools" item.action ="buscartrailer" item.contextual=True run(item) return
def mainlist(item): logger.info() itemlist = [] item.text_color = color1 # Resetear host y comprobacion de error en https (por si se actualiza Kodi) config.set_setting("url_error", False, "descargasmix") host = config.set_setting("host", "https://descargasmix.com", "descargasmix") host_check = get_data(host, True) if host_check: config.set_setting("host", host_check, "descargasmix") itemlist.append(item.clone(title="Películas", action="lista", fanart="http://i.imgur.com/c3HS8kj.png")) itemlist.append(item.clone(title="Series", action="lista_series", fanart="http://i.imgur.com/9loVksV.png")) itemlist.append(item.clone(title="Documentales", action="entradas", url="%s/documentales/" % host, fanart="http://i.imgur.com/Q7fsFI6.png")) itemlist.append(item.clone(title="Anime", action="entradas", url="%s/anime/" % host, fanart="http://i.imgur.com/whhzo8f.png")) itemlist.append(item.clone(title="Deportes", action="entradas", url="%s/deportes/" % host, fanart="http://i.imgur.com/ggFFR8o.png")) itemlist.append(item.clone(title="", action="")) itemlist.append(item.clone(title="Buscar...", action="search")) itemlist.append(item.clone(action="configuracion", title="Configurar canal...", text_color="gold", folder=False)) return itemlist
def search_trailer(item): config.set_setting("subtitulo", False) item.channel = "trailertools" item.action = "buscartrailer" item.contextual = True run(item) return
def search_trailer(item): config.set_setting("subtitulo", "false") import sys item.channel = "trailertools" item.action ="buscartrailer" run(item) return
def get_api_keys(): logger.info() api_login = config.get_setting('api_login', __file__) api_key = config.get_setting('api_key', __file__) if not api_key or not api_login: login() data = httptools.downloadpage('https://openload.co/account').data post = { 'FTPKey[password]': config.get_setting('password', __file__), '_csrf': scrapertools.find_single_match( data, '<input type="hidden" name="_csrf" value="([^"]+)">') } data = httptools.downloadpage('https://openload.co/account', post=post).data api_login = scrapertools.find_single_match( data, '<tr><td>ID:</td><td>([^<]+)</td></tr>') api_key = scrapertools.find_single_match( data, 'Your FTP Password/API Key is: ([^<]+) </div>') config.set_setting('api_login', api_login, __file__) config.set_setting('api_key', api_key, __file__) return api_login, api_key
def do_config(): logger.debug("hemos aceptado") config.set_setting("videolibrary_kodi", True) set_content("movie", silent=True) set_content("tvshow", silent=True) add_sources(config.get_setting("videolibrarypath")) add_sources(config.get_setting("downloadpath"))
def search_trailer(item): config.set_setting("subtitulo", "false") import sys item.channel = "trailertools" item.action = "buscartrailer" run(item) return
def get_data(url_orig): try: if config.get_setting("url_error", "porntrex"): raise Exception response = httptools.downloadpage(url_orig) if not response.data or "urlopen error [Errno 1]" in str( response.code): raise Exception except: config.set_setting("url_error", True, "porntrex") import random server_random = ['nl', 'de', 'us'] server = server_random[random.randint(0, 2)] url = "https://%s.hideproxy.me/includes/process.php?action=update" % server post = "u=%s&proxy_formdata_server=%s&allowCookies=1&encodeURL=0&encodePage=0&stripObjects=0&stripJS=0&go=" \ % (urllib.quote(url_orig), server) while True: response = httptools.downloadpage(url, post, follow_redirects=False) if response.headers.get("location"): url = response.headers["location"] post = "" else: break return response.data
def save(item, dict_data_saved): ''' Guarda los datos de la ventana de configuracion :param item: item :param dict_data_saved: dict :return: ''' logger.info() global autoplay_node if not autoplay_node: # Obtiene el nodo AUTOPLAY desde el json autoplay_node = jsontools.get_node_from_data_json( 'autoplay', 'AUTOPLAY') channel_node = autoplay_node.get(item.from_channel) config.set_setting("filter_languages", dict_data_saved.pop("language"), item.from_channel) channel_node['settings'] = dict_data_saved result, json_data = jsontools.update_json_data(autoplay_node, 'autoplay', 'AUTOPLAY') return result
def sub(item): itemlist = [] if item.category != "asiateam": sub_file = download_subtitles(item.category) if sub_file != "": config.set_setting("subtitulo", "true") else: mensaje = xbmcgui.Dialog() resultado = mensaje.ok( 'Subtítulo no disponible en Asia-Team', 'No se han encontrado subtítulos para este archivo', 'Para asegurarse, pruebe a buscar en Xbmc Subtitles') # Los vídeos de Asia-Team están protegidos con el password "www.Asia-Team.net" itemlist.append( Item(channel=__channel__, action="play", title=item.title, url=item.url, thumbnail=item.thumbnail, plot=item.plot, server=item.extra, folder=False, password="******")) return itemlist
def channel_status(item, dict_values): try: for v in dict_values: if v == "all_channels": import channelselector from core import channeltools logger.info("Todos los canales | Estado seleccionado: %s" % str(dict_values[v]).lower()) if str(dict_values[v]) != "0": channel_list = channelselector.filterchannels("allchannelstatus") excluded_channels = ['tengourl', 'buscador', 'libreria', 'configuracion', 'novedades', 'personal', 'ayuda', 'descargas'] for channel in channel_list: if channel.channel not in excluded_channels: channel_parameters = channeltools.get_channel_parameters(channel.channel) new_status_all_default = None new_status_all = None new_status_all_default = channel_parameters["active"] # Opcion Activar todos if str(dict_values[v]) == "1": new_status_all = "true" # Opcion Desactivar todos if str(dict_values[v]) == "2": new_status_all = "false" # Opcion Recuperar estado por defecto if str(dict_values[v]) == "3": # Si tiene "enabled" en el json es porque el estado no es el del xml if config.get_setting("enabled", channel.channel): new_status_all = new_status_all_default # Si el canal no tiene "enabled" en el json no se guarda, se pasa al siguiente else: continue # Se guarda el estado del canal if new_status_all is not None: config.set_setting("enabled", new_status_all, channel.channel) break else: continue else: logger.info("Canal: %s | Estado: %s" % (v, str(dict_values[v]).lower())) config.set_setting("enabled", str(dict_values[v]).lower(), v) platformtools.itemlist_update(Item(channel=CHANNELNAME, action="mainlist")) except: import traceback logger.info("Detalle del error: %s" % traceback.format_exc()) platformtools.dialog_notification("Error", "Se ha producido un error al guardar")
def ok(self): pageurl = self.e.get() print "Pagina", pageurl output = self.e2.get() print "Descargar en", output proxysocks = self.e3.get() print "Proxy SOCKS", proxysocks import os confpath = os.path.join( config.get_data_path() , "descargar-telefe.conf" ) try: fichero = open(confpath,"w") fichero.write(output) fichero.close() except: print "Error al grabar "+confpath pass # Cierra el gui self.top.destroy() # Desactiva la cache config.set_setting("cache.mode","2") # Obtiene el titulo y la URL del vídeo windows_mode = os.path.exists("rtmpdump.exe") from core import scrapertools data = scrapertools.cachePage(pageurl) patron = "<title>(.*?)</title>" matches = re.compile(patron,re.DOTALL).findall(data) if len(matches)>0: titulo = matches[0] print "Titulo = "+titulo from servers import telefe video_urls = telefe.get_video_url(pageurl,page_data=data) url = video_urls[0][1] import os salida = os.path.join( output , "%s.mp4" % self.clean_title(titulo,windows_mode) ) print salida proxyparameter = "" if proxysocks!="": proxyparameter = " -S "+proxysocks # Invoca a rtmpdump if windows_mode: print "Comando: "+'./rtmpdump.exe -r "'+url+'" -o "'+salida+'" --live' + proxyparameter import shlex, subprocess args = shlex.split('./rtmpdump.exe -r "'+url+'" -o "'+salida+'" --live' + proxyparameter) p = subprocess.call(args) # Success! else: print "Comando: "+'./rtmpdump -r "'+url+'" -o "'+salida+'" --live' + proxyparameter import shlex, subprocess args = shlex.split('./rtmpdump -r "'+url+'" -o "'+salida+'" --live' + proxyparameter) p = subprocess.call(args) # Success!
def borrar_busqueda(item): logger.info("[buscador.py] borrar_busqueda") itemlist = [] presets = config.get_setting("presets_buscados", "buscador" ).split("|") presets.remove(item.url) config.set_setting("presets_buscados",'|'.join(presets), "buscador") itemlist.append( Item(channel="launcher", action="refresh", title="Registro borrado")) return itemlist
def CambiarMultithread(item): itemlist=[] if config.get_setting("buscador_multithread") =="1": config.set_setting("buscador_multithread",'0') else: config.set_setting("buscador_multithread",'1') from core import guitools guitools.Refresh()
def CambiarModo(item): itemlist=[] if config.get_setting("buscador_resultados") =="1": config.set_setting("buscador_resultados",'0') else: config.set_setting("buscador_resultados",'1') from core import guitools guitools.Refresh()
def save_settings(item, dict_values): progreso = platformtools.dialog_progress("Guardando configuración...", "Espere un momento por favor.") n = len(dict_values) for i, v in enumerate(dict_values): progreso.update((i * 100) / n, "Guardando configuración...") config.set_setting("include_in_global_search", dict_values[v], v) progreso.close()
def salvar_busquedas(item): limite_busquedas =10 presets = config.get_setting("presets_buscados").split("|") if item.url in presets: presets.remove(item.url) presets.insert(0,item.url) if limite_busquedas>0: presets = presets[:limite_busquedas] config.set_setting("presets_buscados",'|'.join(presets))
def onClick(self, controlId): if controlId == OPTION_PANEL: xbmc.executebuiltin('xbmc.PlayMedia(Stop)') self.list = self.getControl(6) selecitem = self.list.getSelectedItem() url = selecitem.getProperty("url") data = get_data(url, cookies) url = servertools.findvideosbyserver(data, "p2p") if len(url) > 1: enlaces = [] for u in url: enlaces.append(u[1]) xbmc.log(str(enlaces)) selection = xbmcgui.Dialog().select("Selecciona un enlace", enlaces) if selection > 0: url = url[selection][1] elif url: url = url[0][1] #Creamos el item para platformtools item = Item() item.fulltitle = self.fulltitle item.url = url + "|" + item.fulltitle item.server = "p2p" config.set_setting("arenavision_play", False, "arenavision") from threading import Thread t = Thread(target=platformtools.play_video, args=[item]) t.start() close = False while True: xbmc.sleep(500) try: if not t.is_alive() and not config.get_setting( "arenavision_play", "arenavision"): break elif not t.is_alive() and config.get_setting( "arenavision_play", "arenavision"): xbmc.executebuiltin('Action(PreviousMenu)') break except: if not t.isAlive() and not config.get_setting( "arenavision_play", "arenavision"): break elif not t.isAlive() and config.get_setting( "arenavision_play", "arenavision"): xbmc.executebuiltin('Action(PreviousMenu)') break elif controlId == OPTIONS_OK or controlId == 99: global select, ventana borrar = [select, ventana] for window in borrar: window.close() del window xbmc.sleep(300) xbmc.executebuiltin('Action(PreviousMenu)')
def search(item,texto): campo = item.url.split("=")[0] codigo = item.url.split("=")[1] valor = config.get_setting(campo) if valor != texto: config.set_setting(campo,texto) return respuesta()
def Activar_Novedades(params,activar,category): if activar == "false": config.set_setting("activar","true") else: config.set_setting("activar","false") print "opcion menu novedades :%s" %config.get_setting("activar") #xbmc.executebuiltin('Container.Update') xbmc.executebuiltin('Container.Refresh')
def borrar_busqueda(item): logger.info("[buscador.py] borrar_busqueda") itemlist = [] presets = config.get_setting("presets_buscados").split("|") presets.remove(item.url) config.set_setting("presets_buscados", '|'.join(presets)) itemlist.append( Item(channel="launcher", action="refresh", title="Registro borrado")) return itemlist
def search(item, texto): campo = item.url.split("=")[0] codigo = item.url.split("=")[1] valor = config.get_setting(campo) if valor != texto: config.set_setting(campo, texto) return respuesta()
def salvar_busquedas(item): logger.info("[buscador.py] salvar_busquedas") limite_busquedas =int(config.get_setting( "limite_busquedas", "" )) presets = config.get_setting("presets_buscados", "buscador" ).split("|") if item.url in presets: presets.remove(item.url) presets.insert(0,item.url) if limite_busquedas>0: presets = presets[:limite_busquedas] config.set_setting("presets_buscados",'|'.join(presets), "buscador")
def channel_status(item, dict_values): try: for k in dict_values: if k == "all_channels": logger.info("Todos los canales | Estado seleccionado: %s" % dict_values[k]) if dict_values[k] != 0: excluded_channels = ['tengourl', 'buscador', 'biblioteca', 'configuracion', 'novedades', 'personal', 'ayuda', 'descargas'] for channel in item.channel_list: if channel.channel not in excluded_channels: from core import channeltools channel_parameters = channeltools.get_channel_parameters(channel.channel) new_status_all = None new_status_all_default = channel_parameters["active"] # Opcion Activar todos if dict_values[k] == 1: new_status_all = True # Opcion Desactivar todos if dict_values[k] == 2: new_status_all = False # Opcion Recuperar estado por defecto if dict_values[k] == 3: # Si tiene "enabled" en el json es porque el estado no es el del xml if config.get_setting("enabled", channel.channel): new_status_all = new_status_all_default # Si el canal no tiene "enabled" en el json no se guarda, se pasa al siguiente else: continue # Se guarda el estado del canal if new_status_all is not None: config.set_setting("enabled", new_status_all, channel.channel) break else: continue else: logger.info("Canal: %s | Estado: %s" % (k, dict_values[k])) config.set_setting("enabled", dict_values[k], k) logger.info("el valor esta como %s " % config.get_setting("enabled", k)) platformtools.itemlist_update(Item(channel=CHANNELNAME, action="mainlist")) except: import traceback logger.error("Detalle del error: %s" % traceback.format_exc()) platformtools.dialog_notification("Error", "Se ha producido un error al guardar")
def salvar_busquedas(item): logger.info("[buscador.py] salvar_busquedas") limite_busquedas = int(config.get_setting("limite_busquedas")) presets = config.get_setting("presets_buscados").split("|") logger.info(len(presets)) if item.url in presets: presets.remove(item.url) presets.insert(0, item.url) if limite_busquedas > 0: presets = presets[:limite_busquedas] config.set_setting("presets_buscados", '|'.join(presets))
def CambiarModo(item): itemlist=[] if config.get_setting("buscador_resultados", "buscador") =="1": config.set_setting("buscador_resultados",'0', "buscador") itemlist.append( Item(channel="launcher", action="refresh", title="Cambiado a: Todo junto")) else: config.set_setting("buscador_resultados",'1', "buscador") itemlist.append( Item(channel="launcher", action="refresh", title="Cambiado a: Por canales")) return itemlist
def trailer(item): logger.info("streamondemand.platformcode.xbmctools trailer") config.set_setting("subtitulo", "false") xbmc.executebuiltin( "XBMC.RunPlugin(%s?channel=%s&action=%s&category=%s&title=%s&url=%s&thumbnail=%s&plot=%s&server=%s)" % (sys.argv[0], "trailertools", "buscartrailer", urllib.quote_plus(item.category), urllib.quote_plus(item.fulltitle), urllib.quote_plus(item.url), urllib.quote_plus( item.thumbnail), urllib.quote_plus(""))) return
def save_search(text): saved_searches_limit = int((10, 20, 30, 40,)[int(config.get_setting("saved_searches_limit", "buscador"))]) saved_searches_list = list(config.get_setting("saved_searches_list", "buscador")) if text in saved_searches_list: saved_searches_list.remove(text) saved_searches_list.insert(0, text) config.set_setting("saved_searches_list", saved_searches_list[:saved_searches_limit], "buscador")
def ValidatePrefs(): Log.Info("Pelisalacarta: ValidatePref") global ADULT_MODE validate = True # Control parental adult_aux_intro_password = config.get_setting("adult_aux_intro_password") pass_ok = False if adult_aux_intro_password: # Hemos accedido a la seccion de Canales para adultos adult_password = config.get_setting("adult_password") if not adult_password: adult_password = "******" if adult_aux_intro_password == adult_password: # La contraseña de acceso es correcta pass_ok= True # Cambio de contraseña new_password1 = config.get_setting("adult_aux_new_password1") new_password2 = config.get_setting("adult_aux_new_password2") if new_password1 or new_password2: if new_password1 == new_password2: config.set_setting("adult_password",new_password1) else: Log.Info("Pelisalacarta - ValidatePref: Los campos 'Nueva contraseña' y 'Confirmar nueva contraseña' no coinciden.") validate = False else: Log.Info("Pelisalacarta - ValidatePref: La contraseña no es correcta.") validate = False if ADULT_MODE != config.get_setting("adult_mode"): # El modo adulto ha cambiado if pass_ok: ADULT_MODE = config.get_setting("adult_mode") else: config.set_setting("adult_mode", ADULT_MODE) validate = False # Borramos settings auxiliares config.set_setting('adult_aux_new_password1', '') config.set_setting('adult_aux_new_password2', '') config.set_setting('adult_aux_intro_password', '') """ if validate: # Si es necesario se pueden hacer aqui otras validaciones ... validate = True / False """ return validate
def mainlist(item): logger.info() itemlist = [] config.set_setting("url_error", False, "cumlouder") itemlist.append(item.clone(title = "Últimos videos", action = "videos" , url = "http://www.cumlouder.com/")) itemlist.append(item.clone(title = "Categorias" , action = "categorias" , url = "http://www.cumlouder.com/categories/")) itemlist.append(item.clone(title = "Pornstars" , action = "pornstars_list", url = "http://www.cumlouder.com/girls/")) itemlist.append(item.clone(title = "Buscar" , action = "search" , url = "http://www.cumlouder.com/search?q=%s")) return itemlist
def filtro(item): logger.info("deportesalacarta.channels.agendaglobal filtros") text = "" text = config.get_setting("last_search_" + item.filtro, item.channel) texto = platformtools.dialog_input(default=text, heading=item.title) if texto is None: return config.set_setting("last_search_" + item.filtro, texto, item.channel) return search(item, texto)
def CambiarMultithread(item): itemlist=[] if config.get_setting("buscador_multithread", "buscador") =="1": config.set_setting("buscador_multithread",'0', "buscador") itemlist.append( Item(channel="launcher", action="refresh", title="Multithread Desactivado")) else: config.set_setting("buscador_multithread",'1', "buscador") itemlist.append( Item(channel="launcher", action="refresh", title="Multithread Activado")) return itemlist
def ValidatePrefs(): Log.Info("Pelisalacarta: ValidatePref") global ADULT_MODE validate = True # Control parental adult_aux_intro_password = config.get_setting("adult_aux_intro_password") pass_ok = False if adult_aux_intro_password: # Hemos accedido a la seccion de Canales para adultos adult_password = config.get_setting("adult_password") if not adult_password: adult_password = "******" if adult_aux_intro_password == adult_password: # La contraseña de acceso es correcta pass_ok = True # Cambio de contraseña new_password1 = config.get_setting("adult_aux_new_password1") new_password2 = config.get_setting("adult_aux_new_password2") if new_password1 or new_password2: if new_password1 == new_password2: config.set_setting("adult_password", new_password1) else: Log.Info( "Pelisalacarta - ValidatePref: Los campos 'Nueva contraseña' y 'Confirmar nueva contraseña' no coinciden." ) validate = False else: Log.Info( "Pelisalacarta - ValidatePref: La contraseña no es correcta.") validate = False if ADULT_MODE != config.get_setting("adult_mode"): # El modo adulto ha cambiado if pass_ok: ADULT_MODE = config.get_setting("adult_mode") else: config.set_setting("adult_mode", ADULT_MODE) validate = False # Borramos settings auxiliares config.set_setting('adult_aux_new_password1', '') config.set_setting('adult_aux_new_password2', '') config.set_setting('adult_aux_intro_password', '') """ if validate: # Si es necesario se pueden hacer aqui otras validaciones ... validate = True / False """ return validate
def setup(item): campo = item.url.split("=")[0] codigo = item.url.split("=")[1] valor = config.get_setting(campo) if item.extra == "bool": if valor == "true": valor="false" else: valor = "true" config.set_setting(campo,valor) return respuesta()
def DesactivarTodos(item): itemlist=[] ConfigCanales = [] if config.get_setting("canales_buscador"): ConfigCanales.extend(config.get_setting("canales_buscador").split("|")) for x, Config in enumerate(ConfigCanales): ConfigCanales[x] = ConfigCanales[x].split(",")[0] +","+ "0" +"," + ConfigCanales[x].split(",")[2]+"," + ConfigCanales[x].split(",")[3] config.set_setting("canales_buscador",'|'.join(ConfigCanales)) from core import guitools guitools.Refresh()
def GuardarTiempo(Canal,Tiempo): if not config.get_setting("canales_buscador"): Canales(Item()) ConfigCanales = config.get_setting("canales_buscador").split("|") for x, Config in enumerate(ConfigCanales): if Canal in Config: IndexConfig = x break Busquedas = int(ConfigCanales[x].split(",")[2]) + 1 Tiempos = float(ConfigCanales[x].split(",")[3]) + Tiempo ConfigCanales[x] = ConfigCanales[x].split(",")[0] +","+ ConfigCanales[x].split(",")[1]+"," + str(Busquedas)+"," + str(Tiempos) config.set_setting("canales_buscador",'|'.join(ConfigCanales))
def DesactivarTodos(item): logger.info("[buscador.py] DesactivarTodos") itemlist=[] ConfigCanales = [] if config.get_setting("canales_buscador", "buscador"): ConfigCanales.extend(config.get_setting("canales_buscador", "buscador").split("|")) for x, Config in enumerate(ConfigCanales): ConfigCanales[x] = ConfigCanales[x].split(",")[0] +","+ "0" +"," + ConfigCanales[x].split(",")[2]+"," + ConfigCanales[x].split(",")[3] config.set_setting("canales_buscador",'|'.join(ConfigCanales), "buscador") itemlist.append( Item(channel="launcher", action="refresh", title="Canales Activados")) return itemlist
def Reset(item): itemlist=[] ConfigCanales = [] if config.get_setting("canales_buscador"): ConfigCanales.extend(config.get_setting("canales_buscador").split("|")) IndexConfig = -1 for x, Config in enumerate(ConfigCanales): ConfigCanales[x] = ConfigCanales[x].split(",")[0] + "," + ConfigCanales[x].split(",")[1] + "," +"0" + "," +"0" config.set_setting("canales_buscador",'|'.join(ConfigCanales)) from core import guitools guitools.Dialog_OK("Pelisalacarta","Estadisticas reseteadas" )
def ActivarDesactivar(item): IndexConfig, ConfigCanales = ExtraerIndice(item.url) Activo = ConfigCanales[IndexConfig].split(",")[1] if Activo == "1": Activo ="0" else: Activo ="1" ConfigCanales[IndexConfig] = ConfigCanales[IndexConfig].split(",")[0] +","+ Activo+"," + ConfigCanales[IndexConfig].split(",")[2]+"," + ConfigCanales[IndexConfig].split(",")[3] config.set_setting("canales_buscador",'|'.join(ConfigCanales)) itemlist=[] from core import guitools guitools.Refresh()
def set_Subtitle(): logger.info("[subtitletools] set_Subtitle") exts = [".srt", ".sub", ".txt", ".smi", ".ssa", ".ass"] subtitle_folder_path = os.path.join(config.get_data_path(), "subtitles") subtitle_type = config.get_setting("subtitle_type") if subtitle_type == "2": subtitle_path = config.get_setting("subtitlepath_file") logger.info("Con subtitulo : " + subtitle_path) xbmc.Player().setSubtitles(subtitle_path) else: if subtitle_type == "0": subtitle_path = config.get_setting("subtitlepath_folder") if subtitle_path == "": subtitle_path = subtitle_folder_path config.set_setting("subtitlepath_folder", subtitle_path) else: subtitle_path = config.get_setting("subtitlepath_keyboard") long = len(subtitle_path) if long > 0: if subtitle_path.startswith("http") or subtitle_path[long - 4, long] in exts: logger.info("Con subtitulo : " + subtitle_path) xbmc.Player().setSubtitles(subtitle_path) return else: subtitle_path = subtitle_folder_path config.set_setting("subtitlepath_keyboard", subtitle_path) import glob subtitle_name = config.get_setting("subtitle_name").replace("amp;", "") tvshow_title, season, episode = regex_tvshow(False, subtitle_name) try: if episode != "": Subnames = glob.glob( os.path.join( subtitle_path, "Tvshows", tvshow_title, "%s %sx%s" % (tvshow_title, season, episode) + "*.??.???", ) ) else: Subnames = glob.glob(os.path.join(subtitle_path, "Movies", subtitle_name + "*.??.???")) for Subname in Subnames: if os.path.splitext(Subname)[1] in exts: logger.info("Con subtitulo : " + os.path.split(Subname)[1]) xbmc.Player().setSubtitles((Subname)) except: logger.info("error al cargar subtitulos")
def Reset(item): logger.info("[buscador.py] Reset") itemlist=[] ConfigCanales = [] if config.get_setting("canales_buscador", "buscador"): ConfigCanales.extend(config.get_setting("canales_buscador", "buscador").split("|")) IndexConfig = -1 for x, Config in enumerate(ConfigCanales): ConfigCanales[x] = ConfigCanales[x].split(",")[0] + "," + ConfigCanales[x].split(",")[1] + "," +"0" + "," +"0" config.set_setting("canales_buscador",'|'.join(ConfigCanales), "buscador") itemlist.append( Item(channel="launcher", action="alert", title="Estadisticas reseteadas")) return itemlist
def __check_token(cls): # logger.info() if TOKEN == "": cls.__login() else: # si la fecha no se corresponde con la actual llamamos a refresh_token, ya que el token expira en 24 horas from time import gmtime, strftime current_date = strftime("%Y-%m-%d", gmtime()) if config.get_setting("tvdb_token_date", "") != current_date: # si se ha renovado el token grabamos la nueva fecha if cls.__refresh_token(): config.set_setting("tvdb_token_date", current_date)
def sub(item): itemlist = [] if item.category!="asiateam": sub_file=download_subtitles(item.category) if sub_file!="": config.set_setting("subtitulo", "true") else: mensaje = xbmcgui.Dialog() resultado = mensaje.ok('Subtítulo no disponible en Asia-Team', 'No se han encontrado subtítulos para este archivo' , 'Para asegurarse, pruebe a buscar en Xbmc Subtitles') itemlist.append( Item(channel=CHANNELNAME, action="play", title=item.title , url=item.url , thumbnail=item.thumbnail , plot=item.plot , server=item.extra ,folder=False) ) return itemlist