Esempio n. 1
0
def viewLogFile():
    mainlog = wiz.Grab_Log(True)
    oldlog = wiz.Grab_Log(True, True)
    which = 0
    logtype = mainlog
    if not oldlog == False and not mainlog == False:
        which = DIALOG.select(ADDONTITLE, [
            "View %s" % mainlog.replace(LOG, ""),
            "View %s" % oldlog.replace(LOG, "")
        ])
        if which == -1:
            wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                          '[COLOR %s]View Log Cancelled![/COLOR]' % COLOR2)
            return
    elif mainlog == False and oldlog == False:
        wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                      '[COLOR %s]No Log File Found![/COLOR]' % COLOR2)
        return
    elif not mainlog == False:
        which = 0
    elif not oldlog == False:
        which = 1

    logtype = mainlog if which == 0 else oldlog
    msg = wiz.Grab_Log(False) if which == 0 else wiz.Grab_Log(False, True)

    wiz.TextBox("%s - %s" % (ADDONTITLE, logtype), msg)
Esempio n. 2
0
 def getFiles(self):
     logfiles = []
     log = wiz.Grab_Log(file=True)
     old = wiz.Grab_Log(file=True, old=True)
     wizard = False if not os.path.exists(WIZLOG) else WIZLOG
     if log != False:
         if os.path.exists(log): logfiles.append(['log', log])
         else: self.showResult("No log file found")
     else: self.showResult("No log file found")
     if self.oldlog:
         if old != False:
             if os.path.exists(old): logfiles.append(['oldlog', old])
             else: self.showResult("No old log file found")
         else: self.showResult("No old log file found")
     if self.wizlog:
         if wizard != False:
             logfiles.append(['wizlog', wizard])
         else:
             self.showResult("No wizard log file found")
     if self.crashlog:
         crashlog_path = ''
         items = []
         if xbmc.getCondVisibility('system.platform.osx'):
             crashlog_path = os.path.join(
                 os.path.expanduser('~'), 'Library/Logs/DiagnosticReports/')
             filematch = 'Kodi'
         elif xbmc.getCondVisibility('system.platform.ios'):
             crashlog_path = '/var/mobile/Library/Logs/CrashReporter/'
             filematch = 'Kodi'
         elif wiz.platform() == 'linux':
             crashlog_path = os.path.expanduser(
                 '~'
             )  # not 100% accurate (crashlogs can be created in the dir kodi was started from as well)
             filematch = 'kodi_crashlog'
         elif wiz.platform() == 'windows':
             wiz.log(
                 "Windows crashlogs are not supported, please disable this option in the addon settings",
                 xbmc.LOGNOTICE)
             #self.showResult("Windows crashlogs are not supported, please disable this option in the addon settings")
         elif wiz.platform() == 'android':
             wiz.log(
                 "Android crashlogs are not supported, please disable this option in the addon settings",
                 xbmc.LOGNOTICE)
             #self.showResult("Android crashlogs are not supported, please disable this option in the addon settings")
         if crashlog_path and os.path.isdir(crashlog_path):
             dirs, files = xbmcvfs.listdir(crashlog_path)
             for item in files:
                 if filematch in item and os.path.isfile(
                         os.path.join(crashlog_path, item)):
                     items.append(os.path.join(crashlog_path, item))
                     items.sort(key=lambda f: os.path.getmtime(f))
                     lastcrash = items[-1]
                     logfiles.append(['crashlog', lastcrash])
         if len(items) == 0:
             wiz.log("No crashlog file found", xbmc.LOGNOTICE)
     return logfiles
Esempio n. 3
0
 def __init__(self):
     self.getSettings()
     files = self.getFiles()
     for item in files:
         filetype = item[0]
         if filetype == 'log':
             log = wiz.Grab_Log(file=True).replace(LOG, "")
             name = log if log != False else "kodi.log"
             error = "Error posting the %s file" % name
         elif filetype == 'oldlog':
             log = wiz.Grab_Log(file=True, old=True).replace(LOG, "")
             name = log if log != False else "kodi.old.log"
             error = "Error posting the %s file" % name
         elif filetype == 'wizlog':
             name = "wizard.log"
             error = "Error posting the %s file" % name
         elif filetype == 'crashlog':
             name = "crash log"
             error = "Error posting the crashlog file"
         succes, data = self.readLog(item[1])
         if succes:
             content = self.cleanLog(data)
             succes, result = self.postLog(content, name)
             if succes:
                 msg = "Post this url or scan QRcode for your [COLOR %s]%s[/COLOR], together with a description of the problem:[CR][COLOR %s]%s[/COLOR]" % (
                     COLOR1, name, COLOR1, result)
                 if len(self.email) > 5:
                     em_result, em_msg = self.email_Log(
                         self.email, result, name)
                     if em_result == 'message':
                         msg += "[CR]%s" % em_msg
                     else:
                         msg += "[CR]Email ERROR: %s" % em_msg
                 self.showResult(msg, result)
             else:
                 self.showResult('%s[CR]%s' % (error, result))
         else:
             self.showResult('%s[CR]%s' % (error, result))
