本文整理汇总了Python中xbmcplugin.addDirectoryItem函数的典型用法代码示例。如果您正苦于以下问题:Python addDirectoryItem函数的具体用法?Python addDirectoryItem怎么用?Python addDirectoryItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addDirectoryItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_episodes
def list_episodes(self, movie_id):
xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
query_params = {'movieid': movie_id}
m = self.__request__('movie', query_params)['r']
_id = m['MovieID']
name = m['MovieName']
aka = m['KnownAs']
trailer = m['Trailer']
poster = m['Poster']
if 'Poster214x321' in m:
poster = m['Poster214x321']
runtime = m['Runtime']
plot = m['PlotVI']
rating = m['ImdbRating']
country = m['Country']
release_date = m['ReleaseDate']
backdrop = m['Backdrop']
banner = m['Banner']
num_episodes = m['Episode']
thumbs = sorted(m['Thumbs'].keys(), key=lambda x: int(x))
for thumb in thumbs:
t = unicode.join(u'',[u'Tập', ' ', thumb])
item = xbmcgui.ListItem(t)
item.setInfo(type="Video", infoLabels={"Label": name, "Title": t, "Plot": plot, 'Year': release_date})
epThumb = m['Thumbs'][thumb]
item.setArt({'poster': epThumb, 'thumb': epThumb})
item.setProperty("Fanart_Image", backdrop)
u = self.__build_url__({'action': 'play_movie', 'movie_id': _id, 'episode': thumb})
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=False)
xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True)
示例2: addDir
def addDir(name,url,mode,iconimage,itemcount,isFolder=False):
try:
if not 'COLOR' in name:
splitName=name.partition('(')
simplename=""
simpleyear=""
if len(splitName)>0:
simplename=splitName[0]
simpleyear=splitName[2].partition(')')
if len(simpleyear)>0:
simpleyear=simpleyear[0]
mg = metahandlers.MetaData()
meta = mg.get_meta('movie', name=simplename ,year=simpleyear)
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
ok=True
liz=xbmcgui.ListItem(name, iconImage=meta['cover_url'], thumbnailImage=meta['cover_url'])
liz.setInfo( type="Video", infoLabels= meta )
liz.setProperty("IsPlayable","true")
contextMenuItems = []
contextMenuItems.append(('Movie Information', 'XBMC.Action(Info)'))
liz.addContextMenuItems(contextMenuItems, replaceItems=False)
if not meta['backdrop_url'] == '': liz.setProperty('fanart_image', meta['backdrop_url'])
else: liz.setProperty('fanart_image', fanart)
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=isFolder,totalItems=itemcount)
return ok
except:
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
ok=True
liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
liz.setProperty('fanart_image', fanart)
liz.setProperty("IsPlayable","true")
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=isFolder)
return ok
示例3: addDir
def addDir(title, url, mode, page=0, searchValue=''):
sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + \
'&mode=' + urllib.quote_plus(str(mode)) + '&page=' + urllib.quote_plus(str(page))+'&search'+\
urllib.quote_plus(str(searchValue))
item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='')
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)
示例4: Get_Header
def Get_Header(par, count):
if par.search == "":
info = "Сериалов: " + "[COLOR FF00FF00]" + str(count) + "[/COLOR] | "
info += "Жанр: " + "[COLOR FFFF00FF]" + par.genre_name + "[/COLOR] | "
info += "Страна: " + "[COLOR FFFFF000]" + par.country_name + "[/COLOR]"
else:
info = "Поиск: " + "[COLOR FF00FFF0]" + par.search + "[/COLOR]"
if info <> "":
# -- info line
name = info
i = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
u = sys.argv[0] + "?mode=EMPTY"
# -- filter parameters
u += "&genre=%s" % urllib.quote_plus(par.genre)
u += "&genre_name=%s" % urllib.quote_plus(par.genre_name)
u += "&country=%s" % urllib.quote_plus(par.country)
u += "&country_name=%s" % urllib.quote_plus(par.country_name)
xbmcplugin.addDirectoryItem(h, u, i, True)
# -- genre
if par.genre == "0" and par.search == "" and par.history == "":
name = "[COLOR FFFF00FF]" + "[ЖАНР]" + "[/COLOR]"
i = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
u = sys.argv[0] + "?mode=GENRE"
# -- filter parameters
u += "&genre=%s" % urllib.quote_plus(par.genre)
u += "&genre_name=%s" % urllib.quote_plus(par.genre_name)
u += "&country=%s" % urllib.quote_plus(par.country)
u += "&country_name=%s" % urllib.quote_plus(par.country_name)
xbmcplugin.addDirectoryItem(h, u, i, True)
# -- genre
if par.country == "0" and par.search == "" and par.history == "":
name = "[COLOR FFFFF000]" + "[СТРАНА]" + "[/COLOR]"
i = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
u = sys.argv[0] + "?mode=COUNTRY"
# -- filter parameters
u += "&genre=%s" % urllib.quote_plus(par.genre)
u += "&genre_name=%s" % urllib.quote_plus(par.genre_name)
u += "&country=%s" % urllib.quote_plus(par.country)
u += "&country_name=%s" % urllib.quote_plus(par.country_name)
xbmcplugin.addDirectoryItem(h, u, i, True)
# -- search & history
if par.country == "0" and par.genre == "0" and par.search == "" and par.history == "":
name = "[COLOR FF00FFF0]" + "[ПОИСК]" + "[/COLOR]"
i = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
u = sys.argv[0] + "?mode=MOVIE"
# -- filter parameters
u += "&search=%s" % urllib.quote_plus("Y")
xbmcplugin.addDirectoryItem(h, u, i, True)
name = "[COLOR FF00FF00]" + "[ИСТОРИЯ]" + "[/COLOR]"
i = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon)
u = sys.argv[0] + "?mode=MOVIE"
# -- filter parameters
u += "&history=%s" % urllib.quote_plus("Y")
xbmcplugin.addDirectoryItem(h, u, i, True)
示例5: get_ttv
def get_ttv():
url='http://www.acesportstream.com'
url=read_url(url)
soup=bs(url)
channels1=soup.find('div',{'id':'hd'}).findAll('a')
channels2=soup.find('div',{'id':'blue'}).findAll('a')
for channel in channels1:
link=channel['href']
img=channel.find('img')['src']
name=clean(cleanex(channel['title']))
url = build_url({'mode': 'open_ttv_stream','url':link, 'name':name.encode('ascii','ignore')})
li = xbmcgui.ListItem('%s'%name, iconImage=img)
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
for channel in channels2:
link=channel['href']
img=channel.find('img')['src']
name=clean(cleanex(channel['title']))
url = build_url({'mode': 'open_ttv_stream','url':link, 'name':name.encode('ascii','ignore')})
li = xbmcgui.ListItem('%s'%name, iconImage=img)
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
示例6: ttv_sport
def ttv_sport():
base_url = 'http://super-pomoyka.us.to/trash/ttv-list/ttv.m3u'
source = read_url(base_url)
if source:
match= re.compile("#EXTINF:-1,Sky Sports News \(.+?\)\n(.*)").findall(source)
if match:
name='Sky Sports News'
ace=match[0]
url='plugin://program.plexus/?mode=1&url=%s&name=%s'%(ace,name.replace(' ','+'))
li = xbmcgui.ListItem('%s'%name, iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png')
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
match= re.compile("#EXTINF:-1,(.+?)\(Спорт\)\n(.*)").findall(source)
for titulo,acestream in match:
name=titulo
ace=acestream
clean = re.compile("\((.+?)\)").findall(name)
for categorie in clean:
name = name.replace("(" + categorie +")","")
ace=acestream
url='plugin://program.plexus/?mode=1&url=%s&name=%s'%(ace,name.replace(' ','+'))
li = xbmcgui.ListItem('%s'%name, iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png')
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
示例7: _addDir
def _addDir(self, name, action_key, action_value, iconimage, is_folder):
"""
.. py_function:: _addDir(self, name, action_key, action_value,
iconimage, is_folder)
Creates a link in xbmc.
:param name: Name of the link
:param action_key: Name of the action to take when link selected
:param action_value: Parameter to use with the action
:param iconimage: Icon to use for the link
:param is_folder: Does the link lead to a folder or playable item
"""
formatparams = {
"base_url": self.base_url,
"key": quote(str(action_key)),
"value": quote(str(action_value)),
"name": quote(str(name))
}
url = "{base_url}?action_key={key}&action_value={value}&name={name}".format(**formatparams)
listitem = xbmcgui.ListItem(name,
iconImage=iconimage,
thumbnailImage='')
listitem.setInfo(type="Video", infoLabels={"Title": name})
xbmcplugin.addDirectoryItem(
handle=self.addon_handle,
url=url,
listitem=listitem,
isFolder=is_folder)
示例8: addDir
def addDir(title, url, mode):
sys_url = sys.argv[0] + '?title=' + urllib.quote_plus(title) + '&url=' + urllib.quote_plus(url) + '&mode=' + urllib.quote_plus(str(mode))
item = xbmcgui.ListItem(title, iconImage='DefaultFolder.png', thumbnailImage='')
item.setInfo( type='Video', infoLabels={'Title': title} )
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=sys_url, listitem=item, isFolder=True)
示例9: addLink
def addLink(name,url,title,iconimage):
if iconimage == '':
iconimage = ICON
liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": title } )
liz.setProperty('fanart_image',FANART)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
示例10: addVideoDirR
def addVideoDirR(name, url, mode, iconimage, videoType="", desc="", duration="", year="", mpaa="", director="", genre="", rating=""):
filename = (''.join(c for c in unicode(url, 'utf-8') if c not in '/\\:?"*|<>')).strip()+".jpg"
coverFile = os.path.join(cacheFolderCoversTMDB, filename)
fanartFile = os.path.join(cacheFolderFanartTMDB, filename)
if os.path.exists(coverFile):
iconimage = coverFile
u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&thumb="+urllib.quote_plus(iconimage)
ok = True
liz = xbmcgui.ListItem(name, iconImage="DefaultTVShows.png", thumbnailImage=iconimage)
liz.setInfo(type="video", infoLabels={"title": name, "plot": desc, "duration": duration, "year": year, "mpaa": mpaa, "director": director, "genre": genre, "rating": rating})
if os.path.exists(fanartFile):
liz.setProperty("fanart_image", fanartFile)
elif os.path.exists(coverFile):
liz.setProperty("fanart_image", coverFile)
entries = []
entries.append((translation(30134), 'RunPlugin(plugin://plugin.video.netflixbmc/?mode=playTrailer&url='+urllib.quote_plus(name)+')',))
entries.append((translation(30115), 'RunPlugin(plugin://plugin.video.netflixbmc/?mode=removeFromQueue&url='+urllib.quote_plus(url)+')',))
if videoType == "tvshow":
entries.append((translation(30122), 'RunPlugin(plugin://plugin.video.netflixbmc/?mode=addSeriesToLibrary&url=&name='+str(name.strip())+'&seriesID='+str(url)+')',))
if browseTvShows:
entries.append((translation(30121), 'Container.Update(plugin://plugin.video.netflixbmc/?mode=playVideo&url='+urllib.quote_plus(url)+'&thumb='+urllib.quote_plus(iconimage)+')',))
else:
entries.append((translation(30118), 'Container.Update(plugin://plugin.video.netflixbmc/?mode=listSeasons&url='+urllib.quote_plus(url)+'&thumb='+urllib.quote_plus(iconimage)+')',))
elif videoType == "movie":
entries.append((translation(30122), 'RunPlugin(plugin://plugin.video.netflixbmc/?mode=addMovieToLibrary&url='+urllib.quote_plus(url)+'&name='+str(name.strip()+' ('+year+')')+')',))
liz.addContextMenuItems(entries)
if mode == "playVideo":
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=False)
else:
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True)
return ok
示例11: PlayVideo1
def PlayVideo1(url, listitem):
addon_handle = int(sys.argv[1])
xbmcplugin.setContent(addon_handle, 'video')
li = xbmcgui.ListItem('[COLOR dodgerblue][B]PLAY STREAM[/B][/COLOR] >> ', iconImage='http://maps.synthicity.com/activemaps/images/button_black_play.png', thumbnailImage= 'http://maps.synthicity.com/activemaps/images/button_black_play.png')
li.setProperty('fanart_image', 'https://raw.githubusercontent.com/TheYid/My-Repo/master/repository.TheYid/fanart.jpg')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
xbmcplugin.endOfDirectory(addon_handle)
示例12: INC_start
def INC_start():
dbg_log('-INC_start')
http = get_url(INC_urlw + '/index.php', save_cookie = True)
mycookie = re.search('<cookie>(.+?)</cookie>', http).group(1)
http = get_url(INC_urlw + INC_auth,
data = "LoginForm%5Busername%5D=" + urllib.quote_plus(usr_log) + "&LoginForm%5Bpassword%5D=" + urllib.quote_plus(usr_pwd),
cookie = mycookie, save_cookie = True, referrer = INC_urlw + '/index.php', accept='json')
try:
mycookie = re.search('<cookie>(.+?)</cookie>', http).group(1)
except:
pass
http = get_url(INC_urlw + '/index.php', cookie = mycookie)
#mycookie = re.search('<cookie>(.+?)</cookie>', http).group(1)
name='Live TV'
item = xbmcgui.ListItem(name)
uri = sys.argv[0] + '?mode=live' + '&cook=' + urllib.quote_plus(mycookie)
xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)
name='Archives'
item = xbmcgui.ListItem(name)
uri = sys.argv[0] + '?mode=chls' + '&cook=' + urllib.quote_plus(mycookie)
xbmcplugin.addDirectoryItem(pluginhandle, uri, item, True)
xbmcplugin.endOfDirectory(pluginhandle)
示例13: INC_live
def INC_live(url, mycookie):
dbg_log('INC_live')
http = get_url(url, cookie = mycookie, referrer = INC_urlw + '/index.php')
# guest = re.compile('var isGuest=(.+?);').findall(http)
# print '--GUEST--'
# print guest
oneline = re.sub('[\r\n]', ' ', http)
pr_ls = re.compile('<tr > +?<td class="col01"><a href="(.+?)"><img src="(.+?)" alt="(.+?)" /></a></td>').findall(oneline)
if len(pr_ls):
for href,logo,descr in pr_ls:
name = descr
dbg_log(name)
item = xbmcgui.ListItem(name, iconImage=INC_url + logo, thumbnailImage=INC_url + logo)
uri = sys.argv[0] + '?mode=play'
uri += '&url='+urllib.quote_plus(INC_urlw + href) + '&cook=' + urllib.quote_plus(mycookie)
item.setInfo( type='video', infoLabels={'title': name, 'plot': descr})
item.setProperty('IsPlayable', 'true')
dbg_log(uri)
xbmcplugin.addDirectoryItem(pluginhandle, uri, item)
xbmcplugin.endOfDirectory(pluginhandle)
示例14: addDir
def addDir(name, url, mode, iconimage, description):
u = (
sys.argv[0]
+ "?url="
+ urllib.quote_plus(url)
+ "&mode="
+ str(mode)
+ "&name="
+ urllib.quote_plus(name)
+ "&iconimage="
+ urllib.quote_plus(iconimage)
+ "&description="
+ urllib.quote_plus(description)
)
ok = True
liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": description})
if mode == 1:
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz)
elif mode == 3 or mode == 5:
liz.setProperty("IsPlayable", "true")
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=False)
else:
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True)
return ok
示例15: addVideo
def addVideo(linkName = '', source = '', videoID = '', thumbPath = '', date = ''):
"""Add a video to an XBMC directory listing
Arguments: linkName -- A string containg the name of the video
url -- A string containing the direct url to the video
thumbPath -- A string containg the url/path of the video's thumbnail image
date -- a dataetime object containg the date of the video"""
url = sys.argv[0] + "?source=" + source + "&id=" + videoID
# initialise a listitem object to store video details
li = xbmcgui.ListItem(linkName, iconImage = thumbPath, thumbnailImage = thumbPath)
# set the video to playable
li.setProperty("IsPlayable", 'true')
# set the infolabels for the video
li.setInfo( type="Video", infoLabels={ "title": linkName, "date":date} )
# set fanart image for video
li.setProperty( "Fanart_Image", os.path.join(__addondir__, 'fanart.jpg'))
# add listitem object to list
xbmcplugin.addDirectoryItem(handle = __addonidint__, url = url, listitem = li, isFolder = False)