本文整理汇总了Python中common.XBMCInterfaceUtils.displayNotification方法的典型用法代码示例。如果您正苦于以下问题:Python XBMCInterfaceUtils.displayNotification方法的具体用法?Python XBMCInterfaceUtils.displayNotification怎么用?Python XBMCInterfaceUtils.displayNotification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.XBMCInterfaceUtils
的用法示例。
在下文中一共展示了XBMCInterfaceUtils.displayNotification方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from common import XBMCInterfaceUtils [as 别名]
# 或者: from common.XBMCInterfaceUtils import displayNotification [as 别名]
def start(addon_id, service_name, context_root, default_port, allowed_port_range):
server = None
try:
sys.argv = None # To handle the situations where some library expects system arguments. Main change made for t0mm0 urlresolver library.
global __addon_id__
global __registered_services__
global __context_root__
global __port__
global __port_range__
global __service_name__
__addon_id__ = addon_id
__context_root__ = context_root
__port__ = default_port
__port_range__ = allowed_port_range
__service_name__ = service_name
containerObj = Container(addon_id=addon_id)
iconimage = AddonUtils.getCompleteFilePath(baseDirPath=containerObj.getAddonContext().addonPath, filename='icon.png')
serviceport = int(containerObj.getAddonContext().addon.getSetting('serviceport'))
XBMCInterfaceUtils.setSuppressDialogMsg(True)
if serviceport < __port_range__[0] or serviceport > __port_range__[1] :
containerObj.getAddonContext().addon.setSetting('serviceport', str(__port__))
serviceport = __port__
XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service: Port updated', 'Service port set to default value 8181', iconimage=iconimage)
server = JSONRPCServer(context_root=__context_root__, server_port=serviceport)
server.registerService('serviceName', serviceMethod)
defined_services = containerObj.getAddonContext().getTurtleServices()
if len(defined_services) == 0:
Logger.logError(__service_name__ + ' Service :: There are no services defined for registration, end this service program now.')
return
for service in defined_services:
server.registerService(service.get_service_name(), serviceMethod)
__registered_services__[service.get_service_name()] = service.get_action_id()
Logger.logInfo(__service_name__ + ' Service :: service registered = %s @ %s' % (service.get_service_name(), __context_root__))
server.start()
# XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service has started', 'Use web browser PlayIt extension to play video.', iconimage=iconimage)
while not xbmc.abortRequested:
time.sleep(1)
Logger.logInfo(__service_name__ + ' Service :: ABORT request received from XBMC. PlayIt service will stop now.')
except Exception, e:
Logger.logFatal(__service_name__ + ' Service :: ERROR OCCURRED: ' + str(e))
ExceptionHandler.handle(e)
示例2: serviceMethod
# 需要导入模块: from common import XBMCInterfaceUtils [as 别名]
# 或者: from common.XBMCInterfaceUtils import displayNotification [as 别名]
def serviceMethod(name, **params):
actionId = __registered_services__[name]
data = {'data':AddonUtils.encodeData(params)}
service_response_obj = None
try:
containerObj = Container(addon_id=__addon_id__)
iconimage = AddonUtils.getCompleteFilePath(baseDirPath=containerObj.getAddonContext().addonPath, filename='icon.png')
XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service', 'Processing received request...', iconimage=iconimage)
containerObj.reloadTurtleRequest(data)
containerObj.performAction(actionId)
service_response_obj = containerObj.getTurtleResponse().get_service_response_obj()
except Exception, e:
print __service_name__ + ' Service :: ERROR OCCURRED: ' + str(e)
ExceptionHandler.handle(e)
service_response_obj = {"status":"exception", "message":"an unexpected error occurred, please check your input"}
XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service', 'Error while processing your request', time='5000')
示例3: start
# 需要导入模块: from common import XBMCInterfaceUtils [as 别名]
# 或者: from common.XBMCInterfaceUtils import displayNotification [as 别名]
def start(addon_id, service_name, context_root, default_port, allowed_port_range):
try:
global __addon_id__
global __registered_services__
global __context_root__
global __port__
global __port_range__
global __service_name__
__addon_id__ = addon_id
__context_root__ = context_root
__port__ = default_port
__port_range__ = allowed_port_range
__service_name__ = service_name
containerObj = Container(addon_id=addon_id)
iconimage = AddonUtils.getCompleteFilePath(baseDirPath=containerObj.getAddonContext().addonPath, filename='icon.png')
serviceport = int(containerObj.getAddonContext().addon.getSetting('serviceport'))
XBMCInterfaceUtils.setSuppressDialogMsg(True)
if serviceport < __port_range__[0] or serviceport > __port_range__[1] :
containerObj.getAddonContext().addon.setSetting('serviceport', str(__port__))
serviceport = __port__
XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service: Port updated', 'Service port set to default value 8181', iconimage=iconimage)
server = JSONRPCServer(context_root=__context_root__, server_port=serviceport)
server.registerService('serviceName', serviceMethod)
defined_services = containerObj.getAddonContext().getTurtleServices()
if len(defined_services) == 0:
print __service_name__ + ' Service :: There are no services defined for registration, end this service program now.'
return
for service in defined_services:
server.registerService(service.get_service_name(), serviceMethod)
__registered_services__[service.get_service_name()] = service.get_action_id()
print __service_name__ + ' Service :: service registered = %s @ %s' % (service.get_service_name(), __context_root__)
server.start()
XBMCInterfaceUtils.displayNotification(__service_name__ + ' Service has started', 'Use safari extension to play video remotely', iconimage=iconimage)
while not xbmc.abortRequested:
time.sleep(5)
print __service_name__ + ' Service :: ABORT request received from XBMC. PlayIt service will stop now.'
except Exception, e:
print __service_name__ + ' Service :: ERROR OCCURRED: ' + str(e)
ExceptionHandler.handle(e)