本文整理匯總了Python中xbmc.LOGNOTICE屬性的典型用法代碼示例。如果您正苦於以下問題:Python xbmc.LOGNOTICE屬性的具體用法?Python xbmc.LOGNOTICE怎麽用?Python xbmc.LOGNOTICE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類xbmc
的用法示例。
在下文中一共展示了xbmc.LOGNOTICE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: emit
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [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)
示例2: Get_Seasons
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [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')
示例3: album_list
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def album_list(name, url):
link = GET_url(url)
try:
artist_url = regex_from_to(link, 'class="art_wrap__img" src="', '"')
get_artist_icon(name, artist_url)
xbmc.log("348 name = {0}\nartist_url = {1}".format(name, artist_url), xbmc.LOGNOTICE)
except:
pass
all_albums = re.compile('<a class="album_report__link" href="(.+?)"><img alt="(.+?)" class="album_report__image" src="(.+?)"/><span class="album_report__name">(.+?)</span>(.+?)"album_report__artist" href="(.+?)">(.+?)</a>, <span class="album_report__date">(.+?)</span>').findall(link)
#all_albums = re.compile('<a class="album_report__link" href="(.+?)"><img alt="(.+?)" class="album_report__image" src="(.+?)" /><span class="album_report__name">(.+?)</span>(.+?)"album_report__artist" href="(.+?)">(.+?)</a>, <span class="album_report__date">(.+?)</span>').findall(link)
for url1,d1,thumb,album,plot,artisturl,artist,year in all_albums:
title = "%s - %s - %s" % (artist, album, year)
thumb = thumb.replace('al', 'alm').replace('covers', 'mcovers')
addDir(title.replace('&', 'and'),'http://musicmp3.ru' + url1,5,thumb,'albums')
pgnumf = url.find('page=') + 5
pgnum = int(url[pgnumf:]) + 1
nxtpgurl = url[:pgnumf]
nxtpgurl = "%s%s" % (nxtpgurl, pgnum)
addDir('>> Next page', nxtpgurl, 15, art + 'nextpage.jpg', str(pgnumf))
setView('movies', 'album')
示例4: albums
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [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')
示例5: log
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def log(self, msg, level=LOGDEBUG):
# if debug isn't on, skip disabled loggers unless addon_debug is on
if not self.__debug_on:
if self in self.__disabled:
return
elif level == LOGDEBUG:
if self.__addon_debug:
level = LOGNOTICE
else:
return
try:
if isinstance(msg, six.text_type) and six.PY2:
msg = '%s (ENCODED)' % (msg.encode('utf-8'))
xbmc.log('%s: %s' % (self.__name, msg), level)
except Exception as e:
try:
xbmc.log('Logging Failure: %s' % (e), level)
except:
pass # just give up
示例6: show_notification
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def show_notification():
note_id, msg = window.split_notify(CONFIG.NOTIFICATION)
if note_id:
if note_id == CONFIG.NOTEID:
if CONFIG.NOTEDISMISS == 'false':
window.show_notification(msg)
else:
logging.log('[Notifications] No new notifications.', level=xbmc.LOGNOTICE)
elif note_id > CONFIG.NOTEID:
logging.log('[Notifications] Showing notification {0}'
.format(note_id))
CONFIG.set_setting('noteid', note_id)
CONFIG.set_setting('notedismiss', 'false')
window.show_notification(msg)
else:
logging.log('[Notifications] Notifications file at {0} not formatted correctly.'
.format(CONFIG.NOTIFICATION),
level=xbmc.LOGNOTICE)
示例7: log
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def log(msg, level=xbmc.LOGDEBUG):
if CONFIG.DEBUGLEVEL == '0': # No Logging
return False
if CONFIG.DEBUGLEVEL == '1': # Normal Logging
pass
if CONFIG.DEBUGLEVEL == '2': # Full Logging
level = xbmc.LOGNOTICE
xbmc.log('{0}: {1}'.format(CONFIG.ADDONTITLE, msg), level)
if CONFIG.ENABLEWIZLOG == 'true':
if not os.path.exists(CONFIG.WIZLOG):
with open(CONFIG.WIZLOG, 'w+') as f:
f.close()
lastcheck = CONFIG.NEXTCLEANDATE if not CONFIG.NEXTCLEANDATE == 0 else tools.get_date()
if CONFIG.CLEANWIZLOG == 'true' and time.mktime(time.strptime(lastcheck, "%Y-%m-%d %H:%M:%S")) <= tools.get_date():
check_log()
line = "[{0}] {1}".format(tools.get_date(formatted=True), msg)
line = line.rstrip('\r\n') + '\n'
tools.write_to_file(CONFIG.WIZLOG, line, mode='a')
示例8: show_result
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def show_result(message, url=None):
from resources.libs.gui import window
dialog = xbmcgui.Dialog()
if url:
try:
from resources.libs import qr
fn = url.split('/')[-2]
imagefile = qr.generate_code(url, fn)
window.show_qr_code("loguploader.xml", imagefile, message)
try:
os.remove(imagefile)
except:
pass
except Exception as e:
log(str(e), xbmc.LOGNOTICE)
confirm = dialog.ok(CONFIG.ADDONTITLE, "[COLOR %s]%s[/COLOR]" % (CONFIG.COLOR2, message))
else:
confirm = dialog.ok(CONFIG.ADDONTITLE, "[COLOR %s]%s[/COLOR]" % (CONFIG.COLOR2, message))
示例9: set_arttypes
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def set_arttypes(root, arttype_map):
for key, artlist in arttype_map.items():
if key not in mediatype_map:
if key not in unsupported_types:
log("Can't set arttypes for '{0}' in advancedsettings.xml".format(key), xbmc.LOGNOTICE)
continue
typemap = mediatype_map[key]
library_elem = root.find(typemap[1])
if library_elem is None:
library_elem = ET.SubElement(root, typemap[1])
mediatype_elem = library_elem.find(typemap[0])
if artlist:
if mediatype_elem is None:
mediatype_elem = ET.SubElement(library_elem, typemap[0])
else:
mediatype_elem.clear()
for arttype in artlist:
if arttype in typemap[2]:
continue
arttype_elem = ET.SubElement(mediatype_elem, ARTTYPE_TAG)
arttype_elem.text = arttype
elif mediatype_elem is not None:
library_elem.remove(mediatype_elem)
示例10: log
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def log(message, level=xbmc.LOGDEBUG, tag=None):
if is_addon_watched() and level < xbmc.LOGNOTICE:
# Messages from this add-on are being watched, elevate to NOTICE so Kodi logs it
level_tag = _log_level_tag_lookup[level] + ': ' if level in _log_level_tag_lookup else ''
level = xbmc.LOGNOTICE
else:
level_tag = ''
if isinstance(message, (dict, list)) and len(message) > 300:
message = str(message)
elif isinstance(message, unicode):
message = message.encode('utf-8')
elif not isinstance(message, str):
message = json.dumps(message, cls=UTF8PrettyJSONEncoder)
addontag = ADDONID if not tag else ADDONID + ':' + tag
file_message = '%s[%s] %s' % (level_tag, addontag, scrub_message(message))
xbmc.log(file_message, level)
示例11: config
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def config():
global _config
if not _config:
with shelf("antizapret.pac_config", ttl=CACHE) as pac:
if not pac.get("value"):
xbmc.log("[script.module.antizapret]: Fetching Antizapret PAC file", level=xbmc.LOGNOTICE)
try:
data = urllib2.urlopen(PAC_URL).read()
except:
data = ""
r = re.search(r"\"PROXY (.*); DIRECT", data)
pac["value"] = {
"server": None,
"domains": []
}
if r:
pac["value"]["server"] = r.group(1)
pac["value"]["domains"] = map(lambda x: x.replace(r"\Z(?ms)", "").replace("\\", ""), map(fnmatch.translate, re.findall(r"\"(.*?)\",", data)))
_config = pac["value"]
return _config
示例12: log
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [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)
示例13: emit
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [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])
示例14: onInit
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def onInit(self, success):
if success:
xbmc.log("[script.tvguide.fullscreen] Background Update Starting...", xbmc.LOGNOTICE)
self.database.updateChannelAndProgramListCaches(self.onCachesUpdated)
else:
self.database.close()
示例15: onCachesUpdated
# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import LOGNOTICE [as 別名]
def onCachesUpdated(self):
if ADDON.getSetting('notifications.enabled') == 'true':
n = notification.Notification(self.database, ADDON.getAddonInfo('path'))
n.scheduleNotifications()
if ADDON.getSetting('autoplays.enabled') == 'true':
n = autoplay.Autoplay(self.database, ADDON.getAddonInfo('path'))
n.scheduleAutoplays()
if ADDON.getSetting('autoplaywiths.enabled') == 'true':
n = autoplaywith.Autoplaywith(self.database, ADDON.getAddonInfo('path'))
n.scheduleAutoplaywiths()
self.database.close(None)
xbmc.log("[script.tvguide.fullscreen] Background Update Finished", xbmc.LOGNOTICE)
if ADDON.getSetting('background.notify') == 'true':
d = xbmcgui.Dialog()
d.notification("TV Guide Fullscreen", "Finished Updating")