Esempio n. 4
0
 def __init__(self):
     self.getSettings()
     files = self.getFiles()
     for item in files:
         filetype = item[0]
         if filetype == 'log':
             log = wiz.Grab_Log(file=True).replace(LOG, "")
             name = log if log != False else "kodi.log"
             error = "Error posting the %s file" % name
         elif filetype == 'oldlog':
             log = wiz.Grab_Log(file=True, old=True).replace(LOG, "")
             name = log if log != False else "kodi.old.log"
             error = "Error posting the %s file" % name
         elif filetype == 'wizlog':
             name = "wizard.log"
             error = "Error posting the %s file" % name
         elif filetype == 'crashlog':
             name = "crash log"
             error = "Error posting the crashlog file"
         succes, data = self.readLog(item[1])
         if succes:
             content = self.cleanLog(data)
             succes, result = self.postLog(content, name)
             if succes:
                 msg = "Escribe esta URL para el codigo QR de [COLOR %s]%s[/COLOR], con una descripcion del problema:[CR][COLOR %s]%s[/COLOR]" % (
                     COLOR1, name, COLOR1, result)
                 if len(self.email) > 5:
                     em_result, em_msg = self.email_Log(
                         self.email, result, name)
                     if em_result == 'message':
                         msg += "[CR]%s" % em_msg
                     else:
                         msg += "[CR]Error Email: %s" % em_msg
                 self.showResult(msg, result)
             else:
                 self.showResult('%s[CR]%s' % (error, result))
         else:
             self.showResult('%s[CR]%s' % (error, result))
Esempio n. 5
0
 def __init__(self):
     self.getSettings()
     files = self.getFiles()
     for item in files:
         filetype = item[0]
         if filetype == 'log':
             log = wiz.Grab_Log(file=True).replace(LOG, "")
             name = log if log != False else "kodi.log"
             error = "Error posting the %s file" % name
         elif filetype == 'oldlog':
             log = wiz.Grab_Log(file=True, old=True).replace(LOG, "")
             name = log if log != False else "kodi.old.log"
             error = "Error posting the %s file" % name
         elif filetype == 'wizlog':
             name = "wizard.log"
             error = "Error posting the %s file" % name
         elif filetype == 'crashlog':
             name = "crash log"
             error = "Error posting the crashlog file"
         succes, data = self.readLog(item[1])
         if succes:
             content = self.cleanLog(data)
             succes, result = self.postLog(content, name)
             if succes:
                 msg = "[COLOR lime]Ako imate bilo kakva pitanja ili poteskoce javite se u[/COLOR] [COLOR cyan]Facebook[/COLOR] [COLOR lime]grupu:[/COLOR] [COLOR white]Balkan Green[/COLOR] [COLOR lime]ili posjetite web site[/COLOR] [COLOR white]kodibalkan.org[/COLOR]"
                 if len(self.email) > 5:
                     em_result, em_msg = self.email_Log(
                         self.email, result, name)
                     if em_result == 'message':
                         msg += "[CR]%s" % em_msg
                     else:
                         msg += "[CR]Email ERROR: %s" % em_msg
                 self.showResult(msg, result)
             else:
                 self.showResult('%s[CR]%s' % (error, result))
         else:
             self.showResult('%s[CR]%s' % (error, result))
Esempio n. 6
0
	def __init__(self):
		self.getSettings()
		files = self.getFiles()
		for item in files:
			filetype = item[0]
			if filetype == 'log':
				log = wiz.Grab_Log(file=True).replace(LOG, "")
				name = log if log != False else "kodi.log"
				error = "Error posting the %s file" % name
			elif filetype == 'oldlog':
				log = wiz.Grab_Log(file=True, old=True).replace(LOG, "")
				name = log if log != False else "kodi.old.log"
				error = "Error posting the %s file" % name
			elif filetype == 'wizlog':
				name = "wizard.log"
				error = "Error posting the %s file" % name
			elif filetype == 'crashlog':
				name = "crash log"
				error = "Error posting the crashlog file"
			succes, data = self.readLog(item[1])
			if succes:
				content = self.cleanLog(data)
				succes, result = self.postLog(content, name)
				if succes:
					msg = "Poste diese URL oder scanne den QRcode fuer dein [COLOR %s]%s[/COLOR], zusammen mit einer Beschreibung deines Problems:[CR][COLOR %s]%s[/COLOR] [COLOR red]Funktioniert noch nicht, wir sind dabei dieses Problem zu beheben...[/COLOR]" % (COLOR1, name, COLOR1, result)
					if len(self.email) > 5: 
						em_result, em_msg = self.email_Log(self.email, result, name)
						if em_result == 'message':
							msg += "[CR]%s" % em_msg
						else:
							msg += "[CR]Email ERROR: %s" % em_msg
					self.showResult(msg, result)
				else:
					self.showResult('%s[CR]%s' % (error, result))
			else:
				self.showResult('%s[CR]%s' % (error, result))
