本文整理匯總了Python中xbmcplugin.setContent方法的典型用法代碼示例。如果您正苦於以下問題:Python xbmcplugin.setContent方法的具體用法?Python xbmcplugin.setContent怎麽用?Python xbmcplugin.setContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xbmcplugin
的用法示例。
在下文中一共展示了xbmcplugin.setContent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: browse_subfolders
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [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 setContent [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: Get_links
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def Get_links(name,url): #10
OPEN = client.request(url, headers=headers)
Regex = client.parseDOM(OPEN, 'iframe', ret='src')
for link in Regex[::-1]:
if 'verestrenos' in link:
idp = link.split('mula=')[1]
post = 'mole=%s' % idp
link = client.request('http://www.verestrenos.net/rm/ajax.php', post=post)
vid_id = re.compile('http[s]?://(.+?)\.', re.DOTALL).findall(link)[0]
if 'sebuscar' in vid_id:
continue
vid_id = vid_id.replace('hqq', 'netu.tv')
addDir('[B][COLOR white]{0} [B]| [COLOR lime]{1}[/COLOR][/B]'.format(name, vid_id), '%s|%s' % (link, url), 100, iconimage, FANART, name)
xbmcplugin.setContent(int(sys.argv[1]), 'movies')
示例4: watching
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def watching():
response = plugin.client("watching/serials").get(data={"subscribed": 1})
xbmcplugin.setContent(plugin.handle, "tvshows")
for item in response["items"]:
title = u"{} : [COLOR FFFFF000]+{}[/COLOR]".format(item["title"], item["new"])
li = plugin.list_item(
title,
str(item["new"]),
poster=item["posters"]["big"],
properties={"id": str(item["id"]), "in_watchlist": "1"},
video_info={"mediatype": content_type_map[item["type"].lower()]},
addContextMenuItems=True,
)
url = plugin.routing.build_url("seasons", item["id"])
xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
xbmcplugin.endOfDirectory(plugin.handle, cacheToDisc=False)
示例5: browse_topartists
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [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 setContent [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 setContent [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_artists
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def search_artists(self):
xbmcplugin.setContent(self.addon_handle, "artists")
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(133))
result = self.sp.search(
q="artist:%s" %
self.artistid,
type='artist',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
artists = self.prepare_artist_listitems(result['artists']['items'])
self.add_artist_listitems(artists)
self.add_next_button(result['artists']['total'])
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)
示例9: search_tracks
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [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)
示例10: search_albums
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [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)
示例11: search_playlists
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def search_playlists(self):
xbmcplugin.setContent(self.addon_handle, "files")
result = self.sp.search(
q=self.playlistid,
type='playlist',
limit=self.limit,
offset=self.offset,
market=self.usercountry)
log_msg(result)
xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(136))
playlists = self.prepare_playlist_listitems(result['playlists']['items'])
self.add_playlist_listitems(playlists)
self.add_next_button(result['playlists']['total'])
xbmcplugin.endOfDirectory(handle=self.addon_handle)
if self.defaultview_playlists:
xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_playlists)
示例12: show
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def show(self, link, image, name):
response = common.fetchPage({"link": link})
cid = link.split(self.url + "/")[-1].split("-")[0]
playlist = self.getPlaylist(response['content'])
if playlist:
description = self.strip(response['content'].split("<!--dle_image_end-->")[1].split("<div")[0])
currname = ''
duration = ''
#description = common.parseDOM(response['content'], "meta", attrs={"name": "description"}, ret = "content")[0]
if (self.use_epg == "true"):
currname, duration, listItems = self.getEPG(cid = cid, cname=name, image=image)
uri = sys.argv[0] + '?mode=play&url=%s&url2=%s' % (urllib.quote_plus(playlist), link)
item = xbmcgui.ListItem("[COLOR=FF7B68EE]%s[/COLOR]" % self.language(1004), iconImage=image, thumbnailImage=image)
item.setInfo(type='Video', infoLabels={'title': currname if currname != '' else name, 'plot': description, 'duration': duration})
item.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(self.handle, uri, item, False)
if (self.use_epg == "true"):
xbmcplugin.addDirectoryItems(self.handle, listItems)
xbmcplugin.setContent(self.handle, 'files')
xbmcplugin.endOfDirectory(self.handle, True)
示例13: process
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def process(kp_id, media_title, image):
if (not kp_id):
kp_id, media_title, media_title, image = prepare("process", kp_id, media_title, media_title, image)
if (not kp_id):
return
list_li = []
list_li = search.process(kp_id)
for li in list_li:
engine = get_engine(li[1].getLabel())
li[0] = li[0] + ("&media_title=%s&image=%s&engine=%s" % ((urllib.quote_plus(encode_("utf-8", media_title))) if (media_title != "") else "", image, engine))
li[1].setIconImage(image)
li[1].setThumbnailImage(image)
if ("*T*" in li[1].getLabel()):
title = li[1].getLabel().replace("*T*", media_title)
li[1].setLabel(title)
li[0] = li[0] + ("&title=%s" % (urllib.quote_plus(title)))
li[1].setInfo(type='Video', infoLabels={'title': li[1].getLabel(), 'label': media_title, 'plot': media_title})
xbmcplugin.addDirectoryItem(HANDLE, li[0], li[1], li[2])
xbmcplugin.setContent(HANDLE, 'movies')
xbmcplugin.endOfDirectory(HANDLE, True)
示例14: getSubItems2
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def getSubItems2(self, url):
response = common.fetchPage({"link": url})
if response["status"] == 200:
content = common.parseDOM(response["content"], "table", attrs={"class": "items"})
items = common.parseDOM(content, "tr")
photo_tds = common.parseDOM(items, "td", attrs={"class": "photo"})
photos = common.parseDOM(photo_tds, "img", ret="src")
tds = common.parseDOM(items, "td", attrs={"class": "artist_name"})
labels = common.parseDOM(tds, "a")
links = common.parseDOM(tds, "a", ret="href")
for i, item in enumerate(labels):
uri = sys.argv[0] + '?mode=items2&url=%s' % ("https:" + links[i])
try:
photo = ("https:" + photos[i]).replace("33x33", "250")
except:
photo = self.icon
sub = tds[i]
numbers = common.parseDOM(items[i], "td", attrs={"class": "number"})
item_ = xbmcgui.ListItem(self.strip("[COLOR=lightgreen]%s[/COLOR]%s [COLOR=lightblue][%s][/COLOR]" % (labels[i], " - [I]" + sub.split("<br>")[-1] + "[/I]" if "<br>" in sub else "", numbers[0])), iconImage=photo, thumbnailImage=photo)
xbmcplugin.addDirectoryItem(self.handle, uri, item_, True)
xbmcplugin.setContent(self.handle, 'files')
xbmcplugin.endOfDirectory(self.handle, True)
示例15: getItems2
# 需要導入模塊: import xbmcplugin [as 別名]
# 或者: from xbmcplugin import setContent [as 別名]
def getItems2(self, url):
response = common.fetchPage({"link": url})
if response["status"] == 200:
photo_div = common.parseDOM(response["content"], "div", attrs={"class": "artist-profile__photo debug1"})[0]
photo = "https:" + common.parseDOM(photo_div, "img", ret="src")[0]
content = common.parseDOM(response["content"], "table", attrs={"id": "tablesort"})
items = common.parseDOM(content, "tr")
labels = common.parseDOM(items, "a")
links = common.parseDOM(items, "a", ret="href")
for i, item in enumerate(items):
uri = sys.argv[0] + '?mode=show&url=%s' % ("https:" + links[i])
item_ = xbmcgui.ListItem(self.strip("%s" % labels[i]), iconImage=photo, thumbnailImage=photo)
xbmcplugin.addDirectoryItem(self.handle, uri, item_, True)
xbmcplugin.setContent(self.handle, 'files')
xbmcplugin.endOfDirectory(self.handle, True)