本文整理汇总了Python中xbmcplugin.addSortMethod方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcplugin.addSortMethod方法的具体用法?Python xbmcplugin.addSortMethod怎么用?Python xbmcplugin.addSortMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmcplugin
的用法示例。
在下文中一共展示了xbmcplugin.addSortMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: play_url
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def play_url(params):
torr_link=params['file']
img=urllib.unquote_plus(params["img"])
#showMessage('heading', torr_link, 10000)
TSplayer=tsengine()
out=TSplayer.load_torrent(torr_link,'TORRENT',port=aceport)
if out=='Ok':
for k,v in TSplayer.files.iteritems():
li = xbmcgui.ListItem(urllib.unquote(k))
uri = construct_request({
'torr_url': torr_link,
'title': k,
'ind':v,
'img':img,
'mode': 'play_url2'
})
xbmcplugin.addDirectoryItem(handle, uri, li, False)
xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_LABEL)
xbmcplugin.endOfDirectory(handle)
TSplayer.end()
示例2: addLinkItem
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def addLinkItem(name, url, mode, params=1, iconimage='DefaultFolder.png', infoLabels=False, IsPlayable=True,
fanart=FANART, itemcount=1, contextmenu=None):
u = build_url({'mode': mode, 'foldername': name, 'ex_link': url, 'params': params})
liz = xbmcgui.ListItem(name)
art_keys = ['thumb', 'poster', 'banner', 'fanart', 'clearart', 'clearlogo', 'landscape', 'icon']
art = dict(zip(art_keys, [iconimage for x in art_keys]))
art['landscape'] = fanart if fanart else art['landscape']
art['fanart'] = fanart if fanart else art['landscape']
liz.setArt(art)
if not infoLabels:
infoLabels = {"title": name}
liz.setInfo(type="video", infoLabels=infoLabels)
if IsPlayable:
liz.setProperty('IsPlayable', 'true')
if contextmenu:
contextMenuItems = contextmenu
liz.addContextMenuItems(contextMenuItems, replaceItems=True)
ok = xbmcplugin.addDirectoryItem(handle=addon_handle, url=u, listitem=liz, isFolder=False, totalItems=itemcount)
xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE, label2Mask="%R, %Y, %P")
return ok
示例3: addDir
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def addDir(name, ex_link=None, params=1, mode='folder', iconImage='DefaultFolder.png', infoLabels=None, fanart=FANART,
contextmenu=None):
url = build_url({'mode': mode, 'foldername': name, 'ex_link': ex_link, 'params': params})
nofolders = ['take_stream', 'opensettings', 'enable_input', 'forceupdate', 'open_news', 'ccache', 'showalts']
folder = False if mode in nofolders else True
li = xbmcgui.ListItem(name)
if infoLabels:
li.setInfo(type="video", infoLabels=infoLabels)
li.setProperty('fanart_image', fanart)
art_keys = ['thumb', 'poster', 'banner', 'fanart', 'clearart', 'clearlogo', 'landscape', 'icon']
art = dict(zip(art_keys, [iconImage for x in art_keys]))
art['landscape'] = fanart if fanart else art['landscape']
art['fanart'] = fanart if fanart else art['landscape']
li.setArt(art)
if contextmenu:
contextMenuItems = contextmenu
li.addContextMenuItems(contextMenuItems, replaceItems=True)
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=folder)
xbmcplugin.addSortMethod(addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE, label2Mask="%R, %Y, %P")
示例4: my_streams_menu
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def my_streams_menu():
if not os.path.exists(mystrm_folder): xbmcvfs.mkdir(mystrm_folder)
files = os.listdir(mystrm_folder)
if files:
for fic in files:
content = readfile(os.path.join(mystrm_folder,fic)).split('|')
if content:
if 'acestream://' in content[1] or '.acelive' in content[1] or '.torrent' in content[1]:
addDir(content[0],content[1],1,content[2],1,False)
elif 'sop://' in content[1]:
addDir(content[0],content[1],2,content[2],1,False)
else:
pass
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
addDir('[B][COLOR maroon]'+translate(30009)+'[/COLOR][/B]',MainURL,11,os.path.join(addonpath,art,'plus-menu.png'),1,False)
示例5: browse_topartists
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def browse_topartists(self):
xbmcplugin.setContent(self.addon_handle, "artists")
result = self.sp.current_user_top_artists(limit=20, offset=0)
cachestr = "spotify.topartists.%s" % self.userid
checksum = self.cache_checksum(result["total"])
items = self.cache.get(cachestr, checksum=checksum)
if not items:
count = len(result["items"])
while result["total"] > count:
result["items"] += self.sp.current_user_top_artists(limit=20, offset=count)["items"]
count += 50
items = self.prepare_artist_listitems(result["items"])
self.cache.set(cachestr, items, checksum=checksum)
self.add_artist_listitems(items)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_artists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists)
示例6: browse_toptracks
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def browse_toptracks(self):
xbmcplugin.setContent(self.addon_handle, "songs")
results = self.sp.current_user_top_tracks(limit=20, offset=0)
cachestr = "spotify.toptracks.%s" % self.userid
checksum = self.cache_checksum(results["total"])
items = self.cache.get(cachestr, checksum=checksum)
if not items:
items = results["items"]
while results["next"]:
results = self.sp.next(results)
items.extend(results["items"])
items = self.prepare_track_listitems(tracks=items)
self.cache.set(cachestr, items, checksum=checksum)
self.add_track_listitems(items, True)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
示例7: browse_album
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def browse_album(self):
xbmcplugin.setContent(self.addon_handle, "songs")
album = self.sp.album(self.albumid, market=self.usercountry)
xbmcplugin.setProperty(self.addon_handle, 'FolderName', album["name"])
tracks = self.get_album_tracks(album)
if album.get("album_type") == "compilation":
self.add_track_listitems(tracks, True)
else:
self.add_track_listitems(tracks)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TRACKNUM)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TITLE)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_SONG_RATING)
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_ARTIST)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
示例8: search_tracks
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def search_tracks(self):
xbmcplugin.setContent(self.addon_handle, "songs")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(134))
result = self.sp.search(
q="track:%s" %
self.trackid,
type='track',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
tracks = self.prepare_track_listitems(tracks=result["tracks"]["items"])
self.add_track_listitems(tracks, True)
self.add_next_button(result['tracks']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_songs:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_songs)
示例9: search_albums
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def search_albums(self):
xbmcplugin.setContent(self.addon_handle, "albums")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(132))
result = self.sp.search(
q="album:%s" %
self.albumid,
type='album',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
albumids = []
for album in result['albums']['items']:
albumids.append(album["id"])
albums = self.prepare_album_listitems(albumids)
self.add_album_listitems(albums, True)
self.add_next_button(result['albums']['total'])
xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_albums:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_albums)
示例10: channeltypes
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [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)")
示例11: listchannels
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [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)")
示例12: finish_container
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def finish_container(self):
if self.params.get('random'):
return
for k, v in self.params.items():
if not k or not v:
continue
try:
xbmcplugin.setProperty(self.handle, u'Param.{}'.format(k), u'{}'.format(v)) # Set params to container properties
except Exception as exc:
utils.kodi_log(u'Error: {}\nUnable to set Param.{} to {}'.format(exc, k, v), 1)
if self.item_dbtype in ['movie', 'tvshow', 'episode']:
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_EPISODE) if self.item_dbtype == 'episode' else None
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_LASTPLAYED)
xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_PLAYCOUNT)
xbmcplugin.endOfDirectory(self.handle, updateListing=self.updatelisting)
示例13: begin
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def begin(self, showshows, showchannels):
"""
Begin a directory containing films
Args:
showshows(bool): if `True` the showname is prefixed
to the film name
showchannels(bool): if `True` the channel name is
suffixed to the film name
"""
self.showshows = showshows
self.showchannels = showchannels
# xbmcplugin.setContent( self.handle, 'tvshows' )
for method in self.sortmethods:
xbmcplugin.addSortMethod(self.handle, method)
示例14: room_list
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def room_list(game_id):
if game_id == 'ALL':
apiurl = 'http://api.m.panda.tv/ajax_live_lists'
params = 'pageno=1&pagenum=100&status=2&order=person_num&sproom=1&__version=2.0.1.1481&__plat=android&banner=1'
else:
apiurl = "http://api.m.panda.tv/ajax_get_live_list_by_cate"
params = "__plat=iOS&__version=1.0.5.1098&cate={ename}&order=person_num&pageno=1&pagenum=100&status=2".format(ename=game_id)
returndata = post(apiurl, params);
obj = json.loads(returndata)
listing=[]
for room in obj['data']['items']:
title = TITLE_PATTERN.format(topic=room['name'].encode('utf-8'), author=room['userinfo']['nickName'].encode('utf-8'), view_count=room['person_num'].encode('utf-8'))
list_item = xbmcgui.ListItem(label=title, thumbnailImage=room['pictures']['img'])
list_item.setProperty('fanart_image', room['pictures']['img'])
url='{0}?action=play&room_id={1}'.format(_url, room['id'])
is_folder=False
listing.append((url, list_item, is_folder))
xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
#xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
# Finish creating a virtual folder.
xbmcplugin.endOfDirectory(_handle)
示例15: list_categories
# 需要导入模块: import xbmcplugin [as 别名]
# 或者: from xbmcplugin import addSortMethod [as 别名]
def list_categories(article):
html = get(_meijumao + article )
soup = BeautifulSoup(html,"html5lib")
listing = []
for urls in soup.find_all("a",attrs={"data-remote":"true"}):
list_item = xbmcgui.ListItem(label=urls.div.get_text())
url='{0}?action=list_sections§ion={1}'.format(_url, urls.get("href").replace(_meijumao,""))
is_folder=True
listing.append((url, list_item, is_folder))
xbmcplugin.addDirectoryItems(_handle,listing,len(listing))
#xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
# Finish creating a virtual folder.
xbmcplugin.endOfDirectory(_handle)
# get sections