Esempio n. 7
0
 def onClick(self, controlId):
     if controlId == self.okbutton: self.close()
     elif controlId == self.upload:
         self.close()
         uploadLog.Main()
     elif controlId == self.kodi:
         newmsg = wiz.Grab_Log(False)
         filename = wiz.Grab_Log(True)
         if newmsg == False:
             self.titlemsg = "%s: View Log Error" % ADDONTITLE
             self.getControl(
                 self.msg).setText("Log File Does Not Exists!")
         else:
             self.titlemsg = "%s: %s" % (ADDONTITLE,
                                         filename.replace(LOG, ''))
             self.getControl(self.title).setLabel(self.titlemsg)
             self.getControl(self.msg).setText(
                 wiz.highlightText(newmsg))
             self.setFocusId(self.scrollbar)
     elif controlId == self.kodiold:
         newmsg = wiz.Grab_Log(False, True)
         filename = wiz.Grab_Log(True, True)
         if newmsg == False:
             self.titlemsg = "%s: View Log Error" % ADDONTITLE
             self.getControl(
                 self.msg).setText("Log File Does Not Exists!")
         else:
             self.titlemsg = "%s: %s" % (ADDONTITLE,
                                         filename.replace(LOG, ''))
             self.getControl(self.title).setLabel(self.titlemsg)
             self.getControl(self.msg).setText(
                 wiz.highlightText(newmsg))
             self.setFocusId(self.scrollbar)
     elif controlId == self.wizard:
         newmsg = wiz.Grab_Log(False, False, True)
         filename = wiz.Grab_Log(True, False, True)
         if newmsg == False:
             self.titlemsg = "%s: View Log Error" % ADDONTITLE
             self.getControl(
                 self.msg).setText("Log File Does Not Exists!")
         else:
             self.titlemsg = "%s: %s" % (
                 ADDONTITLE, filename.replace(ADDONDATA, ''))
             self.getControl(self.title).setLabel(self.titlemsg)
             self.getControl(self.msg).setText(
                 wiz.highlightText(newmsg))
             self.setFocusId(self.scrollbar)
Esempio n. 8
0
def LogViewer(default=None):
    class LogViewer(xbmcgui.WindowXMLDialog):
        def __init__(self, *args, **kwargs):
            self.default = kwargs['default']

        def onInit(self):
            self.title = 101
            self.msg = 102
            self.scrollbar = 103
            self.upload = 201
            self.kodi = 202
            self.kodiold = 203
            self.wizard = 204
            self.okbutton = 205
            f = open(self.default, 'r')
            self.logmsg = f.read()
            f.close()
            self.titlemsg = "%s: %s" % (ADDONTITLE,
                                        self.default.replace(LOG, '').replace(
                                            ADDONDATA, ''))
            self.showdialog()

        def showdialog(self):
            self.getControl(self.title).setLabel(self.titlemsg)
            self.getControl(self.msg).setText(wiz.highlightText(self.logmsg))
            self.setFocusId(self.scrollbar)

        def onClick(self, controlId):
            if controlId == self.okbutton: self.close()
            elif controlId == self.upload:
                self.close()
                uploadLog.Main()
            elif controlId == self.kodi:
                newmsg = wiz.Grab_Log(False)
                filename = wiz.Grab_Log(True)
                if newmsg == False:
                    self.titlemsg = "%s: View Log Error" % ADDONTITLE
                    self.getControl(
                        self.msg).setText("Log File Does Not Exists!")
                else:
                    self.titlemsg = "%s: %s" % (ADDONTITLE,
                                                filename.replace(LOG, ''))
                    self.getControl(self.title).setLabel(self.titlemsg)
                    self.getControl(self.msg).setText(
                        wiz.highlightText(newmsg))
                    self.setFocusId(self.scrollbar)
            elif controlId == self.kodiold:
                newmsg = wiz.Grab_Log(False, True)
                filename = wiz.Grab_Log(True, True)
                if newmsg == False:
                    self.titlemsg = "%s: View Log Error" % ADDONTITLE
                    self.getControl(
                        self.msg).setText("Log File Does Not Exists!")
                else:
                    self.titlemsg = "%s: %s" % (ADDONTITLE,
                                                filename.replace(LOG, ''))
                    self.getControl(self.title).setLabel(self.titlemsg)
                    self.getControl(self.msg).setText(
                        wiz.highlightText(newmsg))
                    self.setFocusId(self.scrollbar)
            elif controlId == self.wizard:
                newmsg = wiz.Grab_Log(False, False, True)
                filename = wiz.Grab_Log(True, False, True)
                if newmsg == False:
                    self.titlemsg = "%s: View Log Error" % ADDONTITLE
                    self.getControl(
                        self.msg).setText("Log File Does Not Exists!")
                else:
                    self.titlemsg = "%s: %s" % (
                        ADDONTITLE, filename.replace(ADDONDATA, ''))
                    self.getControl(self.title).setLabel(self.titlemsg)
                    self.getControl(self.msg).setText(
                        wiz.highlightText(newmsg))
                    self.setFocusId(self.scrollbar)

        def onAction(self, action):
            if action == ACTION_PREVIOUS_MENU: self.close()
            elif action == ACTION_NAV_BACK: self.close()

    if default == None: default = wiz.Grab_Log(True)
    lv = LogViewer("LogViewer.xml",
                   ADDON.getAddonInfo('path'),
                   'DefaultSkin',
                   default=default)
    lv.doModal()
    del lv
