本文整理汇总了Python中xbmcswift2.Plugin方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcswift2.Plugin方法的具体用法?Python xbmcswift2.Plugin怎么用?Python xbmcswift2.Plugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcswift2
的用法示例。
在下文中一共展示了xbmcswift2.Plugin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_plugin_from_addonxml
# 需要导入模块: import xbmcswift2 [as 别名]
# 或者: from xbmcswift2 import Plugin [as 别名]
def load_plugin_from_addonxml(cls, mode, url):
'''Attempts to import a plugin's source code and find an instance of
:class:`~xbmcswif2.Plugin`. Returns an instance of PluginManager if
succesful.
'''
cwd = os.getcwd()
sys.path.insert(0, cwd)
module_name = get_addon_module_name(os.path.join(cwd, 'addon.xml'))
addon = __import__(module_name)
# Find the first instance of xbmcswift2.Plugin
try:
plugin = (attr_value for attr_value in vars(addon).values()
if isinstance(attr_value, Plugin)).next()
except StopIteration:
sys.exit('Could\'t find a Plugin instance in %s.py' % module_name)
return cls(plugin, mode, url)
示例2: added_items
# 需要导入模块: import xbmcswift2 [as 别名]
# 或者: from xbmcswift2 import Plugin [as 别名]
def added_items(self):
'''The list of currently added items.
Even after repeated calls to :meth:`~xbmcswift2.Plugin.add_items`, this
property will contain the complete list of added items.
'''
return self._current_items
示例3: request
# 需要导入模块: import xbmcswift2 [as 别名]
# 或者: from xbmcswift2 import Plugin [as 别名]
def request(self):
'''The current :class:`~xbmcswift2.Request`.
Raises an Exception if the request hasn't been initialized yet via
:meth:`~xbmcswift2.Plugin.run()`.
'''
if self._request is None:
raise Exception('It seems the current request has not been '
'initialized yet. Please ensure that '
'`plugin.run()` has been called before attempting '
'to access the current request.')
return self._request