本文整理汇总了Python中xbmc.log方法的典型用法代码示例。如果您正苦于以下问题:Python xbmc.log方法的具体用法?Python xbmc.log怎么用?Python xbmc.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmc
的用法示例。
在下文中一共展示了xbmc.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jsonrpc
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def jsonrpc(*args, **kwargs):
"""Perform JSONRPC calls"""
from json import dumps, loads
# We do not accept both args and kwargs
if args and kwargs:
log(4, 'ERROR: Wrong use of jsonrpc()')
return None
# Process a list of actions
if args:
for (idx, cmd) in enumerate(args):
if cmd.get('id') is None:
cmd.update(id=idx)
if cmd.get('jsonrpc') is None:
cmd.update(jsonrpc='2.0')
return loads(xbmc.executeJSONRPC(dumps(args)))
# Process a single action
if kwargs.get('id') is None:
kwargs.update(id=0)
if kwargs.get('jsonrpc') is None:
kwargs.update(jsonrpc='2.0')
return loads(xbmc.executeJSONRPC(dumps(kwargs)))
示例2: emit
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def emit(self, record):
if self._get_log_level(record.levelno):
try:
string = self.format(record)
except Exception as error:
xbmc.log("Error trying to format string for log", level=xbmc.LOGNOTICE)
return
if self.mask_info:
for server in self.sensitive['Server']:
string = string.replace(server.encode('utf-8') or "{server}", "{emby-server}")
for token in self.sensitive['Token']:
string = string.replace(token.encode('utf-8') or "{token}", "{emby-token}")
try:
xbmc.log(string, level=xbmc.LOGNOTICE)
except UnicodeEncodeError:
xbmc.log(string.encode('utf-8'), level=xbmc.LOGNOTICE)
示例3: deleteDB
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def deleteDB():
try:
xbmc.log("[script.tvguide.fullscreen] Deleting database...", xbmc.LOGDEBUG)
dbPath = xbmc.translatePath(xbmcaddon.Addon(id = 'script.tvguide.fullscreen').getAddonInfo('profile'))
dbPath = os.path.join(dbPath, 'source.db')
delete_file(dbPath)
passed = not os.path.exists(dbPath)
if passed:
xbmc.log("[script.tvguide.fullscreen] Deleting database...PASSED", xbmc.LOGDEBUG)
else:
xbmc.log("[script.tvguide.fullscreen] Deleting database...FAILED", xbmc.LOGDEBUG)
return passed
except Exception, e:
xbmc.log('[script.tvguide.fullscreen] Deleting database...EXCEPTION', xbmc.LOGDEBUG)
return False
示例4: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def __init__(self, addon, force):
self.needReset = False
self.fetchError = False
self.start = True
self.force = force
'''
self.xmltvInterval = int(addon.getSetting('sd.interval'))
self.logoSource = int(addon.getSetting('logos.source'))
self.addonsType = int(addon.getSetting('addons.ini.type'))
# make sure the folder in the user's profile exists or create it!
if not os.path.exists(self.PLUGIN_DATA):
os.makedirs(self.PLUGIN_DATA)
# make sure the ini file is fetched as well if necessary
if self.addonsType != self.INI_TYPE_DEFAULT:
customFile = str(addon.getSetting('addons.ini.file'))
if os.path.exists(customFile):
# uses local file provided by user!
xbmc.log('[%s] Use local file: %s' % (ADDON.getAddonInfo('id'), customFile), xbmc.LOGDEBUG)
else:
# Probably a remote file
xbmc.log('[%s] Use remote file: %s' % (ADDON.getAddonInfo('id'), customFile), xbmc.LOGDEBUG)
self.updateLocalFile(customFile, addon, True, force=force)
'''
示例5: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def __init__(self):
# Class initialisation. Fails with a RuntimeError exception if VPN Manager add-on is not available, or too old
self.filtered_addons = []
self.filtered_windows = []
self.primary_vpns = []
self.last_updated = 0
self.refreshLists()
self.default = self.getConnected()
xbmc.log("VPN Mgr API : Default is " + self.default, level=xbmc.LOGDEBUG)
self.timeout = 30
if not xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
xbmc.log("VPN Mgr API : VPN Manager is not installed, cannot use filtering", level=xbmc.LOGERROR)
raise RuntimeError("VPN Manager is not installed")
else:
v = int((xbmcaddon.Addon("service.vpn.manager").getAddonInfo("version").strip()).replace(".",""))
if v < 310:
raise RuntimeError("VPN Manager " + str(v) + " installed, but needs to be v3.1.0 or later")
示例6: connectToValidated
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def connectToValidated(self, connection, wait):
# Given the number of a validated connection, connect to it. Return True when the connection has happened
# or False if there's a problem connecting (or there's not a VPN connection available for this connection
# number). Return True without messing with the connection if the current VPN is the same as the VPN being
# requested. The wait parameter will determine if the function returns once the connection has been made,
# or if it's fire and forget (in which case True will be returned regardless)
if not self.isVPNSetUp(): return False
if connection < 1 or connection > 10: return False
connection = connection - 1
self.refreshLists()
if self.primary_vpns[connection] == "": return False
if self.getConnected() == self.primary_vpns[connection]: return True
xbmc.log(msg="VPN Mgr API : Connecting to " + self.primary_vpns[connection], level=xbmc.LOGDEBUG)
self.setAPICommand(self.primary_vpns[connection])
if wait: return self.waitForConnection(self.primary_vpns[connection])
return True
示例7: get_gam_genres
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def get_gam_genres(url): # 3
try:
r = requests.get(url).text
r = client.parseDOM(r, 'li', attrs={'id': r'menu-item-\d+'})[1:]
# xbmc.log('POSTs: {}'.format(r))
# r = client.parseDOM(r, 'div', attrs={'class': 'categorias'})[0]
# r = client.parseDOM(r, 'li', attrs={'class': 'cat-item.+?'})
for post in r:
try:
# xbmc.log('POST: {}'.format(post))
url = client.parseDOM(post, 'a', ret='href')[0]
name = client.parseDOM(post, 'a')[0]
name = clear_Title(name).encode('utf-8')
if 'facebook' in url or 'imdb' in url:
continue
# xbmc.log('NAME: {} | URL: {}'.format(name, url))
addDir('[B][COLOR white]%s[/COLOR][/B]' % name, url, 4, ART + 'movies.jpg', FANART, '')
except BaseException:
pass
except BaseException:
pass
views.selectView('menu', 'menu-view')
示例8: Get_Seasons
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def Get_Seasons(url, name):#4
r = client.request(url).decode('latin-1').encode('utf-8')
episodes = client.parseDOM(r, 'div', attrs={'class': 'tab-content'})[0]
data = client.parseDOM(r, 'div', attrs={'class': 'VideoPlayer'})[0]
poster = client.parseDOM(r, 'img', ret='src')[0]
ss = zip(client.parseDOM(data, 'a', ret='href'),
client.parseDOM(data, 'a'))
xbmc.log('@#@SEASONS:%s' % ss, xbmc.LOGNOTICE)
desc = client.parseDOM(r, 'p', attrs={'class': 'text-dark font-size-13'})[0].encode('latin-1')
desc = clear_Title(desc)
for i in ss:
xbmc.log('@#@FOR-i:%s' % i[1], xbmc.LOGNOTICE)
season = re.sub('[\n|\t|\r|\s]', '', i[1])
surl = url + '|' + episodes.encode('utf-8') + '|' + i[0][1:].encode('utf-8') + '|' + str(poster)
title = '[B][COLOR white]%s [B]| [COLOR lime]%s[/COLOR][/B]' % (name, season)
addDir(title, surl, 7, poster, FANART, desc)
setView('movies', 'menu-view')
示例9: deleteFile
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def deleteFile(filename):
log('Deleting %s' % filename)
if len(filename) < 1:
log('Empty filename')
return
try: current = xbmc.Player().getPlayingFile() if xbmc.Player().isPlaying() else ''
except: current = ''
while current == filename:
try: current = xbmc.Player().getPlayingFile() if xbmc.Player().isPlaying() else ''
except: current = ''
xbmc.sleep(1000)
tries = 15
while xbmcvfs.exists(filename) and tries > 0:
tries -= 1
try:
xbmcvfs.delete(filename)
except Exception, e:
log('ERROR %s in deleteFile %s' % (str(e), filename))
log('ERROR tries=%d' % tries)
xbmc.sleep(500)
示例10: stopDownloaders
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def stopDownloaders():
log('in STOPDOWNLOADERS')
#signal all downloaders to stop
for i in range(MAX_DOWNLOADERS):
state = xbmcgui.Window(10000).getProperty(PROPERTY % i)
if state:
xbmcgui.Window(10000).setProperty(PROPERTY % i, 'Signal')
#now wait for them to all stop
i = 0
while i < MAX_DOWNLOADERS:
state = xbmcgui.Window(10000).getProperty(PROPERTY % i)
if state:
xbmc.sleep(100)
i = 0
else:
i += 1
示例11: albums
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def albums(name, url):
duplicate = []
link = GET_url(url)
try:
artist_url = regex_from_to(link, 'class="album_report__image"\s*', '"')
get_artist_icon(name, artist_url)
xbmc.log("370 name = {0}\nartist_url = {1}".format(name, artist_url), xbmc.LOGNOTICE)
except:
pass
all_albums = re.compile('<div class="album_report"><h5 class="album_report__heading"><a class="album_report__link" href="(.+?)"><img alt="(.+?)" class="album_report__image" src="(.+?)"/><span class="album_report__name">(.+?)</span></a></h5><div cla(.+?)lbum_report__second_line"><span class="album_report__date">(.+?)</span>').findall(link)
#all_albums = re.compile('<div class="album_report"><h5 class="album_report__heading"><a class="album_report__link" href="(.+?)"><img alt="(.+?)" class="album_report__image" src="(.+?)"/><span class="album_report__name">(.+?)</span></a></h5><div class="album_report__second_line"><span class="album_report__date">(.+?)</span>').findall(link)
for url1,d1,thumb,album,d2,year in all_albums:
title = "%s - %s - %s" % (name, album, year)
if title not in duplicate:
duplicate.append(title)
thumb = thumb.replace('al', 'alm').replace('covers', 'mcovers')
addDir(title.replace('&', 'and'),'http://musicmp3.ru' + url1,5,thumb,'albums')
setView('movies', 'album')
示例12: derot
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def derot(xset, hset, src):
xset = eval(xset)
hset = eval(hset)
import string
o = ''
u = ''
il = 0
for first in hset:
u += first
o += xset[il]
il += 1
rot13 = string.maketrans(o, u)
link = string.translate(src, rot13)
xbmc.log('@#@DEROT-LINK: %s' % link, xbmc.LOGNOTICE)
return link
示例13: log
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def log(level=0, message='', **kwargs):
"""Log info messages to Kodi"""
if kwargs:
from string import Formatter
message = Formatter().vformat(message, (), SafeDict(**kwargs))
message = '[{addon}] {message}'.format(addon=addon_id(), message=message)
xbmc.log(from_unicode(message), level)
示例14: copy
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def copy(src, dest):
"""Copy a file (using xbmcvfs)"""
from xbmcvfs import copy as vfscopy
log(2, "Copy file '{src}' to '{dest}'.", src=src, dest=dest)
return vfscopy(from_unicode(src), from_unicode(dest))
示例15: delete
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import log [as 别名]
def delete(path):
"""Remove a file (using xbmcvfs)"""
from xbmcvfs import delete as vfsdelete
log(2, "Delete file '{path}'.", path=path)
return vfsdelete(from_unicode(path))