本文整理汇总了Python中resources.libs.wizard.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateDebrid
def updateDebrid(do, who):
file = DEBRIDID[who]['file']
settings = DEBRIDID[who]['settings']
data = DEBRIDID[who]['data']
addonid = wiz.addonId(DEBRIDID[who]['plugin'])
saved = DEBRIDID[who]['saved']
default = DEBRIDID[who]['default']
user = addonid.getSetting(default)
suser = wiz.getS(saved)
name = DEBRIDID[who]['name']
icon = DEBRIDID[who]['icon']
if do == 'update':
if not user == '':
try:
with open(file, 'w') as f:
for debrid in data:
f.write('<debrid>\n\t<id>%s</id>\n\t<value>%s</value>\n</debrid>\n' % (debrid, addonid.getSetting(debrid)))
f.close()
user = addonid.getSetting(default)
wiz.setS(saved, user)
wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Datos de Real Debrid: Guardados![/COLOR]' % COLOR2, 2000, icon)
except Exception, e:
wiz.log("[Real Debrid Data] Unable to Update %s (%s)" % (who, str(e)), xbmc.LOGERROR)
else: wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Datos de Real Debrid: No registrado![/COLOR]' % COLOR2, 2000, icon)
示例2: updateTrakt
def updateTrakt(do, who):
file = TRAKTID[who]['file']
settings = TRAKTID[who]['settings']
data = TRAKTID[who]['data']
addonid = wiz.addonId(TRAKTID[who]['plugin'])
saved = TRAKTID[who]['saved']
default = TRAKTID[who]['default']
user = addonid.getSetting(default)
suser = wiz.getS(saved)
name = TRAKTID[who]['name']
icon = TRAKTID[who]['icon']
if do == 'update':
if not user == '':
try:
with open(file, 'w') as f:
for trakt in data:
f.write('<trakt>\n\t<id>%s</id>\n\t<value>%s</value>\n</trakt>\n' % (trakt, addonid.getSetting(trakt)))
f.close()
user = addonid.getSetting(default)
wiz.setS(saved, user)
wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Trakt Data: Saved![/COLOR]' % COLOR2, 2000, icon)
except Exception, e:
wiz.log("[Trakt Data] Unable to Update %s (%s)" % (who, str(e)), xbmc.LOGERROR)
else: wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Trakt Data: Not Registered![/COLOR]' % COLOR2, 2000, icon)
示例3: allWithProgress
def allWithProgress(_in, _out, dp):
zin = zipfile.ZipFile(_in, 'r')
nFiles = float(len(zin.namelist()))
count = 0; errors = 0; error = '';
zipit = str(_in).replace('\\', '/').split('/'); zname = zipit[len(zipit)-1].replace('.zip', '')
try:
for item in zin.infolist():
count += 1; update = int(count / nFiles * 100);
file = str(item.filename).split('/')
x = len(file)-1
if file[x] == 'sources.xml' and file[x-1] == 'userdata' and KEEPSOURCES == 'true': dp.update(update, '' ,'Skipping: [COLOR yellow]%s[/COLOR]' % item.filename); wiz.log("Skipping: %s" % item.filename)
elif file[x] == 'favourites.xml' and file[x-1] == 'userdata' and KEEPFAVS == 'true': dp.update(update, '' ,'Skipping: [COLOR yellow]%s[/COLOR]' % item.filename); wiz.log("Skipping: %s" % item.filename)
elif file[x] == 'profiles.xml' and file[x-1] == 'userdata' and KEEPPROFILES == 'true': dp.update(update, '' ,'Skipping: [COLOR yellow]%s[/COLOR]' % item.filename); wiz.log("Skipping: %s" % item.filename)
elif file[x] == 'advancedsettings.xml' and file[x-1] == 'userdata' and KEEPADVANCED == 'true': dp.update(update, '' ,'Skipping: [COLOR yellow]%s[/COLOR]' % item.filename); wiz.log("Skipping: %s" % item.filename)
elif file[x] in ["kodi.log", "kodi.old.log", "Thumb.db", ".DS_Store"]: dp.update(update, '' ,'Skipping: [COLOR yellow]%s[/COLOR]' % item.filename); wiz.log("Skipping: %s" % item.filename)
elif not str(item.filename).find(ADDON_ID) == -1: dp.update(update, '' ,'Skipping: [COLOR yellow]%s[/COLOR]' % item.filename); wiz.log("Skipping: %s" % item.filename)
else:
dp.update(update, '[COLOR dodgerblue]%s[/COLOR] [Errors:%s]' % (zname, errors),'Extracting: [COLOR yellow]%s[/COLOR]' % item.filename)
try:
zin.extract(item, _out)
except Exception, e:
wiz.log('%s / %s' % (e, item.filename))
errors += 1; error += '%s\n' % e
except Exception, e:
wiz.log('%s / %s' % (Exception, e))
示例4: doNormalInstall
def doNormalInstall(self):
wiz.log("[Check Updates] [Installed Version: %s] [Current Version: %s] [User Selected: Normal Install build]" % (BUILDVERSION, LATESTVERSION), xbmc.LOGNOTICE)
wiz.log("[Check Updates] [Next Check: %s]" % str(NEXTCHECK), xbmc.LOGNOTICE)
wiz.setS('lastbuildcheck', str(NEXTCHECK))
self.close()
url = 'plugin://%s/?mode=install&name=%s&url=normal' % (ADDON_ID, urllib.quote_plus(BUILDNAME))
xbmc.executebuiltin('RunPlugin(%s)' % url)
示例5: allWithProgress
def allWithProgress(_in, _out, dp, ignore):
count = 0; errors = 0; error = ''; update = 0;
try:
zin = zipfile.ZipFile(_in, 'r')
except Exception, e:
errors += 1; error += '%s\n' % e
wiz.log('%s / %s' % (Exception, e))
return '%d/%d/%s' % (update, errors, error)
示例6: __init__
def __init__(self,L=0,T=0,W=1280,H=720,TxtColor='0xFFFFFFFF',Font='font14',BorderWidth=10):
if BUILDNAME == "" or not wiz.checkBuild(BUILDNAME, 'version'):
bgArt = ICON
icon = ICON
build = "Test Window"
version = '1.0'
latest = '1.0'
else:
bgArt = wiz.checkBuild(BUILDNAME, 'fanart')
icon = wiz.checkBuild(BUILDNAME, 'icon')
build = BUILDNAME
version = BUILDVERSION
latest = wiz.checkBuild(BUILDNAME, 'version')
wiz.log(bgArt)
image_path = os.path.join(ART, 'ContentPanel.png')
self.border = xbmcgui.ControlImage(L,T,W,H, image_path)
self.addControl(self.border);
self.BG=xbmcgui.ControlImage(L+BorderWidth, T+BorderWidth, W-(BorderWidth*2), H-(BorderWidth*2), bgArt, aspectRatio=0, colorDiffuse='0x5FFFFFFF')
self.addControl(self.BG)
#title
times = int(float(Font[-2:]))
title = ADDONTITLE
temp = title.replace('[', '<').replace(']', '>')
temp = re.sub('<[^<]+?>', '', temp)
title_width = len(str(temp))*(times - 1)
title = THEME2 % title
self.title=xbmcgui.ControlTextBox(L+(W-title_width)/2,T+BorderWidth,title_width,30,font='font14',textColor='0xFF1E90FF')
self.addControl(self.title)
self.title.setText(title)
#update
if version < latest: msg = "Update avaliable for installed build:\n[COLOR %s]%s[/COLOR]\n\nCurrent Version: v[COLOR %s]%s[/COLOR]\nLatest Version: v[COLOR %s]%s[/COLOR]\n\n[COLOR %s]*Recommened: Fresh install[/COLOR]" % (COLOR1, build, COLOR1, version, COLOR1, latest, COLOR1)
else: msg = "Running latest version of installed build:\n[COLOR %s]%s[/COLOR]\n\nCurrent Version: v[COLOR %s]%s[/COLOR]\nLatest Version: v[COLOR %s]%s[/COLOR]\n\n[COLOR %s]*Recommened: Fresh install[/COLOR]" % (COLOR1, build, COLOR1, version, COLOR1, latest, COLOR1)
msg = THEME2 % msg
self.update=xbmcgui.ControlTextBox(L+(BorderWidth*2),T+BorderWidth+30,W-150-(BorderWidth*3),H-(BorderWidth*2)-30,font=Font,textColor=TxtColor)
self.addControl(self.update)
self.update.setText(msg)
#icon
self.Icon=xbmcgui.ControlImage(L+W-(BorderWidth*2)-150, T+BorderWidth+35, 150, 150, icon, aspectRatio=0, colorDiffuse='0xAFFFFFFF')
self.addControl(self.Icon)
#buttons
focus=os.path.join(ART, 'button-focus_lightblue.png'); nofocus=os.path.join(ART, 'button-focus_grey.png')
w1 = int((W-(BorderWidth*5))/3); h1 = 35
t = int(T+H-h1-(BorderWidth*1.5))
fresh = int(L+(BorderWidth*1.5))
normal = int(fresh+w1+BorderWidth)
ignore = int(normal+w1+BorderWidth)
self.buttonFRESH=xbmcgui.ControlButton(fresh,t, w1,h1,"Fresh Install",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=focus,noFocusTexture=nofocus)
self.buttonNORMAL=xbmcgui.ControlButton(normal,t,w1,h1,"Normal Install",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=focus,noFocusTexture=nofocus)
self.buttonIGNORE=xbmcgui.ControlButton(ignore,t,w1,h1,"Ignore 3 days",textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=focus,noFocusTexture=nofocus)
self.addControl(self.buttonFRESH); self.addControl(self.buttonNORMAL); self.addControl(self.buttonIGNORE)
self.buttonIGNORE.controlLeft(self.buttonNORMAL); self.buttonIGNORE.controlRight(self.buttonFRESH)
self.buttonNORMAL.controlLeft(self.buttonFRESH); self.buttonNORMAL.controlRight(self.buttonIGNORE)
self.buttonFRESH.controlLeft(self.buttonIGNORE); self.buttonFRESH.controlRight(self.buttonNORMAL)
self.setFocus(self.buttonFRESH)
示例7: checkUpdate
def checkUpdate():
BUILDNAME = wiz.getS('buildname')
BUILDVERSION = wiz.getS('buildversion')
link = wiz.openURL(BUILDFILE).replace('\n','').replace('\r','').replace('\t','')
match = re.compile('name="%s".+?ersion="(.+?)"' % BUILDNAME).findall(link)
if len(match) > 0:
version = match[0]
wiz.setS('latestversion', version)
if version > BUILDVERSION:
notify.updateWindow()
else: wiz.log("[Check Updates] [Installed Version: %s] [Current Version: %s]" % (BUILDVERSION, version))
else: wiz.log("[Check Updates] ERROR: Unable to find build version in build text file")
示例8: loginIt
def loginIt(do, who):
if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA)
if not os.path.exists(LOGINFOLD): os.makedirs(LOGINFOLD)
if who == 'all':
for log in ORDER:
if os.path.exists(LOGINID[log]['path']): updateLogin(do, log)
else: wiz.log('[Login Data] %s(%s) is not installed' % (LOGINID[log]['name'],LOGINID[log]['plugin']))
wiz.setS('loginlastsave', str(THREEDAYS))
else:
if LOGINID[who]:
if os.path.exists(LOGINID[who]['path']):
updateLogin(do, who)
else: wiz.log('[Login Data] Invalid Entry: %s' % who)
示例9: debridIt
def debridIt(do, who):
if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA)
if not os.path.exists(REALFOLD): os.makedirs(REALFOLD)
if who == 'all':
for log in ORDER:
if os.path.exists(DEBRIDID[log]['path']): updateDebrid(do, log)
else: wiz.log('[Real Debrid Data] %s(%s) is not installed' % (DEBRIDID[log]['name'],DEBRIDID[log]['plugin']))
wiz.setS('debridlastsave', str(THREEDAYS))
else:
if DEBRIDID[who]:
if os.path.exists(DEBRIDID[who]['path']):
updateDebrid(do, who)
else: wiz.log('[Real Debrid Data] Invalid Entry: %s' % who)
示例10: readLog
def readLog(self, path):
try:
lf = xbmcvfs.File(path)
content = lf.read()
lf.close()
if content:
return True, content
else:
wiz.log('file is empty', xbmc.LOGNOTICE)
return False, "File is Empty"
except:
wiz.log('unable to read file', xbmc.LOGNOTICE)
return False, "Unable to Read File"
示例11: email_Log
def email_Log(self, email, results, file):
URL = 'http://aftermathwizard.net/mail_logs.php'
data = {'email': email, 'results': results, 'file': file, 'wizard': ADDONTITLE}
params = urlencode(data)
url_opener = pasteURLopener()
try:
result = url_opener.open(URL, params)
returninfo = result.read()
wiz.log(str(returninfo), xbmc.LOGNOTICE)
except Exception, e:
a = 'failed to connect to the server'
wiz.log("%s: %s" % (a, str(e)), xbmc.LOGERROR)
return False, a
示例12: traktIt
def traktIt(do, who):
if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA)
if not os.path.exists(TRAKTFOLD): os.makedirs(TRAKTFOLD)
if who == 'all':
for log in ORDER:
if os.path.exists(TRAKTID[log]['path']): updateTrakt(do, log)
else: wiz.log('[Trakt Data] %s(%s) is not installed' % (TRAKTID[log]['name'],TRAKTID[log]['plugin']))
wiz.setS('traktlastsave', str(THREEDAYS))
else:
if TRAKTID[who]:
if os.path.exists(TRAKTID[who]['path']):
updateTrakt(do, who)
else: wiz.log('[Trakt Data] Invalid Entry: %s' % who)
示例13: postLog
def postLog(self, data, name):
params = {}
params['poster'] = 'kodi'
params['content'] = data
params['syntax'] = 'text'
params = urlencode(params)
url_opener = pasteURLopener()
try:
page = url_opener.open(URL, params)
except Exception, e:
a = 'failed to connect to the server'
wiz.log("%s: %s" % (a, str(e)), xbmc.LOGERROR)
return False, a
示例14: showResult
def showResult(self, message, url=None):
if not url == None:
try:
fn = url.split('/')[-2]
imagefile = wiz.generateQR(url, fn)
qr = QRCode( "loguploader.xml" , ADDON.getAddonInfo('path'), 'DefaultSkin', image=imagefile, text=message)
qr.doModal()
del qr
try:
os.remove(imagefile)
except:
pass
except Exception, e:
wiz.log(str(e), xbmc.LOGNOTICE)
confirm = DIALOG.ok(ADDONTITLE, "[COLOR %s]%s[/COLOR]" % (COLOR2, message))
示例15: updateDebrid
def updateDebrid(do, who):
file = DEBRIDID[who]['file']
settings = DEBRIDID[who]['settings']
data = DEBRIDID[who]['data']
addonid = wiz.addonId(DEBRIDID[who]['plugin'])
saved = DEBRIDID[who]['saved']
default = DEBRIDID[who]['default']
user = addonid.getSetting(default)
suser = wiz.getS(saved)
name = DEBRIDID[who]['name']
icon = DEBRIDID[who]['icon']
if do == 'update':
if not user == '':
with open(file, 'w') as f:
for debrid in data: f.write('<debrid>\n\t<id>%s</id>\n\t<value>%s</value>\n</debrid>\n' % (debrid, addonid.getSetting(debrid)))
f.close()
user = addonid.getSetting(default)
wiz.setS(saved, user)
wiz.LogNotify(name,'Real Debrid Data: [COLOR green]Saved![/COLOR]', 2000, icon)
else: wiz.LogNotify(name,'Real Debrid Data: [COLOR red]Not Registered![/COLOR]', 2000, icon)
elif do == 'restore':
if os.path.exists(file):
f = open(file,mode='r'); g = f.read().replace('\n','').replace('\r','').replace('\t',''); f.close();
match = re.compile('<debrid><id>(.+?)</id><value>(.+?)</value></debrid>').findall(g)
if len(match) > 0:
for debrid, value in match:
addonid.setSetting(debrid, value)
user = addonid.getSetting(default)
wiz.setS(saved, user)
wiz.LogNotify(name,'Real Debrid: [COLOR green]Restored![/COLOR]', 2000, icon)
#else: wiz.LogNotify(name,'Real Debrid Data: [COLOR red]Not Found![/COLOR]', 2000, icon)
elif do == 'clearaddon':
wiz.log('%s SETTINGS: %s' % (name, settings))
if os.path.exists(settings):
f = open(settings,"r"); lines = f.readlines(); f.close()
f = open(settings,"w")
for line in lines:
match = re.compile('<setting.+?id="(.+?)".+?/>').findall(line)
if len(match) == 0: f.write(line)
elif match[0] not in data: f.write(line)
else: wiz.log('[Debrid Clear Addon] Removing Line: %s' % line)
f.close()
wiz.LogNotify(name,'Addon Data: [COLOR green]Cleared![/COLOR]', 2000, icon)
else: wiz.LogNotify(name,'Addon Data: [COLOR red]Clear Failed![/COLOR]', 2000, icon)
xbmc.executebuiltin('Container.Refresh')