本文整理匯總了Python中xbmcgui.ListItem方法的典型用法代碼示例。如果您正苦於以下問題:Python xbmcgui.ListItem方法的具體用法?Python xbmcgui.ListItem怎麽用?Python xbmcgui.ListItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xbmcgui
的用法示例。
在下文中一共展示了xbmcgui.ListItem方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: play
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def play(url, id=0):
print url
engine=__settings__.getSetting("Engine")
if engine=="0":
play_ace(url, id)
if engine=="1":
item = xbmcgui.ListItem()#path=url
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
tthp.play(url, handle, id, __settings__.getSetting("DownloadDirectory"))
if engine=="2":
purl ="plugin://plugin.video.yatp/?action=play&torrent="+ urllib.quote_plus(url)+"&file_index="+str(id)
item = xbmcgui.ListItem()#path=purl
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
xbmc.Player().play(purl)
示例2: play_url
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [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()
示例3: add_item
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def add_item (name, mode="", path = Pdir, ind="0", cover=None, funart=None):
#print name
#print path
if path.find("720p")>0: qual="[COLOR FFA900EF][ 720p ] [/COLOR]"
elif path.find("480p")>0: qual="[COLOR FFFF0090][ 480p ] [/COLOR]"
elif path.find("400p")>0: qual="[COLOR FF70F020][ 400p ] [/COLOR]"
elif path.find("1080p")>0:qual="[COLOR FF50FF50][1080p] [/COLOR]"
else: qual="[ ???? ] "
if cover==None: listitem = xbmcgui.ListItem(qual+"[B]"+name+"[/B]")
else: listitem = xbmcgui.ListItem(qual+"[B]"+name+"[/B]", iconImage=cover)
listitem.setProperty('fanart_image', funart)
uri = sys.argv[0] + '?mode='+mode
uri += '&url=' + urllib.quote_plus(path.encode('utf-8'))
uri += '&name=' + urllib.quote_plus(xt(name))
uri += '&ind=' + urllib.quote_plus(ind)
if cover!=None:uri += '&cover=' + urllib.quote_plus(cover)
if funart!=None and funart!="":uri += '&funart=' + urllib.quote_plus(funart)
if mode=="play": fld=False
else: fld=True
xbmcplugin.addDirectoryItem(handle, uri, listitem, fld)
示例4: queue
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def queue():
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
show_title, season, episode, thumb, displayname, qmode, url = args.url.split('<join>')
name = base64.b64decode(displayname)
item = xbmcgui.ListItem(name, path = url)
try:
item.setThumbnailImage(thumb)
except:
pass
try:
item.setInfo('Video', { 'title' : name,
'season' : season,
'episode' : episode,
'TVShowTitle' : show_title})
except:
pass
playlist.add(url, item)
xbmc.executebuiltin('XBMC.Notification(%s, %s, 5000, %s)' % ("Queued", name, thumb))
示例5: play_video
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def play_video(video_uri = common.args.url):
# Handle the poewrnation specific video loading
if 'powernation' in video_uri:
video_data = connection.getURL(video_uri)
video_json = json.loads(video_data)
video_url = video_json['HLSURL']
item = xbmcgui.ListItem(path = video_url)
try:
item.setThumbnailImage(common.args.thumb)
except:
pass
try:
item.setInfo('Video', { 'title' : common.args.name,
'season' : common.args.season_number,
'episode' : common.args.episode_number,
'TVShowTitle' : common.args.show_title})
except:
pass
xbmcplugin.setResolvedUrl(pluginHandle, True, item)
else:
video_data = connection.getURL(video_uri)
video_url = BeautifulSoup(video_data, 'html5lib').find('div', class_ = 'video_player')['data-mgid']
main_viacom.play_video(BASE, video_url)
示例6: play_video
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def play_video(episode_url = common.args.url):
episode_data = connection.getURL(APIBASE + 'episode-details?episode_id=' + episode_url)
episode_json = json.loads(episode_data)
video_url = VIDEOURL % episode_json['data']['Episode']['FullEpisode']['PID']
print video_url
video_data = connection.getURL(video_url)
video_tree = BeautifulSoup(video_data)
finalurl = video_tree.video['src']
item = xbmcgui.ListItem(path = finalurl)
try:
item.setThumbnailImage(common.args.thumb)
except:
pass
try:
item.setInfo('Video', { 'title' : common.args.name,
'season' : common.args.season_number,
'episode' : common.args.episode_number,
'TVShowTitle' : common.args.show_title})
except:
pass
xbmcplugin.setResolvedUrl(pluginHandle, True, item)
示例7: resolve
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def resolve(name, url, iconimage, description):
host = url
if host.split('|')[0].endswith('.mp4') and 'clou' in host:
stream_url = host + '|User-Agent=%s&Referer=%s' % (urllib.quote_plus(client.agent(), ':/'), GAMATO)
name = name
elif 'tenies-online' in host:
stream_url = client.request(host)
stream_url = client.parseDOM(stream_url, 'a', {'id': 'link'}, ret='href')[0]
stream_url = evaluate(stream_url)
else:
stream_url = evaluate(host)
name = name.split(' [B]|')[0]
try:
liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo(type="Video", infoLabels={"Title": name, "Plot": description})
liz.setProperty("IsPlayable", "true")
liz.setPath(str(stream_url))
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
except BaseException:
control.infoDialog(Lang(32012), NAME)
示例8: resolve
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def resolve(name, url, iconimage, description):
stream_url = evaluate(url)
name = name.split(' [B]|')[0]
if stream_url is None:
control.infoDialog('Prueba otro enlace', NAME, ICON, 4000)
elif '.mpd|' in stream_url:
stream_url, headers = stream_url.split('|')
listitem = xbmcgui.ListItem(path=stream_url)
listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
listitem.setMimeType('application/dash+xml')
listitem.setProperty('inputstream.adaptive.stream_headers', headers)
listitem.setContentLookup(False)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
else:
try:
liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
liz.setInfo(type="Video", infoLabels={ "Title": name, "Plot": description })
liz.setProperty("IsPlayable", "true")
liz.setPath(str(stream_url))
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
except:
control.infoDialog('Prueba otro enlace', NAME, ICON, 4000)
示例9: search_songs
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def search_songs(query):
playlist = []
url = 'https://musicmp3.ru/search.html?text=%s&all=songs' % urllib.quote_plus(query.replace(' - ', ' ').replace('-', ' ').replace(' FT ', ' ').replace(' FEATURING ', ' ').replace(' ', '+'))
link = GET_url(url)
link = link.replace('<td class="song__artist song__artist--search">Various Artist</td>', '<td class="song__artist song__artist--search"><a class="song__link" href="/artist_various-artist.html">Various Artist</a></td>')
match = re.compile('<tr class="song"><td class="song__play_button"><a class="player__play_btn js_play_btn" href="#" rel="(.+?)" title="Play track"/></td><td class="song__name song__name--search"><a class="song__link" href="(.+?)">(.+?)</a></td><td class="song__artist song__artist--search"><a class="song__link" href="(.+?)">(.+?)</a></td><td class="song__album song__album--search"><a class="song__link" href="(.+?)">(.+?)</a>').findall(link)
for id,songurl,song,artisturl,artist,albumurl,album in match:
iconimage = ""
url = 'https://listen.musicmp3.ru/' + id # 'http://files.musicmp3.ru/lofi/' + id
#url = 'http://listen.musicmp3.ru/2f99f4bf4ce7b171/' + id
title = "%s - %s - %s" % (artist.replace('&','and'), song.replace('&','&'), album.replace('&','&'))
addDirAudio(title,url,10,iconimage,song,artist,album,'','')
liz=xbmcgui.ListItem(song, iconImage=iconimage, thumbnailImage=iconimage)
liz.setInfo('music', {'Title':song, 'Artist':artist, 'Album':album})
liz.setProperty('mimetype', 'audio/mpeg')
liz.setThumbnailImage(iconimage)
liz.setProperty('fanart_image', audio_fanart)
playlist.append((url, liz))
setView('music', 'song')
示例10: addLinkItem
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [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
示例11: play
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def play(self, item=None, listitem=None, windowed=False, statrpos=-1):
"""
Play this item.
:param item: [opt] string - filename, url or playlist.
:param listitem: [opt] listitem - used with setInfo() to set different infolabels.
:param windowed: [opt] bool - true=play video windowed, false=play users preference.(default)
:param startpos: [opt] int - starting position when playing a playlist. Default = -1
.. note:: If item is not given then the Player will try to play the current item
in the current playlist.
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.
example::
listitem = xbmcgui.ListItem('Ironman')
listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
xbmc.Player().play(url, listitem, windowed)
xbmc.Player().play(playlist, listitem, windowed, startpos)
"""
pass
示例12: add
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def add(self, url, listitem=None, index=-1):
"""Adds a new file to the playlist.
:param url: string or unicode - filename or url to add.
:param listitem: listitem - used with setInfo() to set different infolabels.
:param index: integer - position to add playlist item.
Example::
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
video = 'F:\\movies\\Ironman.mov'
listitem = xbmcgui.ListItem('Ironman', thumbnailImage='F:\\movies\\Ironman.tbn')
listitem.setInfo('video', {'Title': 'Ironman', 'Genre': 'Science Fiction'})
playlist.add(url=video, listitem=listitem, index=7)
"""
pass
示例13: addItemsToList
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def addItemsToList(self, controlId, options, properties=None):
Logutil.log('addItemsToList', util.LOG_LEVEL_INFO)
control = self.getControlById(controlId)
control.setVisible(1)
control.reset()
items = []
for i in range(0, len(options)):
option = options[i]
p = ''
if properties:
p = properties[i]
items.append(xbmcgui.ListItem(option, p))
control.addItems(items)
示例14: filter_id_values
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def filter_id_values(self, filter_items, header_text, control_id, current_value, show_entry_all_items):
# Sort the consoles by name
filter_items = sorted(filter_items, key=lambda filter_item: filter_item[1])
if show_entry_all_items:
filter_items = [('0', util.localize(32120))] + filter_items
items = []
for filter_item in filter_items:
item = xbmcgui.ListItem(filter_item[1])
item.setProperty('id', str(filter_item[0]))
items.append(item)
index = xbmcgui.Dialog().select(header_text, items)
if index < 0:
return current_value, False
item = items[index]
button = self.getControlById(control_id)
button.setLabel(item.getLabel())
return int(item.getProperty('id')), True
示例15: addDir
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import ListItem [as 別名]
def addDir(name,url,mode,iconimage,total,pasta,fan_art="%s/fanart.jpg"%settings.getAddonInfo("path"),parser=None,parserfunction=None):
if "plugin://" in sys.argv[0]: u = sys.argv[0]; sysargv = sys.argv[0]
else: u = 'plugin://plugin.video.p2p-streams/'; sysargv = 'plugin://plugin.video.p2p-streams/'
u += "?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
try: u += "&parser="+urllib.quote_plus(parser)
except: pass
try: u += "&parserfunction="+urllib.quote_plus(parserfunction)
except: pass
contextmen = []
liz=xbmcgui.ListItem(name,iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name} )
liz.setProperty('fanart_image', fan_art)
if mode == 1 or mode == 2:
fic = hashlib.md5(name + '|' + url).hexdigest() + '.txt'
if os.path.exists(os.path.join(mystrm_folder,fic)):
contextmen.append((translate(30025), 'XBMC.RunPlugin(%s?mode=13&url=%s&name=%s&iconimage=%s)' % (sysargv, urllib.quote_plus(url),name,iconimage)))
else:
contextmen.append((translate(30026), 'XBMC.RunPlugin(%s?mode=12&url=%s&name=%s&iconimage=%s)' % (sysargv,urllib.quote_plus(url),name,iconimage)))
liz.addContextMenuItems(contextmen,replaceItems=False)
return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=pasta,totalItems=total)