Esempio n. 9
0
def errorChecking(log=None, count=None, all=None):
    if log == None:
        mainlog = wiz.Grab_Log(True)
        oldlog = wiz.Grab_Log(True, True)
        if not oldlog == False and not mainlog == False:
            which = DIALOG.select(ADDONTITLE, [
                "View %s: %s error(s)" %
                (mainlog.replace(LOG, ""), errorChecking(mainlog, True, True)),
                "View %s: %s error(s)" %
                (oldlog.replace(LOG, ""), errorChecking(oldlog, True, True))
            ])
            if which == -1:
                wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                              '[COLOR %s]View Log Cancelled![/COLOR]' % COLOR2)
                return
        elif mainlog == False and oldlog == False:
            wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                          '[COLOR %s]No Log File Found![/COLOR]' % COLOR2)
            return
        elif not mainlog == False:
            which = 0
        elif not oldlog == False:
            which = 1
        log = mainlog if which == 0 else oldlog
    if log == False:
        if count == None:
            wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE),
                          "[COLOR %s]Log File not Found[/COLOR]" % COLOR2)
            return False
        else:
            return 0
    else:
        if os.path.exists(log):
            f = open(log, mode='r')
            a = f.read().replace('\n', '').replace('\r', '')
            f.close()
            match = re.compile(
                "-->Python callback/script returned the following error<--(.+?)-->End of Python script error report<--"
            ).findall(a)
            if not count == None:
                if all == None:
                    x = 0
                    for item in match:
                        if ADDON_ID in item: x += 1
                    return x
                else:
                    return len(match)
            if len(match) > 0:
                x = 0
                msg = ""
                for item in match:
                    if all == None and not ADDON_ID in item: continue
                    else:
                        x += 1
                        msg += "[COLOR red]Error Number %s[/COLOR]\n(PythonToCppException) : -->Python callback/script returned the following error<--%s-->End of Python script error report<--\n\n" % (
                            x,
                            item.replace(
                                '                                          ',
                                '\n').replace('\\\\', '\\').replace(HOME, ''))
                if x > 0:
                    wiz.TextBox(ADDONTITLE, msg)
                else:
                    wiz.LogNotify(ADDONTITLE, "No Errors Found in Log")
            else:
                wiz.LogNotify(ADDONTITLE, "No Errors Found in Log")
        else:
            wiz.LogNotify(ADDONTITLE, "Log File not Found")
