本文整理汇总了Python中utils.log_msg函数的典型用法代码示例。如果您正苦于以下问题:Python log_msg函数的具体用法?Python log_msg怎么用?Python log_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_msg函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: stop
def stop(self):
'''cleanup on exit'''
self.__exit = True
if self.__spotty_proc:
self.__spotty_proc.terminate()
log_msg("spotty terminated")
self.join(2)
开发者ID:marcelveldt,项目名称:plugin.audio.spotify,代码行数:7,代码来源:connect_daemon.py
示例2: load_widget
def load_widget(self):
"""legacy entrypoint called (widgets are moved to seperate addon), start redirect..."""
action = self.params.get("action", "")
newaddon = "script.skin.helper.widgets"
log_msg(
"Deprecated method: %s. Please reassign your widgets to get rid of this message. -"
"This automatic redirect will be removed in the future" % (action),
xbmc.LOGWARNING,
)
paramstring = ""
for key, value in self.params.iteritems():
paramstring += ",%s=%s" % (key, value)
if xbmc.getCondVisibility("System.HasAddon(%s)" % newaddon):
# TEMP !!! for backwards compatability reasons only - to be removed in the near future!!
import imp
addon = xbmcaddon.Addon(newaddon)
addon_path = addon.getAddonInfo("path").decode("utf-8")
imp.load_source("plugin", os.path.join(addon_path, "plugin.py"))
from plugin import main
main.Main()
del addon
else:
# trigger install of the addon
if KODI_VERSION >= 17:
xbmc.executebuiltin("InstallAddon(%s)" % newaddon)
else:
xbmc.executebuiltin("RunPlugin(plugin://%s)" % newaddon)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:29,代码来源:plugin_content.py
示例3: insert_data_into_db
def insert_data_into_db(timestamp, metrics):
global db, last_day, last_hour
if not timestamp:
return
new_data = []
hosts = 0
length = 0
count = 0
(day, hour, minute) = timestamp.split('|')
if last_hour != hour:
db.summarize_data('hour', last_day, last_hour)
last_hour = hour
if last_day != day:
db.summarize_data('day', last_day)
last_day = day
for host_id in metrics:
new_data.append((day, hour, minute, host_id, metrics[host_id]['length'], metrics[host_id]['count']))
hosts += 1
count += metrics[host_id]['count']
length += metrics[host_id]['length']
log_msg('adding: day='+str(day)+' '+str(hour)+':'+str(minute)+', hosts='+str(hosts)+', count='+str(count)+', length='+str(length))
db.add_bandwidth(new_data)
开发者ID:palaniyappanBala,项目名称:bwm,代码行数:28,代码来源:sniffer.py
示例4: close
def close(self):
'''Cleanup Kodi Cpython instances'''
self.artutils.close()
del self.win
del self.kodimonitor
del self.artutils
log_msg('%s version %s stopped' % (self.addonname, self.addonversion), xbmc.LOGNOTICE)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:7,代码来源:main_service.py
示例5: tvshowtitle
def tvshowtitle(self, showtitle, prefix=""):
'''set details for single show by name'''
log_msg("Set NextAired properties for TV Show: %s" % showtitle)
details = self.thetvdb.get_kodishow_details(showtitle)
if not details or not showtitle:
self.clear_properties(prefix)
else:
self.set_properties(details, prefix)
开发者ID:marcelveldt,项目名称:script.tv.show.next.aired,代码行数:8,代码来源:main_module.py
示例6: updateshow
def updateshow(self, showtitle):
'''force update of single show'''
if showtitle:
log_msg("Update show data requested for TV Show: %s" % showtitle)
self.win.setProperty("nextaired.update_data", "busy")
self.thetvdb.ignore_cache = True
self.thetvdb.get_kodishow_details(showtitle)
self.thetvdb.ignore_cache = False
self.win.clearProperty("nextaired.update_data")
开发者ID:marcelveldt,项目名称:script.tv.show.next.aired,代码行数:9,代码来源:main_module.py
示例7: onPlayBackSeek
def onPlayBackSeek(self, seekTime, seekOffset):
'''Kodi event fired when the user is seeking'''
if self.__ignore_seek:
self.__ignore_seek = False
elif self.connect_playing:
log_msg("Kodiplayer seekto: %s" % seekTime)
if self.connect_local:
self.__ignore_seek = True
self.__sp.seek_track(seekTime)
开发者ID:marcelveldt,项目名称:plugin.audio.spotify,代码行数:9,代码来源:player_monitor.py
示例8: run
def run(self):
'''called to start our webservice'''
log_msg("WebService - start helper webservice on port %s" % PORT, xbmc.LOGNOTICE)
try:
server = StoppableHttpServer(('127.0.0.1', PORT), StoppableHttpRequestHandler)
server.artutils = self.artutils
server.serve_forever()
except Exception as exc:
log_exception(__name__, exc)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:9,代码来源:webservice.py
示例9: onPlayBackStopped
def onPlayBackStopped(self):
'''Kodi event fired when playback is stopped'''
if self.connect_playing:
try:
self.__sp.pause_playback()
except Exception:
pass
log_msg("playback stopped")
self.connect_playing = False
self.connect_local = False
开发者ID:marcelveldt,项目名称:plugin.audio.spotify,代码行数:10,代码来源:player_monitor.py
示例10: refresh_video_widgets
def refresh_video_widgets(self, media_type):
'''refresh video widgets'''
if not self.update_video_widgets_busy:
self.update_video_widgets_busy = True
log_msg("Video database changed - type: %s - refreshing widgets...." % media_type)
xbmc.sleep(500)
timestr = time.strftime("%Y%m%d%H%M%S", time.gmtime())
self.win.setProperty("widgetreload", timestr)
if media_type:
self.win.setProperty("widgetreload-%ss" % media_type, timestr)
self.update_video_widgets_busy = False
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:11,代码来源:kodi_monitor.py
示例11: stop
def stop(self):
'''called when the thread needs to stop'''
try:
log_msg("WebService - stop called", 0)
conn = httplib.HTTPConnection("127.0.0.1:%d" % PORT)
conn.request("QUIT", "/")
conn.getresponse()
self.exit = True
self.event.set()
except Exception as exc:
log_exception(__name__, exc)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:11,代码来源:webservice.py
示例12: do_background_work
def do_background_work(self):
'''stuff that's processed in the background'''
try:
if self.exit:
return
log_msg("Started Background worker...")
self.set_generic_props()
self.listitem_details = {}
self.cache.check_cleanup()
log_msg("Ended Background worker...")
except Exception as exc:
log_exception(__name__, exc)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:12,代码来源:listitem_monitor.py
示例13: onNotification
def onNotification(self, sender, method, data):
'''builtin function for the xbmc.Monitor class'''
try:
log_msg("Kodi_Monitor: sender %s - method: %s - data: %s" % (sender, method, data))
data = json.loads(data.decode('utf-8'))
mediatype = ""
dbid = 0
transaction = False
if data and isinstance(data, dict):
if data.get("item"):
mediatype = data["item"].get("type", "")
dbid = data["item"].get("id", 0)
elif data.get("type"):
mediatype = data["type"]
id = data.get("id", 0)
if data.get("transaction"):
transaction = True
if method == "System.OnQuit":
self.win.setProperty("SkinHelperShutdownRequested", "shutdown")
if method == "VideoLibrary.OnUpdate":
self.process_db_update(mediatype, dbid, transaction)
if method == "AudioLibrary.OnUpdate":
self.process_db_update(mediatype, dbid, transaction)
if method == "Player.OnStop":
self.monitoring_stream = False
self.infopanelshown = False
self.win.clearProperty("Skinhelper.PlayerPlaying")
self.win.clearProperty("TrailerPlaying")
self.reset_win_props()
if not dbid:
self.process_db_update(mediatype, "", transaction)
if method == "Player.OnPlay":
self.reset_win_props()
if self.wait_for_player():
if xbmc.getCondVisibility("Player.HasAudio"):
if xbmc.getCondVisibility("Player.IsInternetStream"):
self.monitor_radiostream()
else:
self.set_music_properties()
elif xbmc.getCondVisibility("VideoPlayer.Content(livetv)"):
self.monitor_livetv()
else:
self.set_video_properties(mediatype, dbid)
self.show_info_panel()
except Exception as exc:
log_exception(__name__, exc)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:51,代码来源:kodi_monitor.py
示例14: __init__
def __init__(self):
self.cache = SimpleCache()
self.kodi_db = KodiDb()
self.win = xbmcgui.Window(10000)
try:
self.params = dict(urlparse.parse_qsl(sys.argv[2].replace("?", "").lower().decode("utf-8")))
log_msg("plugin called with parameters: %s" % self.params)
self.main()
except Exception as exc:
log_exception(__name__, exc)
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
# cleanup when done processing
self.close()
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:14,代码来源:plugin_content.py
示例15: update_data
def update_data(self, ignore_cache=False):
'''updates all data we need in cache'''
if self.win.getProperty("nextaired.update_data"):
log_msg("Update data skipped, another update is in progress")
else:
self.win.setProperty("nextaired.update_data", "busy")
# build details in cache for all continuing series in the kodi db
log_msg("Updating TheTVDB info for all continuing Kodi tv shows...", xbmc.LOGNOTICE)
self.thetvdb.ignore_cache = ignore_cache
continuing_kodi_shows = self.thetvdb.get_kodishows_details(continuing_only=True)
self.win.setProperty("NextAired.Total", "%s" % len(continuing_kodi_shows))
# build nextaired episodes listing in cache
log_msg("Retrieving next airing episodes for all continuing Kodi tv shows...", xbmc.LOGNOTICE)
want_yesterday = self.addon.getSetting("WantYesterday") == 'true'
self.thetvdb.get_kodi_unaired_episodes(include_last_episode=want_yesterday)
# set the window properties for the shows that are airing today
prev_total = self.win.getProperty("NextAired.TodayTotal")
prev_total = int(prev_total) if prev_total else 0
# clear previous properties
for count in range(prev_total + 1):
self.clear_properties("%s." % count)
shows_airing_today = self.thetvdb.get_kodishows_airingtoday()
all_titles = []
for count, show_details in enumerate(shows_airing_today):
self.set_properties(show_details, "%s." % count)
all_titles.append(show_details["title"])
self.win.setProperty("NextAired.TodayTotal", "%s" % len(shows_airing_today))
self.win.setProperty("NextAired.TodayShow", "[CR]".join(all_titles))
self.thetvdb.ignore_cache = False
self.win.clearProperty("nextaired.update_data")
log_msg("Update complete", xbmc.LOGNOTICE)
开发者ID:marcelveldt,项目名称:script.tv.show.next.aired,代码行数:31,代码来源:main_module.py
示例16: __init__
def __init__(self):
'''Initialization and main code run'''
self.win = xbmcgui.Window(10000)
self.addon = xbmcaddon.Addon(ADDON_ID)
self.thetvdb = TheTvDb()
self.set_dates()
action, action_param = self.get_params()
self.improve_dates = self.addon.getSetting("ImproveDates") == 'true'
log_msg("MainModule called with action: %s - parameter: %s" % (action, action_param))
# launch module for action provided by this script
try:
getattr(self, action)(action_param)
except Exception as exc:
log_exception(__name__, exc)
finally:
self.close()
开发者ID:marcelveldt,项目名称:script.tv.show.next.aired,代码行数:16,代码来源:main_module.py
示例17: main
def main(self):
"""main action, load correct function"""
action = self.params.get("action", "")
if self.win.getProperty("SkinHelperShutdownRequested"):
# do not proceed if kodi wants to exit
log_msg("%s --> Not forfilling request: Kodi is exiting" % __name__, xbmc.LOGWARNING)
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
else:
try:
if hasattr(self.__class__, action):
# launch module for action provided by this plugin
getattr(self, action)()
else:
# legacy (widget) path called !!!
self.load_widget()
except Exception as exc:
log_exception(__name__, exc)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:17,代码来源:plugin_content.py
示例18: __init__
def __init__(self):
addon = xbmcaddon.Addon(ADDON_ID)
addonname = addon.getAddonInfo('name').decode("utf-8")
addonversion = addon.getAddonInfo('version').decode("utf-8")
del addon
kodimonitor = xbmc.Monitor()
log_msg('%s version %s started' % (addonname, addonversion), xbmc.LOGNOTICE)
while not kodimonitor.abortRequested():
# run update task every hour
xbmc.executebuiltin("RunScript(script.tv.show.next.aired,update=True)")
kodimonitor.waitForAbort(3600)
# Abort was requested while waiting. Do cleanup
del kodimonitor
log_msg('%s version %s stopped' % (addonname, addonversion), xbmc.LOGNOTICE)
开发者ID:marcelveldt,项目名称:script.tv.show.next.aired,代码行数:17,代码来源:main_service.py
示例19: check_screensaver
def check_screensaver(self):
'''Allow user to disable screensaver on fullscreen music playback'''
if xbmc.getCondVisibility(
"Window.IsActive(visualisation) + Skin.HasSetting(SkinHelper.DisableScreenSaverOnFullScreenMusic)"):
if not self.screensaver_disabled:
# disable screensaver when fullscreen music active
self.screensaver_setting = kodi_json('Settings.GetSettingValue', '{"setting":"screensaver.mode"}')
kodi_json('Settings.SetSettingValue', {"setting": "screensaver.mode", "value": None})
self.screensaver_disabled = True
log_msg(
"Disabled screensaver while fullscreen music playback - previous setting: %s" %
self.screensaver_setting)
elif self.screensaver_setting and self.screensaver_disabled:
# enable screensaver again after fullscreen music playback was ended
kodi_json('Settings.SetSettingValue', {"setting": "screensaver.mode", "value": self.screensaver_setting})
self.screensaver_disabled = False
log_msg("fullscreen music playback ended - restoring screensaver: %s" % self.screensaver_setting)
开发者ID:marcelveldt,项目名称:script.skin.helper.service,代码行数:17,代码来源:listitem_monitor.py
注:本文中的utils.log_msg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论