Merge branch 'master' of https://github.com/kodiondemand/addon into master

This commit is contained in:
Alhaziel01
2020-11-26 10:17:04 +01:00
9 changed files with 73 additions and 66 deletions
-1
View File
@@ -8,7 +8,6 @@ from __future__ import division
# from builtins import str # from builtins import str
import io import io
from future.builtins import range
from past.utils import old_div from past.utils import old_div
import sys import sys
PY3 = False PY3 = False
+4 -4
View File
@@ -353,7 +353,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
video_urls.extend(response) video_urls.extend(response)
except: except:
logger.error("Error getting url in free mode") logger.error("Error getting url in free mode")
error_messages.append(config.get_localized_string(60006) % server_name) error_messages.append(config.get_localized_string(60014))
import traceback import traceback
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
@@ -370,10 +370,10 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
elif response and response[0][0]: elif response and response[0][0]:
error_messages.append(response[0][0]) error_messages.append(response[0][0])
else: else:
error_messages.append(config.get_localized_string(60006) % server_name) error_messages.append(config.get_localized_string(60014))
except: except:
logger.error("Server errorr: %s" % opcion) logger.error("Server errorr: %s" % opcion)
error_messages.append(config.get_localized_string(60006) % server_name) error_messages.append(config.get_localized_string(60014))
import traceback import traceback
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
@@ -394,7 +394,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
# If we do not have urls or error messages, we put a generic one # If we do not have urls or error messages, we put a generic one
elif not video_urls and not error_messages: elif not video_urls and not error_messages:
error_messages.append(config.get_localized_string(60006) % get_server_parameters(server)["name"]) error_messages.append(config.get_localized_string(60014))
return video_urls, len(video_urls) > 0, "<br/>".join(error_messages) return video_urls, len(video_urls) > 0, "<br/>".join(error_messages)
+23 -8
View File
@@ -385,7 +385,10 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
it.__setattr__(lg, match[lg]) it.__setattr__(lg, match[lg])
if 'itemHook' in args: if 'itemHook' in args:
it = args['itemHook'](it) try:
it = args['itemHook'](it)
except:
raise logger.ChannelScraperException
itemlist.append(it) itemlist.append(it)
return itemlist, matches return itemlist, matches
@@ -407,7 +410,6 @@ def scrape(func):
args = func(*args) args = func(*args)
function = func.__name__ if not 'actLike' in args else args['actLike'] function = func.__name__ if not 'actLike' in args else args['actLike']
# info('STACK= ',inspect.stack()[1][3]) # info('STACK= ',inspect.stack()[1][3])
item = args['item'] item = args['item']
action = args.get('action', 'findvideos') action = args.get('action', 'findvideos')
@@ -469,23 +471,33 @@ def scrape(func):
typeActionDict, blacklist, search, pag, function, lang, sceneTitle, group) typeActionDict, blacklist, search, pag, function, lang, sceneTitle, group)
if 'itemlistHook' in args: if 'itemlistHook' in args:
itemlist = args['itemlistHook'](itemlist) try:
itemlist = args['itemlistHook'](itemlist)
except:
raise logger.ChannelScraperException
# if url may be changed and channel has findhost to update # if url may be changed and channel has findhost to update
if 'findhost' in func.__globals__ and not itemlist: if 'findhost' in func.__globals__ and not itemlist:
info('running findhost ' + func.__module__) info('running findhost ' + func.__module__)
ch = func.__module__.split('.')[-1] ch = func.__module__.split('.')[-1]
host = config.get_channel_url(func.__globals__['findhost'], ch, True) try:
host = config.get_channel_url(func.__globals__['findhost'], ch, True)
parse = list(urlparse.urlparse(item.url)) parse = list(urlparse.urlparse(item.url))
parse[1] = scrapertools.get_domain_from_url(host) parse[1] = scrapertools.get_domain_from_url(host)
item.url = urlparse.urlunparse(parse) item.url = urlparse.urlunparse(parse)
except:
raise logger.ChannelScraperException
data = None data = None
itemlist = [] itemlist = []
matches = [] matches = []
else: else:
break break
if not data:
from platformcode.logger import WebErrorException
raise WebErrorException(urlparse.urlparse(item.url)[1], item.channel)
if group and item.grouped or args.get('groupExplode'): if group and item.grouped or args.get('groupExplode'):
import copy import copy
nextArgs = copy.copy(args) nextArgs = copy.copy(args)
@@ -548,7 +560,10 @@ def scrape(func):
itemlist = thumb(itemlist, genre=True) itemlist = thumb(itemlist, genre=True)
if 'fullItemlistHook' in args: if 'fullItemlistHook' in args:
itemlist = args['fullItemlistHook'](itemlist) try:
itemlist = args['fullItemlistHook'](itemlist)
except:
raise logger.ChannelScraperException
# itemlist = filterLang(item, itemlist) # causa problemi a newest # itemlist = filterLang(item, itemlist) # causa problemi a newest
+8 -22
View File
@@ -341,13 +341,10 @@ def run(item=None):
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
platformtools.dialog_ok( platformtools.dialog_ok(
config.get_localized_string(59985) + Channel, config.get_localized_string(59985) % e.channel,
config.get_localized_string(60013) %(e)) config.get_localized_string(60013) % e.url)
except: except Exception as e:
import traceback import traceback
from core import scrapertools from core import scrapertools
@@ -356,26 +353,15 @@ def run(item=None):
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"' patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
Channel = scrapertools.find_single_match(traceback.format_exc(), patron) Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
try: if Channel or e.__class__ == logger.ChannelScraperException:
import xbmc
if config.get_platform(True)['num_version'] < 14:
log_name = "xbmc.log"
else:
log_name = "kodi.log"
log_message = config.get_localized_string(50004) + xbmc.translatePath("special://logpath") + log_name
except:
log_message = ""
if Channel:
if item.url: if item.url:
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014) + '\n' + log_message, nolabel='ok', yeslabel=config.get_localized_string(70739)): if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), nolabel='ok', yeslabel=config.get_localized_string(70739)):
run(Item(action="open_browser", url=item.url)) run(Item(action="open_browser", url=item.url))
else: else:
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014) + '\n' + log_message) platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014))
else: else:
platformtools.dialog_ok( if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
config.get_localized_string(60038), run(Item(channel="setting", action="report_menu"))
config.get_localized_string(60015) + '\n' + log_message)
def new_search(item, channel=None): def new_search(item, channel=None):
+7 -1
View File
@@ -53,5 +53,11 @@ def log(*args, **kwargs):
class WebErrorException(Exception): class WebErrorException(Exception):
def __init__(self, *args, **kwargs): def __init__(self, url, channel, *args, **kwargs):
self.url = url
self.channel = channel
Exception.__init__(self, *args, **kwargs) Exception.__init__(self, *args, **kwargs)
class ChannelScraperException(Exception):
pass
+10 -9
View File
@@ -183,10 +183,10 @@ def dialog_info(item, scraper):
def Start(self, item, scraper): def Start(self, item, scraper):
self.item = item self.item = item
self.item.exit = False self.item.exit = False
self.title = item.contentTitle if item.contentType == 'movie' else item.contentSerieName self.title = item.show if item.show else item.fulltitle
self.id = item.infoLabels.get('tmdb_id','') if scraper == 'tmdb' else item.infoLabels.get('tvdb_id','') self.id = item.infoLabels.get('tmdb_id', '') if scraper == 'tmdb' else item.infoLabels.get('tvdb_id', '')
self.scraper = scraper self.scraper = scraper
self.idtitle = 'TMDB ID' if scraper == 'tmdb' else 'TVDB ID' self.label = 'TMDB ID:' if scraper == 'tmdb' else 'TVDB ID:'
self.doModal() self.doModal()
return self.item return self.item
@@ -637,11 +637,11 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
# Open the selection dialog to see the available options # Open the selection dialog to see the available options
opciones, video_urls, seleccion, salir = get_dialogo_opciones(item, default_action, strm, autoplay) opciones, video_urls, seleccion, salir = get_dialogo_opciones(item, default_action, strm, autoplay)
if salir: return if salir: exit()
# get default option of addon configuration # get default option of addon configuration
seleccion = get_seleccion(default_action, opciones, seleccion, video_urls) seleccion = get_seleccion(default_action, opciones, seleccion, video_urls)
if seleccion < 0: return # Canceled box if seleccion < 0: exit() # Canceled box
logger.debug("selection=%d" % seleccion) logger.debug("selection=%d" % seleccion)
logger.debug("selection=%s" % opciones[seleccion]) logger.debug("selection=%s" % opciones[seleccion])
@@ -898,13 +898,14 @@ def get_dialogo_opciones(item, default_action, strm, autoplay):
if not autoplay: if not autoplay:
if item.server != "": if item.server != "":
if "<br/>" in motivo: if "<br/>" in motivo:
ret = dialog_yesno(config.get_localized_string(60362), motivo.split("<br/>")[0] + '\n' + motivo.split("<br/>")[1] + '\n' + item.url, nolabel='ok', yeslabel=config.get_localized_string(70739)) ret = dialog_yesno(config.get_localized_string(60362) % item.server, motivo.split("<br/>")[0] + '\n' + motivo.split("<br/>")[1], nolabel='ok', yeslabel=config.get_localized_string(70739))
else: else:
ret = dialog_yesno(config.get_localized_string(60362), motivo + '\n' + item.url, nolabel='ok', yeslabel=config.get_localized_string(70739)) ret = dialog_yesno(config.get_localized_string(60362) % item.server, motivo, nolabel='ok', yeslabel=config.get_localized_string(70739))
else: else:
ret = dialog_yesno(config.get_localized_string(60362), config.get_localized_string(60363) + '\n' + config.get_localized_string(60364) + '\n' + item.url, nolabel='ok', yeslabel=config.get_localized_string(70739)) ret = dialog_yesno(config.get_localized_string(60362) % item.server, config.get_localized_string(60363) + '\n' + config.get_localized_string(60364), nolabel='ok', yeslabel=config.get_localized_string(70739))
if ret: if ret:
xbmc.executebuiltin("Container.Update (%s?%s)" % (sys.argv[0], Item(action="open_browser", url=item.url).tourl())) xbmc.executebuiltin("Container.Update (%s?%s)" %
(sys.argv[0], Item(action="open_browser", url=item.url).tourl()))
if item.channel == "favorites": if item.channel == "favorites":
# "Remove from favorites" # "Remove from favorites"
opciones.append(config.get_localized_string(30154)) opciones.append(config.get_localized_string(30154))
@@ -589,7 +589,7 @@ msgid "%.2f %s of %.2f %s a %.2f %s/s (%d/%d)"
msgstr "" msgstr ""
msgctxt "#59985" msgctxt "#59985"
msgid "Error in the channel " msgid "Channel %s unreachable"
msgstr "" msgstr ""
msgctxt "#59986" msgctxt "#59986"
@@ -669,7 +669,7 @@ msgid ""
msgstr "" msgstr ""
msgctxt "#60006" msgctxt "#60006"
msgid "An error has occurred in %s" msgid "[B]An error has occurred in %s:[/B]"
msgstr "" msgstr ""
msgctxt "#60007" msgctxt "#60007"
@@ -697,15 +697,15 @@ msgid "No video to play"
msgstr "" msgstr ""
msgctxt "#60013" msgctxt "#60013"
msgid "This website seems to be unavailable, try later, if the problem persists, check with a browser: %s. If the web page is working correctly, please report the error on : https://t.me/kodiondemand" msgid "This website [B]%s[/B] seems to be unavailable, try later. if the web page is working correctly, please report the error on: https://github.com/kodiondemand/addon/issues"
msgstr "" msgstr ""
msgctxt "#60014" msgctxt "#60014"
msgid "It may be due to a connection problem, the web page of the channel has changed its structure, or an internal error of KoD. To have more details, see the log file." msgid "It may be due to a connection problem, the web page of the channel has changed its structure, or an internal error of KoD. If on browser it works, report the issue using [B]Help->Report an issue.[B]"
msgstr "" msgstr ""
msgctxt "#60015" msgctxt "#60015"
msgid "Check the log for more details on the error." msgid "Do you want to report the issue?\n(Be sure you follow all steps and give a clear and comprehensive explanation of what happened"
msgstr "" msgstr ""
msgctxt "#60016" msgctxt "#60016"
@@ -800,8 +800,8 @@ msgctxt "#60038"
msgid "An error has occurred in KoD" msgid "An error has occurred in KoD"
msgstr "" msgstr ""
msgctxt "#60039" msgctxt "60039"
msgid "Error on channel %s" msgid "Channel %s unreachable"
msgstr "" msgstr ""
msgctxt "#60040" msgctxt "#60040"
@@ -1633,7 +1633,7 @@ msgid "Super favourites menu"
msgstr "" msgstr ""
msgctxt "#60362" msgctxt "#60362"
msgid "You can't watch this video because..." msgid "Unexpected error on server %s"
msgstr "" msgstr ""
msgctxt "#60363" msgctxt "#60363"
@@ -588,8 +588,8 @@ msgid "%.2f %s of %.2f %s a %.2f %s/s (%d/%d)"
msgstr "%.2f %s di %.2f %s a %.2f %s/s (%d/%d)" msgstr "%.2f %s di %.2f %s a %.2f %s/s (%d/%d)"
msgctxt "#59985" msgctxt "#59985"
msgid "Error in the channel " msgid "Channel %s unreachable"
msgstr "Errore nel canale " msgstr "Canale %s irraggiungibile"
msgctxt "#59986" msgctxt "#59986"
msgid "Error loading the server: %s\n" msgid "Error loading the server: %s\n"
@@ -668,8 +668,8 @@ msgid ""
msgstr "" msgstr ""
msgctxt "#60006" msgctxt "#60006"
msgid "An error has occurred in %s" msgid "[B]An error has occurred in %s:[/B]"
msgstr "Si è verificato un errore in %s" msgstr "[B]Si è verificato un errore in %s:[/B]"
msgctxt "#60007" msgctxt "#60007"
msgid "An error has occurred on %s" msgid "An error has occurred on %s"
@@ -696,16 +696,16 @@ msgid "No video to play"
msgstr "Nessun video da riprodurre" msgstr "Nessun video da riprodurre"
msgctxt "#60013" msgctxt "#60013"
msgid "This website seems to be unavailable, try later, if the problem persists, check with a browser: %s. If the web page is working correctly, please report the error on : https://t.me/kodiondemand" msgid "This website [B]%s[/B] seems to be unavailable, try later. if the web page is working correctly, please report the error on: https://github.com/kodiondemand/addon/issues"
msgstr "Questo sito non sembra essere disponibile, riprova più tardi, se il problema persiste verifica mediante un browser: %s. Se la pagina web funziona correttamente segnala l'errore su : https://t.me/kodiondemand" msgstr "Il sito [B]%s[/B] non sembra essere disponibile, riprova più tardi. Se la pagina web funziona correttamente segnala l'errore qui: https://github.com/kodiondemand/addon/issues"
msgctxt "#60014" msgctxt "#60014"
msgid "It may be due to a connection problem, the web page of the channel has changed its structure, or an internal error of KoD. To have more details, see the log file." msgid "It may be due to a connection problem, the web page of the channel has changed its structure, or an internal error of KoD. If on browser it works, report the issue using [B]Help->Report an issue.[B]"
msgstr "Potrebbe essere dovuto a un problema di connessione, la pagina web del canale ha cambiato la sua struttura, oppure un errore interno di KoD. Per avere maggiori dettagli, consulta il file di log." msgstr "Potrebbe essere dovuto a un problema di connessione, la pagina web del canale ha cambiato la sua struttura, oppure un errore interno di KoD. Se sul browser funziona, segnala il problema andando in [B]Aiuto->Segnala un problema[/B]."
msgctxt "#60015" msgctxt "#60015"
msgid "Check the log for more details on the error." msgid "Do you want to report the issue?\n(Be sure you follow all steps and give a clear and comprehensive explanation of what happened"
msgstr "Controlla il log per avere maggiori dettagli sull'errore." msgstr "Vuoi fare una segnalazione agli sviluppatori?\n(Assicurati di seguire bene tutti i punti e dai una spiegazione chiara ed esaustiva di quanto accaduto)"
msgctxt "#60016" msgctxt "#60016"
msgid "Segna film come non visto" msgid "Segna film come non visto"
@@ -1632,8 +1632,8 @@ msgid "Super favourites menu"
msgstr "Menu super favoriti" msgstr "Menu super favoriti"
msgctxt "#60362" msgctxt "#60362"
msgid "You can't watch this video because..." msgid "Unexpected error on server %s"
msgstr "Non è possibile vedere questo video perchè..." msgstr "Errore inaspettato sul server %s"
msgctxt "#60363" msgctxt "#60363"
msgid "The server on which it is hosted" msgid "The server on which it is hosted"
+1 -1
View File
@@ -31,7 +31,7 @@
"visible": true "visible": true
}, },
{ {
"default": "100", "default": 0,
"enabled": true, "enabled": true,
"id": "favorites_servers_list", "id": "favorites_servers_list",
"label": "$ADDON[plugin.video.kod 60655]", "label": "$ADDON[plugin.video.kod 60655]",