Esempio n. 10
0
def index():

    on = '[B][COLOR green]ON[/COLOR][/B]'
    off = '[B][COLOR red]OFF[/COLOR][/B]'
    autoclean = 'true' if AUTOCLEANUP == 'true' else 'false'
    cache = 'true' if AUTOCACHE == 'true' else 'false'
    packages = 'true' if AUTOPACKAGES == 'true' else 'false'
    thumbs = 'true' if AUTOTHUMBS == 'true' else 'false'
    maint = 'true' if SHOWMAINT == 'true' else 'false'
    includevid = 'true' if INCLUDEVIDEO == 'true' else 'false'
    includeall = 'true' if INCLUDEALL == 'true' else 'false'
    if wiz.Grab_Log(True) == False: kodilog = 0
    else: kodilog = errorChecking(wiz.Grab_Log(True), True, True)
    if wiz.Grab_Log(True, True) == False: kodioldlog = 0
    else: kodioldlog = errorChecking(wiz.Grab_Log(True, True), True, True)
    errorsinlog = int(kodilog) + int(kodioldlog)
    errorsfound = str(
        errorsinlog) + ' Error(s) Found' if errorsinlog > 0 else 'None Found'
    wizlogsize = ': [COLOR red]Not Found[/COLOR]' if not os.path.exists(
        WIZLOG) else ": [COLOR green]%s[/COLOR]" % wiz.convertSize(
            os.path.getsize(WIZLOG))
    if includeall == 'true':
        includebob = 'true'
        includebobp = 'true'
        includepho = 'true'
        includespe = 'true'
        includespes = 'true'
        includegen = 'true'
        includeexo = 'true'
        includeexop = 'true'
        includeone = 'true'
        includesal = 'true'
        includeshd = 'true'
    else:
        includebob = 'true' if INCLUDEBOB == 'true' else 'false'
        includebobp = 'true' if INCLUDEBOBP == 'true' else 'false'
        includepho = 'true' if INCLUDEPHOENIX == 'true' else 'false'
        includespe = 'true' if INCLUDESPECTO == 'true' else 'false'
        includespes = 'true' if INCLUDESPECTOS == 'true' else 'false'
        includegen = 'true' if INCLUDEGENESIS == 'true' else 'false'
        includeexo = 'true' if INCLUDEEXODUS == 'true' else 'false'
        includeexop = 'true' if INCLUDEEXODUSP == 'true' else 'false'
        includeone = 'true' if INCLUDEONECHAN == 'true' else 'false'
        includesal = 'true' if INCLUDESALTS == 'true' else 'false'
        includeshd = 'true' if INCLUDESALTSHD == 'true' else 'false'
    sizepack = wiz.getSize(PACKAGES)
    sizethumb = wiz.getSize(THUMBS)
    sizecache = wiz.getCacheSize()
    totalsize = sizepack + sizethumb + sizecache
    feq = ['Always', 'Daily', '3 Days', 'Weekly', 'Monthly']
    addDir('[B]Cleaning Tools[/B]', '', '', icon=ICONMAINT, themeit=THEME1)

    addFile('Total Clean Up: [COLOR green][B]%s[/B][/COLOR]' %
            wiz.convertSize(totalsize),
            'fullclean',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Clear Cache: [COLOR green][B]%s[/B][/COLOR]' %
            wiz.convertSize(sizecache),
            'clearcache',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Clear Packages: [COLOR green][B]%s[/B][/COLOR]' %
            wiz.convertSize(sizepack),
            'clearpackages',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Clear Thumbnails: [COLOR green][B]%s[/B][/COLOR]' %
            wiz.convertSize(sizethumb),
            'clearthumb',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Clear Old Thumbnails',
            'oldThumbs',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Clear Crash Logs', 'clearcrash', icon=ICONMAINT, themeit=THEME3)
    addFile('Purge Databases', 'purgedb', icon=ICONMAINT, themeit=THEME3)
    addFile(
        'Fresh Start,[COLOR red][B] WARNING This will wipe your Kodi data[/COLOR][/B]',
        'freshstart',
        icon=ICONMAINT,
        themeit=THEME3)

    if HIDESPACERS == 'No': addFile(wiz.sep(), '', themeit=THEME3)
    addDir('[B]Maintenance Tools[/B]', '', icon=ICONMAINT, themeit=THEME1)
    addFile('Test only 1', 'test1', icon=ICONMAINT, themeit=THEME3)
    addFile('Test 2run', 'test2', icon=ICONMAINT, themeit=THEME3)
    addFile('Scan Sources for broken links',
            'checksources',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Scan For Broken Repositories',
            'checkrepos',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Remove Non-Ascii filenames',
            'asciicheck',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Convert Paths to special',
            'convertpath',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('Show my IP address', 'getip', icon=ICONMAINT, themeit=THEME3)
    addFile('View Kodi Log', 'viewlogfile', icon=ICONMAINT, themeit=THEME3)
    addDir('System Information', 'systeminfo', icon=ICONMAINT, themeit=THEME3)

    if HIDESPACERS == 'No': addFile(wiz.sep(), '', themeit=THEME3)
    addFile('Settings', 'settings', icon=ICONSETTINGS, themeit=THEME1)

    setView('files', 'viewType')