From fd654641621a1509b4aaf37c7c51248ad18deb86 Mon Sep 17 00:00:00 2001 From: angedam Date: Mon, 20 Aug 2018 16:43:14 +0200 Subject: [PATCH 01/13] added localized strings --- plugin.video.alfa/channels/autoplay.py | 39 +++++++++++++------------- 1 file changed, 19 insertions(+), 20 deletions(-) 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 From 33e45928b4e1bdcf39e93857507ffc9e4f3a140d Mon Sep 17 00:00:00 2001 From: angedam Date: Mon, 20 Aug 2018 16:43:38 +0200 Subject: [PATCH 02/13] added localized strings --- plugin.video.alfa/core/servertools.py | 36 +++++++++++++-------------- plugin.video.alfa/core/tmdb.py | 4 +-- 2 files changed, 19 insertions(+), 21 deletions(-) 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..3cf6d960 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(70283) title = item.contentSerieName # Si el titulo incluye el (año) se lo quitamos From e29618a04513120b9e47aacd055227d13eaeafec Mon Sep 17 00:00:00 2001 From: angedam Date: Mon, 20 Aug 2018 16:44:12 +0200 Subject: [PATCH 03/13] update string.po --- .../resources/language/English/strings.po | 28 +++++++++++++++ .../resources/language/Italian/strings.po | 35 ++++++++++++++++++- .../language/Spanish (Argentina)/strings.po | 30 +++++++++++++++- .../language/Spanish (Mexico)/strings.po | 30 +++++++++++++++- .../resources/language/Spanish/strings.po | 30 +++++++++++++++- 5 files changed, 149 insertions(+), 4 deletions(-) diff --git a/plugin.video.alfa/resources/language/English/strings.po b/plugin.video.alfa/resources/language/English/strings.po index 731a105f..e7990d51 100644 --- a/plugin.video.alfa/resources/language/English/strings.po +++ b/plugin.video.alfa/resources/language/English/strings.po @@ -4787,3 +4787,31 @@ msgctxt "#70521" msgid "You can install the Trakt script below, \nonce installed and configured what \nyou see will be synchronized with your account automatically. \nDo you want to continue?" msgstr "" +msgctxt "#70522" +msgid "No filter" +msgstr "" + +msgctxt "#70523" +msgid "%s: The data was restarted" +msgstr "" + +msgctxt "#70524" +msgid " Server error, try later." +msgstr "" + +msgctxt "#70525" +msgid "Configure channel" +msgstr "" + +msgctxt "#70526" +msgid "Verification of counters of videos seen / not seen (uncheck to verify)" +msgstr "" + +msgctxt "#70527" +msgid "Now in Theatres " +msgstr "" + +msgctxt "#70528" +msgid "Movies by Genre" +msgstr "" + diff --git a/plugin.video.alfa/resources/language/Italian/strings.po b/plugin.video.alfa/resources/language/Italian/strings.po index 5184e35d..d3a6dca4 100644 --- a/plugin.video.alfa/resources/language/Italian/strings.po +++ b/plugin.video.alfa/resources/language/Italian/strings.po @@ -4257,7 +4257,7 @@ msgstr "Dai un punteggio con un [COLOR %s]%s[/COLOR]" msgctxt "#70393" msgid "[%s]: Select the correct %s " -msgstr "[%s]: Seleziona la %s corretta" +msgstr "[%s]: Seleziona il %s corretto" msgctxt "#70394" msgid "Action" @@ -4775,3 +4775,36 @@ msgctxt "#70521" msgid "You can install the Trakt script below, \nonce installed and configured what \nyou see will be synchronized with your account automatically. \nDo you want to continue?" msgstr "Puoi installare lo script Trakt qui sotto, \ nuna volta installato e configurato ciò che \nvedrai verrà sincronizzato automaticamente con il tuo account. \nVuoi continuare?" +msgctxt "#70522" +msgid "No Filter" +msgstr "Non Filtrare" + +msgctxt "#70523" +msgid "No filter" +msgstr "Non filtrare" + +msgctxt "#70523" +msgid "%s: The data was restarted" +msgstr "%s: I dati sono stati riavviati" + +msgctxt "#70524" +msgid " Server error, try later." +msgstr " Errore del server, riprova più tardi." + +msgctxt "#70525" +msgid "Configure channel" +msgstr "Configura canale" + +msgctxt "#70526" +msgid "Verification of counters of videos seen / not seen (uncheck to verify)" +msgstr "Verifica dei contatori di video visti/non visti (deselezionare per verificare)" + +msgctxt "#70527" +msgid "Now in Theatres " +msgstr "Oggi in Sala" + +msgctxt "#70528" +msgid "Movies by Genre" +msgstr "Per genere" + + diff --git a/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po b/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po index f55a67a4..6112798f 100644 --- a/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po +++ b/plugin.video.alfa/resources/language/Spanish (Argentina)/strings.po @@ -303,7 +303,7 @@ msgstr "Populares" msgctxt "#30985" msgid "Top Rated" -msgstr "Mejor valoradas" +msgstr "Mejor Valoradas" msgctxt "#30986" msgid "Search by Collection" @@ -4778,3 +4778,31 @@ msgstr "AutoPlay permite auto reproducir los enlaces directamente, basándose en msgctxt "#70521" msgid "You can install the Trakt script below, \nonce installed and configured what \nyou see will be synchronized with your account automatically. \nDo you want to continue?" msgstr "Puedes instalar el script de Trakt a continuacíon, \nuna vez instalado y configurado lo que \veas se sincronizara con tu cuenta automaticamente. \n¿Deseas continuar?" + +msgctxt "#70522" +msgid "No filter" +msgstr "No filtrar" + +msgctxt "#70523" +msgid "%s: The data was restarted" +msgstr "%s: Los datos fueron reiniciados" + +msgctxt "#70524" +msgid " Server error, try later." +msgstr " Error de servidor, inténtelo más tarde." + +msgctxt "#70525" +msgid "Configure channel" +msgstr "Configurar canal" + +msgctxt "#70526" +msgid "Verification of counters of videos seen / not seen (uncheck to verify)" +msgstr "Verificación de los contadores de vídeos vistos/no vistos (desmarcar para verificar)" + +msgctxt "#70527" +msgid "Now in Theatres " +msgstr "Ahora en cines" + +msgctxt "#70528" +msgid "Movies by Genre" +msgstr "Por generos" diff --git a/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po b/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po index f55a67a4..6112798f 100644 --- a/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po +++ b/plugin.video.alfa/resources/language/Spanish (Mexico)/strings.po @@ -303,7 +303,7 @@ msgstr "Populares" msgctxt "#30985" msgid "Top Rated" -msgstr "Mejor valoradas" +msgstr "Mejor Valoradas" msgctxt "#30986" msgid "Search by Collection" @@ -4778,3 +4778,31 @@ msgstr "AutoPlay permite auto reproducir los enlaces directamente, basándose en msgctxt "#70521" msgid "You can install the Trakt script below, \nonce installed and configured what \nyou see will be synchronized with your account automatically. \nDo you want to continue?" msgstr "Puedes instalar el script de Trakt a continuacíon, \nuna vez instalado y configurado lo que \veas se sincronizara con tu cuenta automaticamente. \n¿Deseas continuar?" + +msgctxt "#70522" +msgid "No filter" +msgstr "No filtrar" + +msgctxt "#70523" +msgid "%s: The data was restarted" +msgstr "%s: Los datos fueron reiniciados" + +msgctxt "#70524" +msgid " Server error, try later." +msgstr " Error de servidor, inténtelo más tarde." + +msgctxt "#70525" +msgid "Configure channel" +msgstr "Configurar canal" + +msgctxt "#70526" +msgid "Verification of counters of videos seen / not seen (uncheck to verify)" +msgstr "Verificación de los contadores de vídeos vistos/no vistos (desmarcar para verificar)" + +msgctxt "#70527" +msgid "Now in Theatres " +msgstr "Ahora en cines" + +msgctxt "#70528" +msgid "Movies by Genre" +msgstr "Por generos" diff --git a/plugin.video.alfa/resources/language/Spanish/strings.po b/plugin.video.alfa/resources/language/Spanish/strings.po index f55a67a4..6112798f 100644 --- a/plugin.video.alfa/resources/language/Spanish/strings.po +++ b/plugin.video.alfa/resources/language/Spanish/strings.po @@ -303,7 +303,7 @@ msgstr "Populares" msgctxt "#30985" msgid "Top Rated" -msgstr "Mejor valoradas" +msgstr "Mejor Valoradas" msgctxt "#30986" msgid "Search by Collection" @@ -4778,3 +4778,31 @@ msgstr "AutoPlay permite auto reproducir los enlaces directamente, basándose en msgctxt "#70521" msgid "You can install the Trakt script below, \nonce installed and configured what \nyou see will be synchronized with your account automatically. \nDo you want to continue?" msgstr "Puedes instalar el script de Trakt a continuacíon, \nuna vez instalado y configurado lo que \veas se sincronizara con tu cuenta automaticamente. \n¿Deseas continuar?" + +msgctxt "#70522" +msgid "No filter" +msgstr "No filtrar" + +msgctxt "#70523" +msgid "%s: The data was restarted" +msgstr "%s: Los datos fueron reiniciados" + +msgctxt "#70524" +msgid " Server error, try later." +msgstr " Error de servidor, inténtelo más tarde." + +msgctxt "#70525" +msgid "Configure channel" +msgstr "Configurar canal" + +msgctxt "#70526" +msgid "Verification of counters of videos seen / not seen (uncheck to verify)" +msgstr "Verificación de los contadores de vídeos vistos/no vistos (desmarcar para verificar)" + +msgctxt "#70527" +msgid "Now in Theatres " +msgstr "Ahora en cines" + +msgctxt "#70528" +msgid "Movies by Genre" +msgstr "Por generos" From 540419020e988822378bfbf35adfa96b49cb0e5e Mon Sep 17 00:00:00 2001 From: angedam Date: Mon, 20 Aug 2018 16:45:10 +0200 Subject: [PATCH 04/13] added localized strings & def testif videoexist --- plugin.video.alfa/servers/rapidvideo.py | 12 ++++++------ plugin.video.alfa/servers/youtube.py | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/plugin.video.alfa/servers/rapidvideo.py b/plugin.video.alfa/servers/rapidvideo.py index d6705262..82fce95d 100755 --- a/plugin.video.alfa/servers/rapidvideo.py +++ b/plugin.video.alfa/servers/rapidvideo.py @@ -13,20 +13,20 @@ def test_video_exists(page_url): pass if response.code == 404: - return False, "[Rapidvideo] El archivo no existe ó ha sido borrado" + return False, config.get_localized_string(70449) % "RapidVideo" if not response.data or "urlopen error [Errno 1]" in str(response.code): from platformcode import config if config.is_xbmc(): - return False, "[Rapidvideo] Este conector solo funciona a partir de Kodi 17" + return False, config.get_localized_string(70302) % "RapidVideo" elif config.get_platform() == "plex": - return False, "[Rapidvideo] Este conector no funciona con tu versión de Plex, intenta actualizarla" + return False, config.get_localized_string(70303) % "RapidVideo" elif config.get_platform() == "mediaserver": - return False, "[Rapidvideo] Este conector requiere actualizar python a la versión 2.7.9 o superior" + return False, config.get_localized_string(70304) % "RapidVideo" if "Object not found" in response.data: - return False, "[Rapidvideo] El archivo no existe o ha sido borrado" + return False, config.get_localized_string(70449) % "RapidVideo" if response.code == 500: - return False, "[Rapidvideo] Error de servidor, inténtelo más tarde." + return False, config.get_localized_string(70524) % "RapidVideo" return True, "" diff --git a/plugin.video.alfa/servers/youtube.py b/plugin.video.alfa/servers/youtube.py index 5a398635..8b838360 100755 --- a/plugin.video.alfa/servers/youtube.py +++ b/plugin.video.alfa/servers/youtube.py @@ -10,6 +10,18 @@ from core import scrapertools from platformcode import config, logger +def test_video_exists(page_url): + logger.info("(page_url='%s')" % page_url) + + data = httptools.downloadpage(page_url).data + + if "File was deleted" in data: + return False, config.get_localized_string(70449) % "Youtube" + + return True, "" + + + def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("(page_url='%s')" % page_url) From 992abbda76102a86e20b001e02b6cab383ea9aa4 Mon Sep 17 00:00:00 2001 From: angedam Date: Mon, 20 Aug 2018 16:45:39 +0200 Subject: [PATCH 05/13] added localized strings --- plugin.video.alfa/channelselector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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': From 9cc18a702990f28a858ebbe5060e3d8999563129 Mon Sep 17 00:00:00 2001 From: angedam Date: Mon, 20 Aug 2018 16:47:17 +0200 Subject: [PATCH 06/13] unshorten powerup --- plugin.video.alfa/lib/unshortenit.py | 97 +++++++++++++++++++--------- 1 file changed, 65 insertions(+), 32 deletions(-) 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'