本文整理匯總了Python中monitor.Monitor方法的典型用法代碼示例。如果您正苦於以下問題:Python monitor.Monitor方法的具體用法?Python monitor.Monitor怎麽用?Python monitor.Monitor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類monitor
的用法示例。
在下文中一共展示了monitor.Monitor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import monitor [as 別名]
# 或者: from monitor import Monitor [as 別名]
def __init__(self):
window('jellyfin_should_stop', clear=True)
self.settings['addon_version'] = client.get_version()
self.settings['profile'] = xbmc.translatePath('special://profile')
self.settings['mode'] = settings('useDirectPaths')
self.settings['log_level'] = settings('logLevel') or "1"
self.settings['auth_check'] = True
self.settings['enable_context'] = settings('enableContext.bool')
self.settings['enable_context_transcode'] = settings('enableContextTranscode.bool')
self.settings['kodi_companion'] = settings('kodiCompanion.bool')
window('jellyfin_kodiProfile', value=self.settings['profile'])
settings('platformDetected', client.get_platform())
if self.settings['enable_context']:
window('jellyfin_context.bool', True)
if self.settings['enable_context_transcode']:
window('jellyfin_context_transcode.bool', True)
LOG.info("--->>>[ %s ]", client.get_addon_name())
LOG.info("Version: %s", client.get_version())
LOG.info("KODI Version: %s", xbmc.getInfoLabel('System.BuildVersion'))
LOG.info("Platform: %s", settings('platformDetected'))
LOG.info("Python Version: %s", sys.version)
LOG.info("Using dynamic paths: %s", settings('useDirectPaths') == "0")
LOG.info("Log Level: %s", self.settings['log_level'])
verify_kodi_defaults()
window('jellyfin.connected.bool', True)
settings('groupedSets.bool', objects.utils.get_grouped_set())
xbmc.Monitor.__init__(self)
示例2: service
# 需要導入模塊: import monitor [as 別名]
# 或者: from monitor import Monitor [as 別名]
def service(self):
''' Keeps the service monitor going.
Exit on Kodi shutdown or profile switch.
if profile switch happens more than once,
Threads depending on abortRequest will not trigger.
'''
self.monitor = monitor.Monitor()
player = self.monitor.player
self.connect = connect.Connect()
self.start_default()
self.settings['mode'] = settings('useDirectPaths')
while self.running:
if window('jellyfin_online.bool'):
if self.settings['profile'] != window('jellyfin_kodiProfile'):
LOG.info("[ profile switch ] %s", self.settings['profile'])
break
if player.isPlaying() and player.is_playing_file(player.get_playing_file()):
difference = datetime.today() - self.settings['last_progress']
if difference.seconds > 10:
self.settings['last_progress'] = datetime.today()
update = (datetime.today() - self.settings['last_progress_report']).seconds > 250
event('ReportProgressRequested', {'Report': update})
if update:
self.settings['last_progress_report'] = datetime.today()
if window('jellyfin.restart.bool'):
window('jellyfin.restart', clear=True)
dialog("notification", heading="{jellyfin}", message=translate(33193), icon="{jellyfin}", time=1000, sound=False)
raise Exception('RestartService')
if self.waitForAbort(1):
break
self.shutdown()
raise Exception("ExitService")