コード例 #1
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
コード例 #2
0
ファイル: uploadLog.py プロジェクト: Shepo6/Shepo
 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
コード例 #3
0
ファイル: default.py プロジェクト: geeteev/geeteecleaner
def systemInfo():
    infoLabel = [
        'System.FriendlyName', 'System.BuildVersion', 'System.CpuUsage',
        'System.ScreenMode', 'Network.IPAddress', 'Network.MacAddress',
        'System.Uptime', 'System.TotalUptime', 'System.FreeSpace',
        'System.UsedSpace', 'System.TotalSpace', 'System.Memory(free)',
        'System.Memory(used)', 'System.Memory(total)'
    ]
    data = []
    x = 0
    for info in infoLabel:
        temp = wiz.getInfo(info)
        y = 0
        while temp == "Busy" and y < 10:
            temp = wiz.getInfo(info)
            y += 1
            wiz.log("%s sleep %s" % (info, str(y)))
            xbmc.sleep(200)
        data.append(temp)
        x += 1
    storage_free = data[8] if 'Una' in data[8] else wiz.convertSize(
        int(float(data[8][:-8])) * 1024 * 1024)
    storage_used = data[9] if 'Una' in data[9] else wiz.convertSize(
        int(float(data[9][:-8])) * 1024 * 1024)
    storage_total = data[10] if 'Una' in data[10] else wiz.convertSize(
        int(float(data[10][:-8])) * 1024 * 1024)
    ram_free = wiz.convertSize(int(float(data[11][:-2])) * 1024 * 1024)
    ram_used = wiz.convertSize(int(float(data[12][:-2])) * 1024 * 1024)
    ram_total = wiz.convertSize(int(float(data[13][:-2])) * 1024 * 1024)
    exter_ip, provider, location = getIP()

    picture = []
    music = []
    video = []
    programs = []
    repos = []
    scripts = []
    skins = []

    fold = glob.glob(os.path.join(ADDONS, '*/'))
    for folder in sorted(fold, key=lambda x: x):
        foldername = os.path.split(folder[:-1])[1]
        if foldername == 'packages': continue
        xml = os.path.join(folder, 'addon.xml')
        if os.path.exists(xml):
            f = open(xml)
            a = f.read()
            prov = re.compile("<provides>(.+?)</provides>").findall(a)
            if len(prov) == 0:
                if foldername.startswith('skin'): skins.append(foldername)
                if foldername.startswith('repo'): repos.append(foldername)
                else: scripts.append(foldername)
            elif not (prov[0]).find('executable') == -1:
                programs.append(foldername)
            elif not (prov[0]).find('video') == -1:
                video.append(foldername)
            elif not (prov[0]).find('audio') == -1:
                music.append(foldername)
            elif not (prov[0]).find('image') == -1:
                picture.append(foldername)

    addFile('[B]System Info:[/B]', '', icon=ICONMAINT, themeit=THEME2)
    addFile('[COLOR %s]Name:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[0]),
            '',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('[COLOR %s]Version:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[1]),
            '',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('[COLOR %s]Platform:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, wiz.platform().title()),
            '',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('[COLOR %s]CPU Usage:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[2]),
            '',
            icon=ICONMAINT,
            themeit=THEME3)
    addFile('[COLOR %s]Screen Mode:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[3]),
            '',
            icon=ICONMAINT,
            themeit=THEME3)

    addFile('[B]Uptime:[/B]', '', icon=ICONMAINT, themeit=THEME2)
    addFile('[COLOR %s]Current Uptime:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[6]),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Total Uptime:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[7]),
            '',
            icon=ICONMAINT,
            themeit=THEME2)

    addFile('[B]Local Storage:[/B]', '', icon=ICONMAINT, themeit=THEME2)
    addFile('[COLOR %s]Used Storage:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, storage_free),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Free Storage:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, storage_used),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Total Storage:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, storage_total),
            '',
            icon=ICONMAINT,
            themeit=THEME2)

    addFile('[B]Ram Usage:[/B]', '', icon=ICONMAINT, themeit=THEME2)
    addFile('[COLOR %s]Used Memory:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, ram_free),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Free Memory:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, ram_used),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Total Memory:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, ram_total),
            '',
            icon=ICONMAINT,
            themeit=THEME2)

    addFile('[B]Network:[/B]', '', icon=ICONMAINT, themeit=THEME2)
    addFile('[COLOR %s]Local IP:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[4]),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]External IP:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, exter_ip),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Provider:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, provider),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Location:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, location),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]MacAddress:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, data[5]),
            '',
            icon=ICONMAINT,
            themeit=THEME2)

    totalcount = len(picture) + len(music) + len(video) + len(programs) + len(
        scripts) + len(skins) + len(repos)
    addFile('[B]Addons([COLOR %s]%s[/COLOR]):[/B]' % (COLOR1, totalcount),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Video Addons:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(video))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Program Addons:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(programs))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Music Addons:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(music))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Picture Addons:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(picture))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Repositories:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(repos))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Skins:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(skins))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)
    addFile('[COLOR %s]Scripts/Modules:[/COLOR] [COLOR %s]%s[/COLOR]' %
            (COLOR1, COLOR2, str(len(scripts))),
            '',
            icon=ICONMAINT,
            themeit=THEME2)