def check_repos(): from resources.libs.common import logging from resources.libs.common import tools progress_dialog = xbmcgui.DialogProgress() progress_dialog.create( CONFIG.ADDONTITLE, '[COLOR {0}]Comprobación de Repositorios...[/COLOR]'.format( CONFIG.COLOR2)) badrepos = [] xbmc.executebuiltin('UpdateAddonRepos') repolist = glob.glob(os.path.join(CONFIG.ADDONS, 'repo*')) if len(repolist) == 0: progress_dialog.close() logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]No se Encontraron Repositorios![/COLOR]".format( CONFIG.COLOR2)) return sleeptime = len(repolist) start = 0 while start < sleeptime: start += 1 if progress_dialog.iscanceled(): break perc = int(tools.percentage(start, sleeptime)) progress_dialog.update( perc, '\n' + '[COLOR {0}]Comprobando: [/COLOR][COLOR {1}]{2}[/COLOR]'.format( CONFIG.COLOR2, CONFIG.COLOR1, repolist[start - 1].replace( CONFIG.ADDONS, '')[1:])) xbmc.sleep(1000) if progress_dialog.iscanceled(): progress_dialog.close() logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Habilitación de Addons Cancelado[/COLOR]".format( CONFIG.COLOR2)) sys.exit() progress_dialog.close() logfile = logging.grab_log() fails = re.compile('CRepositoryUpdateJob(.+?)failed').findall(logfile) for item in fails: logging.log("Repositorio Incorrecto: {0} ".format(item)) brokenrepo = item.replace('[', '').replace(']', '').replace( ' ', '').replace('/', '').replace('\\', '') if brokenrepo not in badrepos: badrepos.append(brokenrepo) if len(badrepos) > 0: msg = "[COLOR {0}]A continuación se muestra una lista de Repositorios que no se resolvieron. Esto no significa que estén Depreciados, a veces los hosts caen por un período corto de tiempo. Realice varios escaneos de su lista de repositorios antes de eliminar un repositorio, solo para asegurarse de que esté roto.[/COLOR][CR][CR][COLOR {1}]".format( CONFIG.COLOR2, CONFIG.COLOR1) msg += '[CR]'.join(badrepos) msg += '[/COLOR]' window.show_text_box("Visualización de Repositorios Rotos", msg) else: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Todos los Repositorios Funcionan![/COLOR]".format( CONFIG.COLOR2))
def check_repos(): from resources.libs.common import logging from resources.libs.common import tools progress_dialog = xbmcgui.DialogProgress() progress_dialog.create( CONFIG.ADDONTITLE, '[COLOR {0}]Checking Repositories...[/COLOR]'.format(CONFIG.COLOR2)) badrepos = [] xbmc.executebuiltin('UpdateAddonRepos') repolist = glob.glob(os.path.join(CONFIG.ADDONS, 'repo*')) if len(repolist) == 0: progress_dialog.close() logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]No Repositories Found![/COLOR]".format(CONFIG.COLOR2)) return sleeptime = len(repolist) start = 0 while start < sleeptime: start += 1 if progress_dialog.iscanceled(): break perc = int(tools.percentage(start, sleeptime)) progress_dialog.update( perc, '', '[COLOR {0}]Checking: [/COLOR][COLOR {1}]{2}[/COLOR]'.format( CONFIG.COLOR2, CONFIG.COLOR1, repolist[start - 1].replace(CONFIG.ADDONS, '')[1:])) xbmc.sleep(1000) if progress_dialog.iscanceled(): progress_dialog.close() logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]Enabling Addons Cancelled[/COLOR]".format( CONFIG.COLOR2)) sys.exit() progress_dialog.close() logfile = logging.grab_log() fails = re.compile('CRepositoryUpdateJob(.+?)failed').findall(logfile) for item in fails: logging.log("Bad Repository: {0} ".format(item)) brokenrepo = item.replace('[', '').replace(']', '').replace( ' ', '').replace('/', '').replace('\\', '') if brokenrepo not in badrepos: badrepos.append(brokenrepo) if len(badrepos) > 0: msg = "[COLOR {0}]Below is a list of Repositories that did not resolve. This does not mean that they are Depreciated, sometimes hosts go down for a short period of time. Please do serveral scans of your repository list before removing a repository just to make sure it is broken.[/COLOR][CR][CR][COLOR {1}]".format( CONFIG.COLOR2, CONFIG.COLOR1) msg += '[CR]'.join(badrepos) msg += '[/COLOR]' window.show_text_box("Viewing Broken Repositories", msg) else: logging.log_notify( CONFIG.ADDONTITLE, "[COLOR {0}]All Repositories Working![/COLOR]".format( CONFIG.COLOR2))
def onClick(self, controlId): if controlId == self.closebutton: self.close() elif controlId == self.upload: self.close() logging.upload_log() elif controlId in [self.kodilog, self.oldlog, self.wizardlog]: if controlId == self.kodilog: newmsg = logging.grab_log() filename = logging.grab_log(file=True) elif controlId == self.oldlog: newmsg = logging.grab_log(old=True) filename = logging.grab_log(file=True, old=True) elif controlId == self.wizardlog: newmsg = logging.grab_log(wizard=True) filename = logging.grab_log(file=True, wizard=True) if not newmsg: self.setProperty('message.title', "Error Viewing Log File") self.setProperty('message.logmsg', "File does not exist or could not be read.") else: self.logmsg = newmsg self.logfile = os.path.basename(filename) self.setProperty('message.logmsg', highlight_text(self.logmsg)) self.setProperty('message.logfile', self.logfile)
def onClick(self, controlId): if controlId == self.closebutton: self.close() elif controlId == self.upload: self.close() logging.upload_log() elif controlId in [self.kodilog, self.oldlog, self.wizardlog]: if controlId == self.kodilog: newmsg = logging.grab_log() filename = logging.grab_log(file=True) elif controlId == self.oldlog: newmsg = logging.grab_log(old=True) filename = logging.grab_log(file=True, old=True) elif controlId == self.wizardlog: newmsg = logging.grab_log(wizard=True) filename = logging.grab_log(file=True, wizard=True) if not newmsg: self.setProperty('message.title', "Error al Ver el Archivo de Registro") self.setProperty('message.logmsg', "El Archivo no existe o no se pudo leer.") else: self.logmsg = newmsg self.logfile = os.path.basename(filename) self.setProperty('message.logmsg', highlight_text(self.logmsg)) self.setProperty('message.logfile', self.logfile)
def onClick(self, controlId): if controlId == self.closebutton: self.close() elif controlId == self.upload: self.close() logging.upload_log() elif controlId in [self.kodilog, self.oldlog, self.wizardlog]: if controlId == self.kodilog: O00oO000O0O = logging.grab_log() I1i1i1iii = logging.grab_log(file=True) elif controlId == self.oldlog: O00oO000O0O = logging.grab_log(old=True) I1i1i1iii = logging.grab_log(file=True, old=True) elif controlId == self.wizardlog: O00oO000O0O = logging.grab_log(wizard=True) I1i1i1iii = logging.grab_log(file=True, wizard=True) if 16 - 16: Ii1I + IiII * O0 % i1IIi.I1IiiI if not O00oO000O0O: self.setProperty('message.title', "Error Viewing Log File") self.setProperty( 'message.logmsg', "File does not exist or could not be read.") else: self.logmsg = O00oO000O0O self.logfile = os.path.basename(I1i1i1iii) if 67 - 67: OoooooooOO / I1IiiI * Ii1I + I11i self.setProperty('message.logmsg', I1i1I(self.logmsg)) self.setProperty('message.logfile', self.logfile) if 65 - 65: OoooooooOO - I1ii11iIi11i / ooOoO0o / II111iiii / i1IIi
def show_log_viewer(window_title="Viewing Log File", window_msg=None, log_file=None, ext_buttons=False): from resources.libs.common import logging class LogViewer(xbmcgui.WindowXMLDialog): def __init__(self, *args, **kwargs): self.log_file = kwargs['log_file'] def onInit(self): from resources.libs.common import tools self.title = 101 self.msg = 102 self.scrollbar = 103 self.upload = 201 self.kodilog = 202 self.oldlog = 203 self.wizardlog = 204 self.closebutton = 205 if window_msg is None: self.logmsg = tools.read_from_file(self.log_file) else: self.logmsg = window_msg self.logfile = os.path.basename(self.log_file) self.buttons = 'true' if ext_buttons else 'false' self.setProperty('texture.color1', CONFIG.COLOR1) self.setProperty('texture.color2', CONFIG.COLOR2) self.setProperty('message.title', window_title) self.setProperty('message.logmsg', highlight_text(self.logmsg)) self.setProperty('message.logfile', self.logfile) self.setProperty('message.buttons', self.buttons) def onClick(self, controlId): if controlId == self.closebutton: self.close() elif controlId == self.upload: self.close() logging.upload_log() elif controlId in [self.kodilog, self.oldlog, self.wizardlog]: if controlId == self.kodilog: newmsg = logging.grab_log() filename = logging.grab_log(file=True) elif controlId == self.oldlog: newmsg = logging.grab_log(old=True) filename = logging.grab_log(file=True, old=True) elif controlId == self.wizardlog: newmsg = logging.grab_log(wizard=True) filename = logging.grab_log(file=True, wizard=True) if not newmsg: self.setProperty('message.title', "Error Viewing Log File") self.setProperty('message.logmsg', "File does not exist or could not be read.") else: self.logmsg = newmsg self.logfile = os.path.basename(filename) self.setProperty('message.logmsg', highlight_text(self.logmsg)) self.setProperty('message.logfile', self.logfile) def onAction(self, action): if action.getId() in BACK_ACTIONS: self.close() if log_file is None: log_file = logging.grab_log(file=True) lv = LogViewer("log_viewer.xml", CONFIG.ADDON_PATH, 'Default', log_file=log_file) lv.doModal() del lv
def oOOOoo0O0oO(window_title="Viewing Log File", window_msg=None, log_file=None, ext_buttons=False): class iIII1I111III(xbmcgui.WindowXMLDialog): def __init__(self, *args, **kwargs): self.log_file = kwargs['log_file'] if 20 - 20: o0oOOo0O0Ooo.II111iiii % OOooOOo * iIii1I11I1II1 def onInit(self): self.title = 101 self.msg = 102 self.scrollbar = 103 self.upload = 201 self.kodilog = 202 self.oldlog = 203 self.wizardlog = 204 self.closebutton = 205 if 98 - 98: I1IiiI % Ii1I * OoooooooOO if window_msg is None: self.logmsg = tools.read_from_file(self.log_file) else: self.logmsg = window_msg self.logfile = os.path.basename(self.log_file) if 51 - 51: iIii1I11I1II1.OoOoOO00 / oO0o + o0oOOo0O0Ooo self.buttons = 'true' if ext_buttons else 'false' if 33 - 33: ooOoO0o.II111iiii % iII111i + o0oOOo0O0Ooo self.setProperty('texture.color1', CONFIG.COLOR1) self.setProperty('texture.color2', CONFIG.COLOR2) self.setProperty('message.title', window_title) self.setProperty('message.logmsg', I1i1I(self.logmsg)) self.setProperty('message.logfile', self.logfile) self.setProperty('message.buttons', self.buttons) if 71 - 71: Oo0Ooo % OOooOOo def onClick(self, controlId): if controlId == self.closebutton: self.close() elif controlId == self.upload: self.close() logging.upload_log() elif controlId in [self.kodilog, self.oldlog, self.wizardlog]: if controlId == self.kodilog: O00oO000O0O = logging.grab_log() I1i1i1iii = logging.grab_log(file=True) elif controlId == self.oldlog: O00oO000O0O = logging.grab_log(old=True) I1i1i1iii = logging.grab_log(file=True, old=True) elif controlId == self.wizardlog: O00oO000O0O = logging.grab_log(wizard=True) I1i1i1iii = logging.grab_log(file=True, wizard=True) if 16 - 16: Ii1I + IiII * O0 % i1IIi.I1IiiI if not O00oO000O0O: self.setProperty('message.title', "Error Viewing Log File") self.setProperty( 'message.logmsg', "File does not exist or could not be read.") else: self.logmsg = O00oO000O0O self.logfile = os.path.basename(I1i1i1iii) if 67 - 67: OoooooooOO / I1IiiI * Ii1I + I11i self.setProperty('message.logmsg', I1i1I(self.logmsg)) self.setProperty('message.logfile', self.logfile) if 65 - 65: OoooooooOO - I1ii11iIi11i / ooOoO0o / II111iiii / i1IIi def onAction(self, action): if action.getId() in o0o0Oo0oooo0: self.close() if 71 - 71: I1Ii111 + Ii1I if log_file is None: log_file = logging.grab_log(file=True) if 28 - 28: OOooOOo I11ii1IIiIi = iIII1I111III("log_viewer.xml", CONFIG.ADDON_PATH, 'Default', log_file=log_file) I11ii1IIiIi.doModal() del I11ii1IIiIi # Team KelTec Media'Play