diff --git a/plugin.video.alfa/channels/autoplay.py b/plugin.video.alfa/channels/autoplay.py index 90e79826..d29dcb21 100644 --- a/plugin.video.alfa/channels/autoplay.py +++ b/plugin.video.alfa/channels/autoplay.py @@ -27,7 +27,7 @@ def context(): _context = "" if config.is_xbmc(): - _context = [{"title": "Configurar AutoPlay", + _context = [{"title": config.get_localized_string(60071), "action": "autoplay_config", "channel": "autoplay"}] return _context @@ -60,7 +60,7 @@ def show_option(channel, itemlist, text_color='yellow', thumbnail=None, fanart=N 'servidores y calidades favoritas. ' itemlist.append( Item(channel=__channel__, - title="Configurar AutoPlay", + title=config.get_localized_string(60071), action="autoplay_config", text_color=text_color, thumbnail=thumbnail, @@ -176,7 +176,7 @@ def start(itemlist, item): if 'context' not in item: item.context = list() if not filter(lambda x: x['action'] == 'autoplay_config', context): - item.context.append({"title": "Configurar AutoPlay", + item.context.append({"title": config.get_localized_string(60071), "action": "autoplay_config", "channel": "autoplay", "from_channel": channel_id}) @@ -330,20 +330,19 @@ def start(itemlist, item): # Si se han alcanzado el numero maximo de intentos de este servidor # preguntar si queremos seguir probando o lo ignoramos if max_intentos_servers[videoitem.server.lower()] == 0: - text = "Parece que los enlaces de %s no estan funcionando." % videoitem.server.upper() + text = config.get_localized_string(60072) % videoitem.server.upper() if not platformtools.dialog_yesno("AutoPlay", text, - "¿Desea ignorar todos los enlaces de este servidor?"): + config.get_localized_string(60073)): max_intentos_servers[videoitem.server.lower()] = max_intentos # Si no quedan elementos en la lista se informa if autoplay_elem == autoplay_list[-1]: - platformtools.dialog_notification('AutoPlay', 'No hubo enlaces funcionales') + platformtools.dialog_notification('AutoPlay', config.get_localized_string(60072)) else: - platformtools.dialog_notification('AutoPlay No Fue Posible', 'No Hubo Coincidencias') + platformtools.dialog_notification(config.get_localized_string(60074), config.get_localized_string(60075)) if new_options: - platformtools.dialog_notification("AutoPlay", "Nueva Calidad/Servidor disponible en la " - "configuracion", sound=False) + platformtools.dialog_notification("AutoPlay", config.get_localized_string(60076), sound=False) # Restaura si es necesario el valor previo de "Accion y Player Mode" en preferencias if user_config_setting_action != 2: @@ -415,8 +414,8 @@ def init(channel, list_servers, list_quality, reset=False): result, json_data = jsontools.update_node(autoplay_node, 'autoplay', 'AUTOPLAY') if not result: - heading = "Error al iniciar AutoPlay" - msj = "Consulte su log para obtener mas información." + heading = config.get_localized_string(60077) + msj = config.get_localized_string(60078) icon = 1 platformtools.dialog_notification(heading, msj, icon, sound=False) @@ -482,7 +481,7 @@ def autoplay_config(item): allow_option = True - active_settings = {"id": "active", "label": "AutoPlay (activar/desactivar la auto-reproduccion)", + active_settings = {"id": "active", "label": config.get_localized_string(60079), "color": "0xffffff99", "type": "bool", "default": False, "enabled": allow_option, "visible": allow_option} list_controls.append(active_settings) @@ -493,7 +492,7 @@ def autoplay_config(item): if not status_language: status_language = 0 - set_language = {"id": "language", "label": "Idioma para AutoPlay (Opcional)", "color": "0xffffff99", + set_language = {"id": "language", "label": config.get_localized_string(60080), "color": "0xffffff99", "type": "list", "default": 0, "enabled": "eq(-1,true)", "visible": True, "lvalues": get_languages(item.from_channel)} @@ -513,7 +512,7 @@ def autoplay_config(item): else: enabled = "eq(-3,true)" - custom_servers_settings = {"id": "custom_servers", "label": " Servidores favoritos", "color": "0xff66ffcc", + custom_servers_settings = {"id": "custom_servers", "label": config.get_localized_string(60081), "color": "0xff66ffcc", "type": "bool", "default": False, "enabled": enabled, "visible": True} list_controls.append(custom_servers_settings) if dict_values['active'] and enabled: @@ -526,7 +525,7 @@ def autoplay_config(item): default = num - 1 if default > len(server_list) - 1: default = 0 - set_servers = {"id": "server_%s" % num, "label": u" \u2665 Servidor Favorito %s" % num, + set_servers = {"id": "server_%s" % num, "label": u" \u2665" + config.get_localized_string(60082) % num, "color": "0xfffcab14", "type": "list", "default": default, "enabled": "eq(-%s,true)+eq(-%s,true)" % (pos1, num), "visible": True, "lvalues": server_list} @@ -544,7 +543,7 @@ def autoplay_config(item): else: enabled = "eq(-7,true)" - custom_quality_settings = {"id": "custom_quality", "label": " Calidades Favoritas", "color": "0xff66ffcc", + custom_quality_settings = {"id": "custom_quality", "label": config.get_localized_string(60083), "color": "0xff66ffcc", "type": "bool", "default": False, "enabled": enabled, "visible": True} list_controls.append(custom_quality_settings) if dict_values['active'] and enabled: @@ -570,15 +569,15 @@ def autoplay_config(item): # Plan B dict_values['plan_b'] = settings_node.get('plan_b', False) enabled = "eq(-4,true)|eq(-8,true)" - plan_b = {"id": "plan_b", "label": " Plan B (Si fallan los favoritos prueba otros enlaces)", + plan_b = {"id": "plan_b", "label": config.get_localized_string(70172), "color": "0xffffff99", "type": "bool", "default": False, "enabled": enabled, "visible": True} list_controls.append(plan_b) # Seccion Prioridades - priority_list = ["Servidor y Calidad", "Calidad y Servidor"] - set_priority = {"id": "priority", "label": " Prioridad (Indica el orden para Auto-Reproducir)", + priority_list = [config.get_localized_string(70174), config.get_localized_string(70175)] + set_priority = {"id": "priority", "label": config.get_localized_string(60085), "color": "0xffffff99", "type": "list", "default": 0, "enabled": True, "visible": "eq(-5,true)+eq(-9,true)+eq(-12,true)", "lvalues": priority_list} list_controls.append(set_priority) @@ -681,7 +680,7 @@ def reset(item, dict): list_quality = channel.list_quality init(channel_name, list_servers, list_quality, reset=True) - platformtools.dialog_notification('AutoPlay', '%s: Los datos fueron reiniciados' % item.category) + platformtools.dialog_notification('AutoPlay', config.get_localized_string(70523) % item.category) return diff --git a/plugin.video.alfa/channelselector.py b/plugin.video.alfa/channelselector.py index f7ffb190..5dce39cd 100644 --- a/plugin.video.alfa/channelselector.py +++ b/plugin.video.alfa/channelselector.py @@ -170,7 +170,7 @@ def filterchannels(category, view="thumb_"): # Si tiene configuración añadimos un item en el contexto context = [] if channel_parameters["has_settings"]: - context.append({"title": "Configurar canal", "channel": "setting", "action": "channel_config", + context.append({"title": config.get_localized_string(70525), "channel": "setting", "action": "channel_config", "config": channel_parameters["channel"]}) channel_info = set_channel_info(channel_parameters) @@ -197,7 +197,7 @@ def filterchannels(category, view="thumb_"): channelslist.insert(0, Item(title=config.get_localized_string(60088), action="mainlist", channel="url", thumbnail=channel_parameters["thumbnail"], type="generic", viewmode="list")) if category in ['movie', 'tvshow']: - titles = ['Mas Populares', 'Mejor Valoradas', 'Ahora en cines', 'En Emision', 'Por Genero'] + titles = [config.get_localized_string(70028), config.get_localized_string(30985), config.get_localized_string(70527), config.get_localized_string(60264), config.get_localized_string(70528)] ids = ['popular', 'top_rated', 'now_playing', 'on_the_air'] for x in range(0,3): if x == 2 and category != 'movie': diff --git a/plugin.video.alfa/core/servertools.py b/plugin.video.alfa/core/servertools.py index ad95edb9..7b80331d 100644 --- a/plugin.video.alfa/core/servertools.py +++ b/plugin.video.alfa/core/servertools.py @@ -52,7 +52,7 @@ def find_video_items(item=None, data=None): # Busca los enlaces a los videos for label, url, server, thumbnail in findvideos(data): - title = "Enlace encontrado en %s" % label + title = config.get_localized_string(70206) % label itemlist.append( item.clone(title=title, action="play", url=url, thumbnail=thumbnail, server=server, folder=False)) @@ -154,9 +154,7 @@ def findvideos(data, skip=False): break if not devuelve and is_filter_servers: - platformtools.dialog_ok("Filtrar servidores (Lista Negra)", - "No hay enlaces disponibles que cumplan los requisitos de su Lista Negra.", - "Pruebe de nuevo modificando el fíltro en 'Configuracíon Servidores") + platformtools.dialog_ok(config.get_localized_string(60001)) return devuelve @@ -243,8 +241,8 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo if server_parameters: # Muestra un diágo de progreso if muestra_dialogo: - progreso = platformtools.dialog_progress("alfa", - "Conectando con %s" % server_parameters["name"]) + progreso = platformtools.dialog_progress(config.get_localized_string(20000), + config.get_localized_string(70180) % server_parameters["name"]) # Cuenta las opciones disponibles, para calcular el porcentaje @@ -265,7 +263,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo logger.info("Opciones disponibles: %s | %s" % (len(opciones), opciones)) else: logger.error("No existe conector para el servidor %s" % server) - error_messages.append("No existe conector para el servidor %s" % server) + error_messages.append(config.get_localized_string(60004) % server) muestra_dialogo = False # Importa el server @@ -310,7 +308,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo # Muestra el progreso if muestra_dialogo: - progreso.update((100 / len(opciones)) * opciones.index(opcion), "Conectando con %s" % server_name) + progreso.update((100 / len(opciones)) * opciones.index(opcion), config.get_localized_string(70180) % server_name) # Modo free if opcion == "free": @@ -337,10 +335,10 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo elif response and response[0][0]: error_messages.append(response[0][0]) else: - error_messages.append("Se ha producido un error en %s" % server_name) + error_messages.append(config.get_localized_string(60006) % server_name) except: logger.error("Error en el servidor: %s" % opcion) - error_messages.append("Se ha producido un error en %s" % server_name) + error_messages.append(config.get_localized_string(60006) % server_name) import traceback logger.error(traceback.format_exc()) @@ -350,18 +348,18 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo # Cerramos el progreso if muestra_dialogo: - progreso.update(100, "Proceso finalizado") + progreso.update(100, config.get_localized_string(60008)) progreso.close() # Si no hay opciones disponibles mostramos el aviso de las cuentas premium if video_exists and not opciones and server_parameters.get("premium"): listapremium = [get_server_parameters(premium)["name"] for premium in server_parameters["premium"]] error_messages.append( - "Para ver un vídeo en %s necesitas
una cuenta en: %s" % (server, " o ".join(listapremium))) + config.get_localized_string(60009) % (server, " o ".join(listapremium))) # Si no tenemos urls ni mensaje de error, ponemos uno generico elif not video_urls and not error_messages: - error_messages.append("Se ha producido un error en %s" % get_server_parameters(server)["name"]) + error_messages.append(config.get_localized_string(60006) % get_server_parameters(server)["name"]) return video_urls, len(video_urls) > 0, "
".join(error_messages) @@ -480,7 +478,7 @@ def get_server_parameters(server): dict_servers_parameters[server] = dict_server except: - mensaje = "Error al cargar el servidor: %s\n" % server + mensaje = config.get_localized_string(59986) % server import traceback logger.error(mensaje + traceback.format_exc()) return {} @@ -693,9 +691,9 @@ def filter_servers(servers_list): servers_list_filter = filter(lambda x: not config.get_setting("black_list", server=x), servers_list) # Si no hay enlaces despues de filtrarlos - if servers_list_filter or not platformtools.dialog_yesno("Filtrar servidores (Lista Negra)", - "Todos los enlaces disponibles pertenecen a servidores incluidos en su Lista Negra.", - "¿Desea mostrar estos enlaces?"): + if servers_list_filter or not platformtools.dialog_yesno(config.get_localized_string(60000), + config.get_localized_string(60010), + config.get_localized_string(70281)): servers_list = servers_list_filter return servers_list @@ -740,10 +738,10 @@ def check_video_link(url, server, timeout=3): video_exists, message = server_module.test_video_exists(page_url=url) if not video_exists: logger.info("[check_video_link] No existe! %s %s %s" % (message, server, url)) - resultado = "NO" + resultado = "[COLOR red][B]NO[/B][/COLOR]" else: logger.info("[check_video_link] comprobacion OK %s %s" % (server, url)) - resultado = "Ok" + resultado = "[COLOR green][B]OK[/B][/COLOR]" except: logger.info("[check_video_link] No se puede comprobar ahora! %s %s" % (server, url)) resultado = "??" diff --git a/plugin.video.alfa/core/tmdb.py b/plugin.video.alfa/core/tmdb.py index 96e9c5a3..b8c1ccb0 100644 --- a/plugin.video.alfa/core/tmdb.py +++ b/plugin.video.alfa/core/tmdb.py @@ -451,11 +451,11 @@ def find_and_set_infoLabels(item): if item.contentType == "movie": tipo_busqueda = "movie" - tipo_contenido = "pelicula" + tipo_contenido = config.get_localized_string(70283) title = item.contentTitle else: tipo_busqueda = "tv" - tipo_contenido = "serie" + tipo_contenido = config.get_localized_string(70529) title = item.contentSerieName # Si el titulo incluye el (año) se lo quitamos diff --git a/plugin.video.alfa/lib/unshortenit.py b/plugin.video.alfa/lib/unshortenit.py index d35555f0..7dccb562 100755 --- a/plugin.video.alfa/lib/unshortenit.py +++ b/plugin.video.alfa/lib/unshortenit.py @@ -13,7 +13,6 @@ import time import urllib from base64 import b64decode - from core import httptools from platformcode import config @@ -36,6 +35,7 @@ class UnshortenIt(object): _anonymz_regex = r'anonymz\.com' _shrink_service_regex = r'shrink-service\.it' _rapidcrypt_regex = r'rapidcrypt\.net' + _cryptmango_regex = r'cryptmango' _maxretries = 5 @@ -73,45 +73,66 @@ class UnshortenIt(object): return self._unshorten_anonymz(uri) if re.search(self._rapidcrypt_regex, domain, re.IGNORECASE): return self._unshorten_rapidcrypt(uri) + if re.search(self._cryptmango_regex, uri, re.IGNORECASE): + return self._unshorten_cryptmango(uri) return uri, 200 def unwrap_30x(self, uri, timeout=10): + def unwrap_30x(uri, timeout=10): - domain = urlsplit(uri).netloc - self._timeout = timeout + domain = urlsplit(uri).netloc + self._timeout = timeout - try: - # headers stop t.co from working so omit headers if this is a t.co link - if domain == 't.co': - r = httptools.downloadpage(uri, timeout=self._timeout) - return r.url, r.code - # p.ost.im uses meta http refresh to redirect. - if domain == 'p.ost.im': - r = httptools.downloadpage(uri, timeout=self._timeout) - uri = re.findall(r'.*url\=(.*?)\"\.*', r.data)[0] - return uri, r.code - - retries = 0 - while True: - r = httptools.downloadpage( - uri, - timeout=self._timeout, - follow_redirects=False) - if not r.sucess: - return uri, -1 - - if 'location' in r.headers and retries < self._maxretries: - r = httptools.downloadpage( - r.headers['location'], - follow_redirects=False) - uri = r.url - retries += 1 - else: + try: + # headers stop t.co from working so omit headers if this is a t.co link + if domain == 't.co': + r = httptools.downloadpage(uri, timeout=self._timeout) return r.url, r.code + # p.ost.im uses meta http refresh to redirect. + if domain == 'p.ost.im': + r = httptools.downloadpage(uri, timeout=self._timeout) + uri = re.findall(r'.*url\=(.*?)\"\.*', r.data)[0] + return uri, r.code - except Exception as e: - return uri, str(e) + retries = 0 + while True: + r = httptools.downloadpage( + uri, + timeout=self._timeout, + cookies=False, + follow_redirects=False) + if not r.sucess: + return uri, -1 + + if '4snip' not in r.url and 'location' in r.headers and retries < self._maxretries: + r = httptools.downloadpage( + r.headers['location'], + cookies=False, + follow_redirects=False) + uri = r.url + retries += 1 + else: + return r.url, r.code + + except Exception as e: + return uri, str(e) + + uri, code = unwrap_30x(uri, timeout) + + if 'vcrypt' in uri and 'fastshield' in uri: + # twince because of cookies + httptools.downloadpage( + uri, + timeout=self._timeout, + post='go=go') + r = httptools.downloadpage( + uri, + timeout=self._timeout, + post='go=go') + return r.url, r.code + + return uri, code def _clear_google_outbound_proxy(self, url): ''' @@ -428,6 +449,18 @@ class UnshortenIt(object): except Exception as e: return uri, str(e) + def _unshorten_cryptmango(self, uri): + try: + r = httptools.downloadpage(uri, timeout=self._timeout, cookies=False) + html = r.data + + uri = re.findall(r'