本文整理汇总了Python中xbmc.LOGERROR属性的典型用法代码示例。如果您正苦于以下问题:Python xbmc.LOGERROR属性的具体用法?Python xbmc.LOGERROR怎么用?Python xbmc.LOGERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类xbmc
的用法示例。
在下文中一共展示了xbmc.LOGERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [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")
示例2: get_url
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def get_url(url, referer=self_host):
req_headers = {
'User-Agent': self_user_agent,
'Cache-Control': 'no-store, no-cache, must-revalidate',
'Pragma': 'no-cache',
'Referer': referer}
request = urllib2.Request(url, headers=req_headers)
opener = urllib2.build_opener()
try:
response = opener.open(request)
contents = response.read()
return contents
except urllib2.HTTPError, e:
log('HTTPError = ' + str(e.code), xbmc.LOGERROR)
if e.code == 400:
return False
示例3: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def __init__(self):
# Class initialisation. Fails with a RuntimeError exception if add-on is not available, or too old
self.filtered_addons = []
self.filtered_windows = []
self.primary_vpns = []
self.last_updated = 0
self.addon_name = ""
self.timeout = 30
if xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
self.addon_name = "service.vpn.manager"
elif xbmc.getCondVisibility("System.HasAddon(service.nord.vpn)"):
self.addon_name = "service.nord.vpn"
if self.addon_name == "":
xbmc.log("VPN API : A VPN add-on is not installed, cannot use filtering", level=xbmc.LOGERROR)
raise RuntimeError("VPN add-on is not installed")
else:
v = int((xbmcaddon.Addon(self.addon_name).getAddonInfo("version").strip()).replace(".",""))
if v < 310:
raise RuntimeError("VPN add-on version " + str(v) + " installed, but needs to be v3.1.0 or later")
self.refreshLists()
self.default = self.getConnected()
xbmc.log("VPN API : Default is " + self.default, level=xbmc.LOGDEBUG)
示例4: play_connect
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def play_connect(self):
'''start local connect playback - called from webservice when local connect player starts playback'''
playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
trackdetails = None
count = 0
while not trackdetails and count < 10:
try:
cur_playback = self.sp.current_playback()
trackdetails = cur_playback["item"]
except:
count += 1
xbmc.sleep(500)
if not trackdetails:
log_msg("Could not retrieve trackdetails from api, connect playback aborted", xbmc.LOGERROR)
else:
url, li = parse_spotify_track(trackdetails, silenced=False, is_connect=True)
playlist.clear()
playlist.add(url, li)
playlist.add("http://localhost:%s/nexttrack" % PROXY_PORT)
player = xbmc.Player()
player.play(playlist)
del playlist
del player
示例5: login_it
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def login_it(do, who):
if not os.path.exists(CONFIG.ADDON_DATA):
os.makedirs(CONFIG.ADDON_DATA)
if not os.path.exists(CONFIG.LOGINFOLD):
os.makedirs(CONFIG.LOGINFOLD)
if who == 'all':
for log in ORDER:
if os.path.exists(LOGINID[log]['path']):
try:
addonid = tools.get_addon_by_id(LOGINID[log]['plugin'])
default = LOGINID[log]['default']
user = addonid.getSetting(default)
update_login(do, log)
except:
pass
else:
logging.log('[Login Info] {0}({1}) is not installed'.format(LOGINID[log]['name'], LOGINID[log]['plugin']), level=xbmc.LOGERROR)
CONFIG.set_setting('loginnextsave', tools.get_date(days=3, formatted=True))
else:
if LOGINID[who]:
if os.path.exists(LOGINID[who]['path']):
update_login(do, who)
else:
logging.log('[Login Info] Invalid Entry: {0}'.format(who), level=xbmc.LOGERROR)
示例6: test_notify
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def test_notify():
from resources.libs.common import logging
from resources.libs.common import tools
from resources.libs.gui import window
response = tools.open_url(CONFIG.NOTIFICATION, check=True)
if response:
try:
id, msg = window.split_notify(CONFIG.NOTIFICATION)
if not id:
logging.log_notify(CONFIG.ADDONTITLE,
"[COLOR {0}]Notification: Not Formatted Correctly[/COLOR]".format(CONFIG.COLOR2))
return
window.show_notification(msg, test=True)
except Exception as e:
logging.log("Error on Notifications Window: {0}".format(str(e)), level=xbmc.LOGERROR)
else:
logging.log_notify(CONFIG.ADDONTITLE,
"[COLOR {0}]Invalid URL for Notification[/COLOR]".format(CONFIG.COLOR2))
示例7: trakt_it
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def trakt_it(do, who):
if not os.path.exists(CONFIG.ADDON_DATA):
os.makedirs(CONFIG.ADDON_DATA)
if not os.path.exists(CONFIG.TRAKTFOLD):
os.makedirs(CONFIG.TRAKTFOLD)
if who == 'all':
for log in ORDER:
if os.path.exists(TRAKTID[log]['path']):
try:
addonid = tools.get_addon_by_id(TRAKTID[log]['plugin'])
default = TRAKTID[log]['default']
user = addonid.getSetting(default)
update_trakt(do, log)
except:
pass
else:
logging.log('[Trakt Data] {0}({1}) is not installed'.format(TRAKTID[log]['name'], TRAKTID[log]['plugin']), level=xbmc.LOGERROR)
CONFIG.set_setting('traktnextsave', tools.get_date(days=3, formatted=True))
else:
if TRAKTID[who]:
if os.path.exists(TRAKTID[who]['path']):
update_trakt(do, who)
else:
logging.log('[Trakt Data] Invalid Entry: {0}'.format(who), level=xbmc.LOGERROR)
示例8: post_log
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def post_log(data, name):
params = {'poster': CONFIG.BUILDERNAME, 'content': data, 'syntax': 'text', 'expiration': 'week'}
params = urlencode(params)
try:
page = LogURLopener().open(URL, params)
except Exception as e:
a = 'failed to connect to the server'
log("{0}: {1}".format(a, str(e)), level=xbmc.LOGERROR)
return False, a
try:
page_url = page.url.strip()
# copy_to_clipboard(page_url)
log("URL for {0}: {1}".format(name, page_url))
return True, page_url
except Exception as e:
a = 'unable to retrieve the paste url'
log("{0}: {1}".format(a, str(e)), level=xbmc.LOGERROR)
return False, a
# CURRENTLY NOT IN USE
示例9: open_settings
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def open_settings(self, id=None, cat=None, set=None, activate=False):
offset = [(100, 200), (-100, -80)]
if not id:
id = self.ADDON_ID
try:
xbmcaddon.Addon(id).openSettings()
except:
import logging
logging.log('Cannot open settings for {}'.format(id), level=xbmc.LOGERROR)
if int(self.KODIV) < 18:
use = 0
else:
use = 1
if cat is not None:
category_id = cat + offset[use][0]
xbmc.executebuiltin('SetFocus({})'.format(category_id))
if set is not None:
setting_id = set + offset[use][1]
xbmc.executebuiltin('SetFocus({})'.format(setting_id))
if activate:
xbmc.executebuiltin('SendClick({})'.format(setting_id))
示例10: debrid_it
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def debrid_it(do, who):
if not os.path.exists(CONFIG.ADDON_DATA):
os.makedirs(CONFIG.ADDON_DATA)
if not os.path.exists(CONFIG.DEBRIDFOLD):
os.makedirs(CONFIG.DEBRIDFOLD)
if who == 'all':
for log in ORDER:
if os.path.exists(DEBRIDID[log]['path']):
try:
addonid = tools.get_addon_by_id(DEBRIDID[log]['plugin'])
default = DEBRIDID[log]['default']
user = addonid.getSetting(default)
update_debrid(do, log)
except:
pass
else:
logging.log('[Debrid Info] {0}({1}) is not installed'.format(DEBRIDID[log]['name'], DEBRIDID[log]['plugin']), level=xbmc.LOGERROR)
CONFIG.set_setting('debridnextsave', tools.get_date(days=3, formatted=True))
else:
if DEBRIDID[who]:
if os.path.exists(DEBRIDID[who]['path']):
update_debrid(do, who)
else:
logging.log('[Debrid Info] Invalid Entry: {0}'.format(who), level=xbmc.LOGERROR)
示例11: make_local
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def make_local():
fileman = FileManager()
def downloadforitem(mediaitem):
try:
fileman.downloadfor(mediaitem)
newart = dict((k, v) for k, v in mediaitem.downloadedart.iteritems()
if not v or not v.startswith('http'))
for arttype in newart:
# remove old URL from texture cache
if mediaitem.art.get(arttype, '').startswith('http'):
quickjson.remove_texture_byurl(mediaitem.art[arttype])
return newart
except FileError as ex:
mediaitem.error = ex.message
log(ex.message, xbmc.LOGERROR)
xbmcgui.Dialog().notification("Artwork Beef", ex.message, xbmcgui.NOTIFICATION_ERROR)
return {}
downloaded = runon_medialist(downloadforitem, L(M.MAKE_LOCAL), fg=True)
xbmcgui.Dialog().ok("Artwork Beef", L(M.DOWNLOAD_COUNT).format(downloaded)
+ ' - {0:0.2f}MB'.format(fileman.size / 1000000.00))
示例12: get_album_json_thread
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def get_album_json_thread(self):
try:
while not xbmc.Monitor().waitForAbort(timeout=0.01) and not self.abortAlbumThreads:
try:
album_id = self.albumQueue.get_nowait()
except:
break
try:
self.get_album(album_id, withCache=False)
except requests.HTTPError as e:
r = e.response
msg = _T(30505)
try:
msg = r.reason
msg = r.json().get('userMessage')
except:
pass
log('Error getting Album ID %s' % album_id, xbmc.LOGERROR)
if r.status_code == 429 and not self.abortAlbumThreads:
self.abortAlbumThreads = True
log('Too many requests. Aborting Workers ...', xbmc.LOGERROR)
self.albumQueue._init(9999)
xbmcgui.Dialog().notification(plugin.name, msg, xbmcgui.NOTIFICATION_ERROR)
except Exception, e:
traceback.print_exc()
示例13: log
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def log(self, txt = '', level=xbmc.LOGDEBUG):
''' Log a text into the Kodi-Logfile '''
try:
if self.detailLevel > 0 or level == xbmc.LOGERROR:
if self.detailLevel == 2 and level == xbmc.LOGDEBUG:
# More Logging
level = xbmc.LOGNOTICE
elif self.detailLevel == 3 and (level == xbmc.LOGDEBUG or level == xbmc.LOGSEVERE):
# Complex Logging
level = xbmc.LOGNOTICE
if level != xbmc.LOGSEVERE:
if isinstance(txt, unicode):
txt = unidecode(txt)
xbmc.log(b"[%s] %s" % (self.pluginName, txt), level)
except:
xbmc.log(b"[%s] Unicode Error in message text" % self.pluginName, xbmc.LOGERROR)
示例14: emit
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def emit(self, record):
if record.levelno < logging.WARNING and self._modules and not record.name in self._modules:
# Log INFO and DEBUG only with enabled modules
return
levels = {
logging.CRITICAL: xbmc.LOGFATAL,
logging.ERROR: xbmc.LOGERROR,
logging.WARNING: xbmc.LOGWARNING,
logging.INFO: xbmc.LOGNOTICE,
logging.DEBUG: xbmc.LOGSEVERE,
logging.NOTSET: xbmc.LOGNONE,
}
try:
xbmc.log(self.format(record), levels[record.levelno])
except:
try:
xbmc.log(self.format(record).encode('utf-8', 'ignore'), levels[record.levelno])
except:
xbmc.log(b"[%s] Unicode Error in message text" % self.pluginName, levels[record.levelno])
示例15: log
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import LOGERROR [as 别名]
def log(what):
xbmc.log(repr(what),xbmc.LOGERROR)