Python源码示例:xbmcplugin.endOfDirectory()
示例1
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
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]))
示例3
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]))
示例4
def route_search_nav(pathitems, perpetual_range_start, dir_update_listing, params):
path = pathitems[2] if len(pathitems) > 2 else 'list'
common.debug('Routing "search" navigation to: {}', path)
ret = True
if path == 'list':
search_list()
elif path == 'add':
ret = search_add()
elif path == 'edit':
search_edit(params['row_id'])
elif path == 'remove':
search_remove(params['row_id'])
elif path == 'clear':
ret = search_clear()
else:
ret = search_query(path, perpetual_range_start, dir_update_listing)
if not ret:
xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)
示例5
def bookmarks():
img = plugin.routing.build_icon_path("create_bookmarks_folder")
li = plugin.list_item("Создать папку", iconImage=img, thumbnailImage=img)
url = plugin.routing.build_url("create_bookmarks_folder")
xbmcplugin.addDirectoryItem(plugin.handle, url, li, False)
response = plugin.client("bookmarks").get()
for folder in response["items"]:
img = plugin.routing.build_icon_path("bookmark")
li = plugin.list_item(
folder["title"],
iconImage=img,
thumbnailImage=img,
properties={"folder-id": str(folder["id"]), "views": str(folder["views"])},
)
url = plugin.routing.build_url("remove_bookmarks_folder", folder["id"])
li.addContextMenuItems([("Удалить", "Container.Update({})".format(url))])
url = plugin.routing.build_url("bookmarks", folder["id"])
xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
xbmcplugin.endOfDirectory(plugin.handle)
示例6
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)
示例7
def collections():
img = plugin.routing.build_icon_path("fresh")
li = plugin.list_item("Последние", iconImage=img, thumbnailImage=img)
url = plugin.routing.build_url("collections", "created")
xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
img = plugin.routing.build_icon_path("hot")
li = plugin.list_item("Просматриваемые", iconImage=img, thumbnailImage=img)
url = plugin.routing.build_url("collections", "watchers")
xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
img = plugin.routing.build_icon_path("popular")
li = plugin.list_item("Популярные", iconImage=img, thumbnailImage=img)
url = plugin.routing.build_url("collections", "views")
xbmcplugin.addDirectoryItem(plugin.handle, url, li, True)
xbmcplugin.endOfDirectory(plugin.handle)
示例8
def __init__(self):
try:
self.addon = xbmcaddon.Addon(id=ADDON_ID)
self.win = xbmcgui.Window(10000)
self.cache = SimpleCache()
auth_token = self.get_authkey()
if auth_token:
self.parse_params()
self.sp = spotipy.Spotify(auth=auth_token)
self.userid = self.win.getProperty("spotify-username").decode("utf-8")
self.usercountry = self.win.getProperty("spotify-country").decode("utf-8")
self.local_playback, self.playername, self.connect_id = self.active_playback_device()
if self.action:
action = "self." + self.action
eval(action)()
else:
self.browse_main()
self.precache_library()
else:
xbmcplugin.endOfDirectory(handle=self.addon_handle)
except Exception as exc:
log_exception(__name__, exc)
xbmcplugin.endOfDirectory(handle=self.addon_handle)
示例9
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)
示例10
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)
示例11
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)
示例12
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)
示例13
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)
示例14
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)")
示例15
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)")
示例16
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)
示例17
def root():
rss=get_rss()
L=pars_rss(rss)
for i in L:
name = i['title']
url = i['url']
cover = i['cover']
if url.find("400p")<0 or __settings__.getSetting("Qual")=="1":
add_item (name, 'play', url, str(0),cover)
xbmcplugin.endOfDirectory(handle)
示例18
def Title():
q=inputbox().replace(" ","%20")
Lt=[]
for n in range (1,5):
url='http://mds-fm.ru/search/node/'+q
if n>0: url=url+"?page="+str(n)
http=getURL(url)
ss='<li class="search-result">'
es='</ol>'
try:
c1=mfindal(http, ss, es)[0]
ss='<a href="'
es='</a>'
L=mfindal(c1, ss, es)
except:
L=[]
for i in L:
url, title = eval(i.replace('<a href="','("').replace('">','", "')+'")')
img=thumb
uri = sys.argv[0] + '?mode=serch'
uri += '&url=' + urllib.quote_plus(url)
uri += '&name=' + urllib.quote_plus(title)
uri += '&img=' + urllib.quote_plus(img)
item = xbmcgui.ListItem(Format(title), iconImage = img, thumbnailImage = img)
item.setInfo(type="Music", infoLabels={"Title": title})
if url not in Lt:
xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)
Lt.append(url)
xbmcplugin.endOfDirectory(pluginhandle)
示例19
def Genres():
L=[('632', 'Dark Fantasy '), ('582', 'Science Fantasy'), ('836', '«Дотолкиновское» фэнтези '), ('745', 'Авантюрно-плутовское'), ('1148', 'Анималистическое '), ('717', 'Антивоенное'), ('621', 'Антиутопия '), ('944', 'Античность'), ('1054', 'Боевик '), ('839', 'Буддизм'), ('730', 'Военное '), ('631', 'Героическое фэнтези'), ('841', 'Городское фэнтези '), ('588', 'Гуманитарная (социальная) фантастика'), ('615', 'Детектив '), ('1408', 'дизельпанк'), ('1169', 'Европейское средневековье '), ('876', 'Египетская'), ('1144', 'Инков/майя/ацтеков '), ('592', 'Ирония'), ('825', 'Ислам '), ('853', 'Исторический роман'), ('649', 'Католичество '), ('756', 'Киберпанк'), ('1122', 'Классический детектив '), ('852', 'Классический латино-американский'), ('683', 'Космоопера '), ('1280', 'Лавкрафтианский хоррор'), ('778', 'Любовный роман '), ('700', 'Магический реализм'), ('610', 'Мистика '), ('1395', 'мистический реализм'), ('697', 'Мифология '), ('1071', 'Мифы Народов Междуречья'), ('694', 'На основе игровой вселенной '), ('990', 'Народов Африки'), ('666', 'Научная фантастика '), ('1243', 'Нуар'), ('1063', 'Пародия '), ('750', 'Планетарная фантастика'), ('1002', 'Полицейский детектив '), ('647', 'Постапокалиптика'), ('723', 'Постмодернизм '), ('802', 'Православие'), ('595', 'Приключения '), ('603', 'Производственная'), ('650', 'Протестантизм '), ('774', 'Психоделика'), ('596', 'Психологическое '), ('936', 'Разработанная автором оригинальная мифологическая система'), ('645', 'Реализм '), ('642', 'Религия'), ('654', 'Роман-катастрофа '), ('1296', 'Русская/Славянская мифология'), ('875', 'С использованием мифологии '), ('684', 'С множеством интриг'), ('606', 'Сатира '), ('639', 'Сказка/Притча'), ('989', 'Скандинавская мифология '), ('701', 'Современный'), ('605', 'Социальная '), ('1185', 'Стимпанк/паропанк'), ('692', 'Сюрреализм '), ('884', 'Таймпанк'), ('935', 'Технофэнтези '), ('627', 'Утопия'), ('587', 'Фантастика '), ('764', 'Феминистское'), ('622', 'Философское '), ('581', 'Фэнтези'), ('677', 'Хоррор/Ужасы '), ('648', 'Христианство'), ('714', 'Хроноопера '), ('1205', 'Эпическое фэнтези'), ('817', 'Эротика '), ('583', 'Юмор'), ('997', 'Язычество ')]
for i in L:
id, title=i
url="http://mds-fm.ru/book?g="+id+"#"
img=thumb
uri = sys.argv[0] + '?mode=serch'
uri += '&url=' + urllib.quote_plus(url)
uri += '&name=' + urllib.quote_plus(title)
uri += '&img=' + urllib.quote_plus(img)
item = xbmcgui.ListItem(title, iconImage = img, thumbnailImage = img)
item.setInfo(type="Music", infoLabels={"Title": title})
xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)
xbmcplugin.endOfDirectory(pluginhandle)
示例20
def Plot():
L=[('623','Бессмертие'), ('736','Вампиры'), ('741','Вторжение «Чужих»'), ('609','Генетические эксперименты, мутации'), ('702','Договор с нечистой силой'), ('686','Жизнь после смерти'), ('881','Звёздный ковчег'), ('616','Изобретения и научные исследования'), ('601','Искусственный интеллект'), ('658','Квест'), ('922','Клоны и клонирование'), ('590','Контакт'), ('593','Ксенофантастика'), ('939','Наши в другом мире'), ('761','Наши в прошлом'), ('993','Обмен разумов, перемещение разума'), ('786','Полая Земля, путешествия под землю'), ('738','Последний человек/люди на Земле'), ('1394','природные катаклизмы'), ('795','Прогрессорство'), ('898','Пророчество'), ('856','Реликты'), ('669','Робинзонада'), ('662','Роботы'), ('776','Сверхъестественные способности, супергерои'), ('685','Спасение мира'), ('743','Спецслужбы'), ('613','Становление/взросление героя'), ('1393','Стихийные бедствия'), ('747','Стихийные бедствия, природные катаклизмы'), ('894','Тёмный властелин'), ('788','Терраформирование'), ('651','Умирающая Земля')]
for i in L:
id, title=i
url="http://mds-fm.ru/book?p="+id+"#"
img=thumb
uri = sys.argv[0] + '?mode=serch'
uri += '&url=' + urllib.quote_plus(url)
uri += '&name=' + urllib.quote_plus(title)
uri += '&img=' + urllib.quote_plus(img)
item = xbmcgui.ListItem(title, iconImage = img, thumbnailImage = img)
item.setInfo(type="Music", infoLabels={"Title": title})
xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)
xbmcplugin.endOfDirectory(pluginhandle)
示例21
def Time():
L=[('679','20 век'), ('589','21 век'), ('607','Близкое будущее'), ('598','Далёкое будущее'), ('1373','Дочеловеческие времена'), ('765','Древний мир'), ('831','Каменный век'), ('657','Неопределенное время действия'), ('829','Новое время (17-19 века)'), ('980','Очень далёкое будущее'), ('861','Позднее средневековье / Эпоха возрождения'), ('1159','Средние века'), ('897','Эпоха географических открытий (15-16 века)')]
for i in L:
id, title=i
url="http://mds-fm.ru/book?t="+id+"#"
img=thumb
uri = sys.argv[0] + '?mode=serch'
uri += '&url=' + urllib.quote_plus(url)
uri += '&name=' + urllib.quote_plus(title)
uri += '&img=' + urllib.quote_plus(img)
item = xbmcgui.ListItem(title, iconImage = img, thumbnailImage = img)
item.setInfo(type="Music", infoLabels={"Title": title})
xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)
xbmcplugin.endOfDirectory(pluginhandle)
示例22
def manage_libraries():
directory(_(33098), "plugin://plugin.video.emby/?mode=refreshboxsets", False)
directory(_(33154), "plugin://plugin.video.emby/?mode=addlibs", False)
directory(_(33139), "plugin://plugin.video.emby/?mode=updatelibs", False)
directory(_(33140), "plugin://plugin.video.emby/?mode=repairlibs", False)
directory(_(33184), "plugin://plugin.video.emby/?mode=removelibs", False)
directory(_(33060), "plugin://plugin.video.emby/?mode=thememedia", False)
if kodi_version() >= 18:
directory(_(33202), "plugin://plugin.video.emby/?mode=patchmusic", False)
xbmcplugin.setContent(int(sys.argv[1]), 'files')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
示例23
def get_video_extras(item_id, path, server_id=None):
''' Returns the video files for the item as plugin listing, can be used
to browse actual files or video extras, etc.
'''
if not item_id and 'plugin.video.emby' in path:
item_id = path.split('/')[-2]
if not item_id:
return
get_server(server_id)
item = EMBY['api'].get_item(item_id)
# TODO
"""
def getVideoFiles(embyId,embyPath):
#returns the video files for the item as plugin listing, can be used for browsing the actual files or videoextras etc.
emby = embyserver.Read_EmbyServer()
if not embyId:
if "plugin.video.emby" in embyPath:
embyId = embyPath.split("/")[-2]
if embyId:
item = emby.getItem(embyId)
putils = playutils.PlayUtils(item)
if putils.isDirectPlay():
#only proceed if we can access the files directly. TODO: copy local on the fly if accessed outside
filelocation = putils.directPlay()
if not filelocation.endswith("/"):
filelocation = filelocation.rpartition("/")[0]
dirs, files = xbmcvfs.listdir(filelocation)
for file in files:
file = filelocation + file
li = xbmcgui.ListItem(file, path=file)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=li)
for dir in dirs:
dir = filelocation + dir
li = xbmcgui.ListItem(dir, path=dir)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=dir, listitem=li, isFolder=True)
#xbmcplugin.endOfDirectory(int(sys.argv[1]))
"""
示例24
def end_of_directory(dir_update_listing, cache_to_disc=True):
# If dir_update_listing=True overwrite the history list, so we can get back to the main page
xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE,
succeeded=True,
updateListing=dir_update_listing,
cacheToDisc=cache_to_disc)
示例25
def home(self, pathitems=None, cache_to_disc=True, is_autoselect_profile=False): # pylint: disable=unused-argument
"""Show home listing"""
if not is_autoselect_profile and 'switch_profile_guid' in self.params:
# This is executed only when you have selected a profile from the profile list
if not activate_profile(self.params['switch_profile_guid']):
xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)
return
common.debug('Showing home listing')
list_data, extra_data = common.make_call('get_mainmenu') # pylint: disable=unused-variable
finalize_directory(convert_list_to_dir_items(list_data), g.CONTENT_FOLDER,
title=(g.LOCAL_DB.get_profile_config('profileName', '???') +
' - ' + common.get_local_string(30097)))
end_of_directory(False, cache_to_disc)
示例26
def exported(self, pathitems=None):
"""List all items that are exported to the Kodi library"""
chunked_video_list, perpetual_range_selector = library.list_contents(self.perpetual_range_start)
if chunked_video_list:
self._exported_directory(pathitems, chunked_video_list, perpetual_range_selector)
else:
ui.show_notification(common.get_local_string(30111))
xbmcplugin.endOfDirectory(g.PLUGIN_HANDLE, succeeded=False)
示例27
def kodi_draw_list(parts, rows):
for row in rows:
xbmcplugin.addDirectoryItem(*row.item(parts))
xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_UNSORTED)
xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_LABEL)
xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_VIDEO_RATING)
xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
xbmcplugin.addSortMethod(h, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.setContent(h, 'files')
xbmcplugin.endOfDirectory(h)
示例28
def end_of_directory(self):
'''Tell XBMC that we have finished adding items to this directory.'''
xbmcplugin.endOfDirectory(self.handle)
示例29
def topLevel():
# Build the top level menu with URL callbacks to this plugin
debugTrace("Displaying the top level menu")
url = base_url + "?settings"
li = xbmcgui.ListItem("Settings", iconImage=getIconPath()+"settings.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = base_url + "?display"
li = xbmcgui.ListItem("Display VPN status", iconImage=getIconPath()+"display.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
if addon.getSetting("vpn_system_menu_item") == "true":
url = base_url + "?system"
li = xbmcgui.ListItem("Display enhanced information", iconImage=getIconPath()+"enhanced.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
url = base_url + "?list"
li = xbmcgui.ListItem("Change or disconnect VPN connection", iconImage=getIconPath()+"locked.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
url = base_url + "?cycle"
li = xbmcgui.ListItem("Cycle through primary VPN connections", iconImage=getIconPath()+"cycle.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
url = base_url + "?switch"
if not getVPNMonitorState() == "":
if isVPNMonitorRunning():
li = xbmcgui.ListItem("Pause add-on filtering", iconImage=getIconPath()+"paused.png")
else:
li = xbmcgui.ListItem("Restart add-on filtering", iconImage=getIconPath()+"play.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
return
示例30
def listSystem(addon):
lines = getSystemData(addon, True, True, True, True)
for line in lines:
url = base_url + "?back"
li = xbmcgui.ListItem(line, iconImage=getIconPath()+"enhanced.png")
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
return