本文整理汇总了Python中xbmcplugin.setPluginCategory方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcplugin.setPluginCategory方法的具体用法?Python xbmcplugin.setPluginCategory怎么用?Python xbmcplugin.setPluginCategory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcplugin
的用法示例。
在下文中一共展示了xbmcplugin.setPluginCategory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: browse_subfolders
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def browse_subfolders(media, view_id, server_id=None):
''' Display submenus for emby views.
'''
from views import DYNNODES
get_server(server_id)
view = EMBY['api'].get_item(view_id)
xbmcplugin.setPluginCategory(int(sys.argv[1]), view['Name'])
nodes = DYNNODES[media]
for node in nodes:
params = {
'id': view_id,
'mode': "browse",
'type': media,
'folder': view_id if node[0] == 'all' else node[0],
'server': server_id
}
path = "%s?%s" % ("plugin://plugin.video.emby/", urllib.urlencode(params))
directory(node[1] or view['Name'], path)
xbmcplugin.setContent(int(sys.argv[1]), 'files')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
示例2: browse_letters
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def browse_letters(media, view_id, server_id=None):
''' Display letters as options.
'''
letters = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ"
get_server(server_id)
view = EMBY['api'].get_item(view_id)
xbmcplugin.setPluginCategory(int(sys.argv[1]), view['Name'])
for node in letters:
params = {
'id': view_id,
'mode': "browse",
'type': media,
'folder': 'firstletter-%s' % node,
'server': server_id
}
path = "%s?%s" % ("plugin://plugin.video.emby/", urllib.urlencode(params))
directory(node, path)
xbmcplugin.setContent(int(sys.argv[1]), 'files')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
示例3: channeltypes
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def channeltypes(params,url,category):
logger.info("channelselector.channeltypes")
lista = getchanneltypes()
for item in lista:
addfolder(item.title,item.channel,item.action,category=item.category,thumbnailname=item.thumbnail)
if config.get_platform()=="kodi-krypton" or config.get_platform()=="kodi-leia":
import plugintools
plugintools.set_view( plugintools.TV_SHOWS )
# Label (top-right)...
import xbmcplugin
xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
if config.get_setting("forceview")=="true":
# Confluence - Thumbnail
import xbmc
xbmc.executebuiltin("Container.SetViewMode(500)")
示例4: listchannels
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def listchannels(params,url,category):
logger.info("channelselector.listchannels")
lista = filterchannels(category)
for channel in lista:
if config.is_xbmc() and (channel.type=="xbmc" or channel.type=="generic"):
addfolder(channel.title , channel.channel , "mainlist" , channel.channel)
elif config.get_platform()=="boxee" and channel.extra!="rtmp":
addfolder(channel.title , channel.channel , "mainlist" , channel.channel)
if config.get_platform()=="kodi-krypton" or config.get_platform()=="kodi-leia":
import plugintools
plugintools.set_view( plugintools.TV_SHOWS )
# Label (top-right)...
import xbmcplugin
xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
if config.get_setting("forceview")=="true":
# Confluence - Thumbnail
import xbmc
xbmc.executebuiltin("Container.SetViewMode(500)")
示例5: onInit
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def onInit():
xbmcplugin.setPluginCategory(HANDLE, 'Websites')
xbmcplugin.setContent(HANDLE, 'movies')
# show global search link
url = build_url({'mode': 'globalsearch'})
xbmcplugin.addDirectoryItem(HANDLE, url,
xbmcgui.ListItem(label="[COLOR yellow][B] %s [/B][/COLOR]" % "Search All..."), True)
for site in SITES:
if site['version'] > KODI_VERSION:
print("***********************Skip version %d" % site['version'])
continue
list_item = xbmcgui.ListItem(label=site['name'])
list_item.addContextMenuItems(globalContextMenu())
list_item.setArt({'thumb': site['logo'], 'icon': site['logo']})
url = build_url({'mode': 'category', 'module': site['plugin'], 'className': site['className']})
is_folder = True
xbmcplugin.addDirectoryItem(HANDLE, url, list_item, is_folder)
xbmcplugin.endOfDirectory(HANDLE, cacheToDisc=True)
示例6: finalize_directory
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def finalize_directory(items, content_type=g.CONTENT_FOLDER, sort_type='sort_nothing', title=None):
"""Finalize a directory listing. Add items, set available sort methods and content type"""
if title:
xbmcplugin.setPluginCategory(g.PLUGIN_HANDLE, title)
xbmcplugin.setContent(g.PLUGIN_HANDLE, content_type)
add_sort_methods(sort_type)
xbmcplugin.addDirectoryItems(g.PLUGIN_HANDLE, items)
示例7: create_listing
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def create_listing(listing, succeeded=True, update_listing=False, cache_to_disk=False, sort_methods=None,
view_mode=None, content=None, category=None):
"""
Create and return a context dict for a virtual folder listing
:param listing: the list of the plugin virtual folder items
:type listing: list or types.GeneratorType
:param succeeded: if ``False`` Kodi won't open a new listing and stays on the current level.
:type succeeded: bool
:param update_listing: if ``True``, Kodi won't open a sub-listing but refresh the current one.
:type update_listing: bool
:param cache_to_disk: cache this view to disk.
:type cache_to_disk: bool
:param sort_methods: the list of integer constants representing virtual folder sort methods.
:type sort_methods: tuple
:param view_mode: a numeric code for a skin view mode.
View mode codes are different in different skins except for ``50`` (basic listing).
:type view_mode: int
:param content: string - current plugin content, e.g. 'movies' or 'episodes'.
See :func:`xbmcplugin.setContent` for more info.
:type content: str
:param category: str - plugin sub-category, e.g. 'Comedy'.
See :func:`xbmcplugin.setPluginCategory` for more info.
:type category: str
:return: context object containing necessary parameters
to create virtual folder listing in Kodi UI.
:rtype: ListContext
"""
return ListContext(listing, succeeded, update_listing, cache_to_disk,
sort_methods, view_mode, content, category)
示例8: _add_directory_items
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def _add_directory_items(self, context):
"""
Create a virtual folder listing
:param context: context object
:type context: ListContext
:raises SimplePluginError: if sort_methods parameter is not int, tuple or list
"""
self.log_debug('Creating listing from {0}'.format(str(context)))
if context.category is not None:
xbmcplugin.setPluginCategory(self._handle, context.category)
if context.content is not None:
xbmcplugin.setContent(self._handle, context.content) # This must be at the beginning
for item in context.listing:
is_folder = item.get('is_folder', True)
if item.get('list_item') is not None:
list_item = item['list_item']
else:
list_item = self.create_list_item(item)
if item.get('is_playable'):
list_item.setProperty('IsPlayable', 'true')
is_folder = False
xbmcplugin.addDirectoryItem(self._handle, item['url'], list_item, is_folder)
if context.sort_methods is not None:
if isinstance(context.sort_methods, int):
xbmcplugin.addSortMethod(self._handle, context.sort_methods)
elif isinstance(context.sort_methods, (tuple, list)):
for method in context.sort_methods:
xbmcplugin.addSortMethod(self._handle, method)
else:
raise TypeError(
'sort_methods parameter must be of int, tuple or list type!')
xbmcplugin.endOfDirectory(self._handle,
context.succeeded,
context.update_listing,
context.cache_to_disk)
if context.view_mode is not None:
xbmc.executebuiltin('Container.SetViewMode({0})'.format(context.view_mode))
示例9: mainlist
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def mainlist(params,url,category):
logger.info("channelselector.mainlist")
# Verifica actualizaciones solo en el primer nivel
if config.get_platform()!="boxee":
try:
from core import updater
except ImportError:
logger.info("channelselector.mainlist No disponible modulo actualizaciones")
else:
if config.get_setting("check_for_plugin_updates") == "true":
logger.info("channelselector.mainlist Verificar actualizaciones activado")
updater.checkforupdates()
else:
logger.info("channelselector.mainlist Verificar actualizaciones desactivado")
itemlist = getmainlist("squares")
for elemento in itemlist:
logger.info("channelselector item="+elemento.tostring())
addfolder(elemento.title , elemento.channel , elemento.action , thumbnailname=elemento.thumbnail, folder=elemento.folder)
if config.get_platform()=="kodi-krypton" or config.get_platform()=="kodi-leia":
import plugintools
plugintools.set_view( plugintools.TV_SHOWS )
# Label (top-right)...
import xbmcplugin
#xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" )
#xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
if config.get_setting("forceview")=="true":
# Confluence - Thumbnail
import xbmc
xbmc.executebuiltin("Container.SetViewMode(500)")
示例10: start_container
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def start_container(self):
xbmcplugin.setPluginCategory(self.handle, self.plugincategory) # Container.PluginCategory
xbmcplugin.setContent(self.handle, self.containercontent) # Container.Content
示例11: list_category
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def list_category(cats, module, classname, movies=None):
xbmcplugin.setPluginCategory(HANDLE, classname)
xbmcplugin.setContent(HANDLE, 'files')
# show search link
url = build_url({'mode': 'search', 'module': module, 'className': classname})
xbmcplugin.addDirectoryItem(HANDLE, url,
xbmcgui.ListItem(label="[COLOR green][B] %s [/B][/COLOR]" % "Search ..."), True)
for cat in cats:
list_item = xbmcgui.ListItem(label=cat['title'])
list_item.addContextMenuItems(globalContextMenu())
if 'subcategory' in cat and cat['subcategory'] and len(cat['subcategory']) > 0:
url = build_url({'mode': 'category', 'url': cat['link'], 'name': cat['title'],
'subcategory': json.dumps(cat['subcategory']), 'module': module, 'className': classname})
else:
url = build_url({'mode': 'movies', 'url': cat['link'], 'page': 1, 'module': module, 'className': classname})
xbmcplugin.addDirectoryItem(HANDLE, url, list_item, isFolder=True)
if movies and len(movies) > 0:
label = "[COLOR yellow][B][---- New Movies ----][/B][/COLOR]"
sli = xbmcgui.ListItem(label=label)
xbmcplugin.addDirectoryItem(HANDLE, None, sli, isFolder=False)
list_movie(movies, '/', 1, module, classname)
else:
xbmcplugin.endOfDirectory(HANDLE)
示例12: list_movie
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def list_movie(movies, link, page, module, classname):
xbmcplugin.setPluginCategory(HANDLE, classname)
# xbmcplugin.setContent(HANDLE, 'tvshows')
xbmcplugin.setContent(HANDLE, 'movies')
# view_mode_id = 55
# xbmc.executebuiltin('Container.SetViewMode(%s)' % view_mode_id)
if movies is not None:
for item in movies['movies']:
try:
list_item = xbmcgui.ListItem(label=item['label'])
list_item.addContextMenuItems(globalContextMenu())
list_item.setLabel2(item['realtitle'])
list_item.setIconImage('DefaultVideo.png')
list_item.setArt({'thumb': item['thumb']})
if 'poster' in item:
list_item.setArt({'poster': item['poster']})
if 'intro' in item:
list_item.setInfo(type='video', infoLabels={'plot': item['intro']})
url = build_url({
'mode': 'movie', 'module': module, 'className': classname,
'movie_item': json.dumps(item)
})
xbmcplugin.addDirectoryItem(HANDLE, url, list_item, isFolder=True)
except Exception as inst:
print("*********************** List Movie Exception: {}".format(inst))
print(item)
print("***********************Current page %d" % page)
# show next page
if movies['page'] > 1 and page < movies['page']:
label = "Next page %d / %d >>" % (page, movies['page'])
next_item = xbmcgui.ListItem(label=label)
if 'page_patten' in movies and movies['page_patten'] is not None:
link = movies['page_patten']
url = build_url({'mode': 'movies', 'url': link, 'page': page + 1, 'module': module, 'className': classname})
xbmcplugin.addDirectoryItem(HANDLE, url, next_item, True)
else:
return
xbmcplugin.endOfDirectory(HANDLE)
示例13: show_server_links
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def show_server_links(items, movie_item, server, module, class_name):
title = movie_item.get('title').encode('utf8')
xbmcplugin.setPluginCategory(HANDLE, "%s - %s " % (title, server))
xbmcplugin.setContent(HANDLE, 'videos')
label = "[COLOR red][B][---- %s : [COLOR yellow]%d eps[/COLOR] ----][/B][/COLOR]" % (server, len(items))
sli = xbmcgui.ListItem(label=label)
xbmcplugin.addDirectoryItem(HANDLE, None, sli, isFolder=False)
_build_ep_list(items, movie_item, module, class_name)
xbmcplugin.endOfDirectory(HANDLE)
示例14: search
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def search(module, classname=None):
xbmcplugin.setPluginCategory(HANDLE, 'Search')
xbmcplugin.setContent(HANDLE, 'movies')
url = build_url({'mode': 'dosearch', 'module': module, 'className': classname})
xbmcplugin.addDirectoryItem(HANDLE,
url,
xbmcgui.ListItem(label="[COLOR orange][B]%s[/B][/COLOR]" % "Enter search text ..."),
True)
# Support to save search history
contents = XbmcHelper.search_history_get()
if contents:
url = build_url({'mode': 'clearsearch', 'module': module, 'className': classname})
xbmcplugin.addDirectoryItem(HANDLE,
url,
xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" % "Clear search text ..."),
True)
for txt in contents:
try:
url = build_url({'mode': 'dosearch', 'module': module, 'className': classname, 'url': txt})
xbmcplugin.addDirectoryItem(HANDLE,
url,
xbmcgui.ListItem(label="[COLOR blue][B]%s[/B][/COLOR]" % txt),
True)
except:
pass
xbmcplugin.endOfDirectory(HANDLE)
示例15: global_search
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import setPluginCategory [as 别名]
def global_search():
xbmcplugin.setPluginCategory(HANDLE, 'Search')
xbmcplugin.setContent(HANDLE, 'movies')
url = build_url({'mode': 'doglobalsearch'})
xbmcplugin.addDirectoryItem(HANDLE,
url,
xbmcgui.ListItem(label="[COLOR orange][B]%s[/B][/COLOR]" % "Enter search text ..."),
True)
# Support to save search history
contents = XbmcHelper.search_history_get()
if contents:
url = build_url({'mode': 'clearsearch'})
xbmcplugin.addDirectoryItem(HANDLE,
url,
xbmcgui.ListItem(label="[COLOR red][B]%s[/B][/COLOR]" % "Clear search text ..."),
False)
for txt in contents:
try:
url = build_url({'mode': 'doglobalsearch', 'url': txt})
xbmcplugin.addDirectoryItem(HANDLE,
url,
xbmcgui.ListItem(label="[COLOR blue][B]%s[/B][/COLOR]" % txt),
True)
except:
pass
xbmcplugin.endOfDirectory(HANDLE)