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

View File

@@ -8,7 +8,6 @@ from __future__ import division
# from builtins import str
import io
from future.builtins import range
from past.utils import old_div
import sys
PY3 = False

View File

@@ -353,7 +353,7 @@ def resolve_video_urls_for_playing(server, url, video_password="", muestra_dialo
video_urls.extend(response)
except:
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
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]:
error_messages.append(response[0][0])
else:
error_messages.append(config.get_localized_string(60006) % server_name)
error_messages.append(config.get_localized_string(60014))
except:
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
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
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)

View File

@@ -385,7 +385,10 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
it.__setattr__(lg, match[lg])
if 'itemHook' in args:
it = args['itemHook'](it)
try:
it = args['itemHook'](it)
except:
raise logger.ChannelScraperException
itemlist.append(it)
return itemlist, matches
@@ -407,7 +410,6 @@ def scrape(func):
args = func(*args)
function = func.__name__ if not 'actLike' in args else args['actLike']
# info('STACK= ',inspect.stack()[1][3])
item = args['item']
action = args.get('action', 'findvideos')
@@ -469,23 +471,33 @@ def scrape(func):
typeActionDict, blacklist, search, pag, function, lang, sceneTitle, group)
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 'findhost' in func.__globals__ and not itemlist:
info('running findhost ' + func.__module__)
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[1] = scrapertools.get_domain_from_url(host)
item.url = urlparse.urlunparse(parse)
parse = list(urlparse.urlparse(item.url))
parse[1] = scrapertools.get_domain_from_url(host)
item.url = urlparse.urlunparse(parse)
except:
raise logger.ChannelScraperException
data = None
itemlist = []
matches = []
else:
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'):
import copy
nextArgs = copy.copy(args)
@@ -548,7 +560,10 @@ def scrape(func):
itemlist = thumb(itemlist, genre=True)
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

View File

@@ -341,13 +341,10 @@ def run(item=None):
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(
config.get_localized_string(59985) + Channel,
config.get_localized_string(60013) %(e))
except:
config.get_localized_string(59985) % e.channel,
config.get_localized_string(60013) % e.url)
except Exception as e:
import traceback
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"'
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
try:
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 Channel or e.__class__ == logger.ChannelScraperException:
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))
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:
platformtools.dialog_ok(
config.get_localized_string(60038),
config.get_localized_string(60015) + '\n' + log_message)
if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
run(Item(channel="setting", action="report_menu"))
def new_search(item, channel=None):

View File

@@ -53,5 +53,11 @@ def log(*args, **kwargs):
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)
class ChannelScraperException(Exception):
pass

View File

@@ -183,10 +183,10 @@ def dialog_info(item, scraper):
def Start(self, item, scraper):
self.item = item
self.item.exit = False
self.title = item.contentTitle if item.contentType == 'movie' else item.contentSerieName
self.id = item.infoLabels.get('tmdb_id','') if scraper == 'tmdb' else item.infoLabels.get('tvdb_id','')
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.scraper = scraper
self.idtitle = 'TMDB ID' if scraper == 'tmdb' else 'TVDB ID'
self.label = 'TMDB ID:' if scraper == 'tmdb' else 'TVDB ID:'
self.doModal()
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
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
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=%s" % opciones[seleccion])
@@ -898,13 +898,14 @@ def get_dialogo_opciones(item, default_action, strm, autoplay):
if not autoplay:
if item.server != "":
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:
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:
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:
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":
# "Remove from favorites"
opciones.append(config.get_localized_string(30154))

View File

@@ -589,7 +589,7 @@ msgid "%.2f %s of %.2f %s a %.2f %s/s (%d/%d)"
msgstr ""
msgctxt "#59985"
msgid "Error in the channel "
msgid "Channel %s unreachable"
msgstr ""
msgctxt "#59986"
@@ -669,7 +669,7 @@ msgid ""
msgstr ""
msgctxt "#60006"
msgid "An error has occurred in %s"
msgid "[B]An error has occurred in %s:[/B]"
msgstr ""
msgctxt "#60007"
@@ -697,15 +697,15 @@ msgid "No video to play"
msgstr ""
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 ""
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 ""
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 ""
msgctxt "#60016"
@@ -800,8 +800,8 @@ msgctxt "#60038"
msgid "An error has occurred in KoD"
msgstr ""
msgctxt "#60039"
msgid "Error on channel %s"
msgctxt "60039"
msgid "Channel %s unreachable"
msgstr ""
msgctxt "#60040"
@@ -1633,7 +1633,7 @@ msgid "Super favourites menu"
msgstr ""
msgctxt "#60362"
msgid "You can't watch this video because..."
msgid "Unexpected error on server %s"
msgstr ""
msgctxt "#60363"

View File

@@ -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)"
msgctxt "#59985"
msgid "Error in the channel "
msgstr "Errore nel canale "
msgid "Channel %s unreachable"
msgstr "Canale %s irraggiungibile"
msgctxt "#59986"
msgid "Error loading the server: %s\n"
@@ -668,8 +668,8 @@ msgid ""
msgstr ""
msgctxt "#60006"
msgid "An error has occurred in %s"
msgstr "Si è verificato un errore in %s"
msgid "[B]An error has occurred in %s:[/B]"
msgstr "[B]Si è verificato un errore in %s:[/B]"
msgctxt "#60007"
msgid "An error has occurred on %s"
@@ -696,16 +696,16 @@ msgid "No video to play"
msgstr "Nessun video da riprodurre"
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"
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"
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 "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"
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."
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."
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. Se sul browser funziona, segnala il problema andando in [B]Aiuto->Segnala un problema[/B]."
msgctxt "#60015"
msgid "Check the log for more details on the error."
msgstr "Controlla il log per avere maggiori dettagli sull'errore."
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 "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"
msgid "Segna film come non visto"
@@ -1632,8 +1632,8 @@ msgid "Super favourites menu"
msgstr "Menu super favoriti"
msgctxt "#60362"
msgid "You can't watch this video because..."
msgstr "Non è possibile vedere questo video perchè..."
msgid "Unexpected error on server %s"
msgstr "Errore inaspettato sul server %s"
msgctxt "#60363"
msgid "The server on which it is hosted"

View File

@@ -31,7 +31,7 @@
"visible": true
},
{
"default": "100",
"default": 0,
"enabled": true,
"id": "favorites_servers_list",
"label": "$ADDON[plugin.video.kod 60655]",