本文整理汇总了Python中xbmcplugin.endOfDirectory函数的典型用法代码示例。如果您正苦于以下问题:Python endOfDirectory函数的具体用法?Python endOfDirectory怎么用?Python endOfDirectory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了endOfDirectory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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)
示例2: SEARCHSR
def SEARCHSR():
search = ''
refresh = xbmcgui.Window(10000).getProperty('MASH_SR_REFRESH') == 'True'
if refresh:
search = xbmcgui.Window(10000).getProperty('MASH_SR_TERM')
xbmcgui.Window(10000).clearProperty('MASH_SR_REFRESH')
xbmcgui.Window(10000).clearProperty('MASH_SR_TERM')
if len(search) < 1:
keyb = xbmc.Keyboard('', 'Search Shows')
keyb.doModal()
if (keyb.isConfirmed()):
search = keyb.getText()
if not search:
xbmcplugin.endOfDirectory(int(sys.argv[1]),False,False)
return
xbmcgui.Window(10000).setProperty('MASH_SR_TERM', search)
encode=urllib.quote(search)
surl='http://www.sidereel.com/_television/search?utf8=%E2%9C%93&q='+encode
sys.argv.append(surl)
SEARCHED(surl)
示例3: listA
def listA(name, type, url, thumb):
link = GetHttpData(url)
match1 = re.compile("<!-- 剧集列表 start -->(.+?)<!-- 剧集列表 end -->", re.DOTALL).findall(link)
match2 = re.compile('<div class="left">(.+?)</div>', re.DOTALL).findall(match1[0])
if match2:
match = re.compile(r"'videoListCon', '(.+?)'", re.DOTALL).findall(match2[0])
if match:
FindItems(type, match1[0])
for url in match:
link = GetHttpData("http://www.juchang.com" + url)
link = link.decode("gbk").encode("utf8")
FindItems(type, link)
match2 = re.compile('<a href="#" class="one"(.+?)<a class="two"', re.DOTALL).findall(link)
if match2:
match3 = re.compile(r"'videoListCon','(.+?)'", re.DOTALL).findall(match2[0])
for urla in match3:
link = GetHttpData("http://www.juchang.com" + urla)
link = link.decode("gbk").encode("utf8")
FindItems(type, link)
else:
FindItems(type, match1[0])
else:
FindItems(type, match1[0])
xbmcplugin.setContent(int(sys.argv[1]), "movies")
xbmcplugin.endOfDirectory(int(sys.argv[1]))
示例4: show_playlists_by_channel
def show_playlists_by_channel(Channelid, type=''):
search_response = ytube.yt_get_channel_info(Channelid)
#Grab the playlists from the response
playlists = search_response['items'][0]['contentDetails']['relatedPlaylists']
# Go through each playlist and display the playlist
for key, value in playlists.iteritems():
#Grab the number of videos to
pl = ytube.yt_get_playlist_info(value)
number_vids = str(pl['items'][0]['contentDetails']['itemCount'])
#videos.append(search_result)
url = dev.build_url({'mode': 'addPlaylist', 'id': value, 'type': type})
dev.adddir(key.capitalize()+' ('+number_vids+')', url, search_response['items'][0]['snippet']['thumbnails']['high']['url'], fanart=search_response['items'][0]['snippet']['thumbnails']['high']['url'], description=dev.lang(31010)+' '+dev.typeName(type)+' \n--------\nPlaylist Description:\n'+search_response['items'][0]['snippet']['description'])
# Grab other playlists this user has created to
response = ytube.yt_get_playlists_by_channel(Channelid)
if isinstance(response, list):
# Go through each playlist and display the playlist
for playlist in response:
#videos.append(search_result)
title = playlist['snippet']['title']+' ('+str(playlist['contentDetails']['itemCount'])+')'
url = dev.build_url({'mode': 'addPlaylist', 'id': playlist['id'], 'type': type})
dev.adddir(title, url, playlist['snippet']['thumbnails']['high']['url'], fanart=playlist['snippet']['thumbnails']['high']['url'], description=dev.lang(31010)+' '+dev.typeName(type)+' \n--------\nPlaylist Description:\n'+playlist['snippet']['description'])
xbmcplugin.endOfDirectory(vars.addon_handle)#Adds a playlist & loads the view to edit it
示例5: listContent
def listContent(self, url):
api = self.hbogoAPI(url)
items = api['Collections'][0]['MediaItems']
for i in range(len(items)):
desc = self.dec(items[i]['Abstract'])
img = self.dec(items[i]['ThumbnailUrl'])
title = self.dec(items[i]['Name'])
id = self.dec(items[i]['Id'])
materialId = self.dec(items[i]['MaterialId'])
materialItemId = self.dec(items[i]['MaterialItemId'])
origTitle = self.dec(items[i]['OriginalName'])
content = items[i]['ContentType']
n_url = plapiUrl + mediaPlayer + id + '/' + materialId + '/' + materialItemId + '/TABL'
if dbg == 'true':
log.info("HBOGO - listSeasons() -> title: " + str(title))
log.info("HBOGO - listSeasons() -> img link: " + img)
log.info("HBOGO - listSeasons() -> url: " + n_url)
log.info("HBOGO - listSeasons() -> content: " + str(content))
if content == 1:
self.addDir(SERVICE, 'movie', title, img, desc, n_url)
elif content == 2:
self.addDir(SERVICE, 'episode', title, img, desc, n_url)
elif content == 5:
self.addDir(SERVICE, 'season', title, img, desc, n_url)
#self.addDir(SERVICE, 'series', '', '', '', '')
xbmcplugin.endOfDirectory(int(sys.argv[1]))
示例6: getcontent_search
def getcontent_search(url):
debug("getcontent_search :" + url)
inhalt=geturl(url)
inhalt=ersetze(inhalt)
kurz_inhalt = inhalt[inhalt.find('<span class="resultsCount">')+1:]
kurz_inhalt = kurz_inhalt[:kurz_inhalt.find('<script type="text/javascript">')]
spl=kurz_inhalt.split('<div class="teaserInner clearFix">')
for i in range(1,len(spl),1):
entry=spl[i]
match=re.compile('<a href="([^"]+)"', re.DOTALL).findall(entry)
url=baseurl+match[0]
match=re.compile('<img src="([^"]+)"', re.DOTALL).findall(entry)
img=match[0]
match=re.compile('<span class="name">([^<]+)</span>', re.DOTALL).findall(entry)
name=match[0]
match=re.compile('<span class="episode">([^<]+)</span>', re.DOTALL).findall(entry)
beschreibung=match[0]
match=re.compile('<time class="duration" datetime="[^"]+">[0-9]+ Min.</time>', re.DOTALL).findall(entry)
dauer=match[0]
addLink(name=name +" ( "+ beschreibung + " )", url=url, mode="folge", iconimage=img,duration=dauer,desc=beschreibung)
#debug(inhalt)
match=re.compile('<a class="sprite ir" href="([^"]+)"', re.DOTALL).findall(inhalt)
if match:
addDir(name="Next", url=baseurl+match[0], mode="getcontent_search", iconimage="" )
xbmcplugin.endOfDirectory(addon_handle,succeeded=True,updateListing=False,cacheToDisc=True)
示例7: get_genres
def get_genres():
headers = get_headers()
# get the chunk from the headers list that matches this pageCode/id,
# e.g. if we are in the 'Tv' page, get the relevant subMenu, etc. for this page
header = list(filter(lambda x: x['id'] == id, headers))
sub_menu_id = header[0]['subMenu'][0]['submenuId']
# sub_menu_id = header[0]['subMenu'][0]['submenuId']
sub_menu_name = header[0]['name'].lower()
genres = None
# combine genres for tv and originals because some genres don't show up and it seems that both may share the same genres
if sub_menu_name in ['tv', 'originals']:
genres = [
{'genreID': g['genreId'], 'genreName': g['genreName']}
for h in headers
for s in h['subMenu']
for g in s['subGenre']
]
genres.extend(get_genres_by_type(id, 'tv'))
genres.extend(get_genres_by_type(id, 'movies'))
else:
genres = header[0]['subMenu'][0]['subGenre']
moreGenres = get_genres_by_type(id, sub_menu_name)
if moreGenres and moreGenres != 'null':
genres.extend(moreGenres)
# make the list unique by genreId
genres = {g['genreId'] if 'genreId' in g else g['genreID']: g for g in genres}.values()
genres = sorted(genres, key = lambda g: g['genreName'])
for g in genres:
# set the page that we're at (tv, originals, movies, etc.) so we can tell if we're in movies because movies don't have episodes
extra = {'pageCode': id, 'submenuID': sub_menu_id}
genreId = g['genreId'] if 'genreId' in g else g['genreID']
add_dir(g['genreName'], genreId, mode_show, extra = extra)
xbmcplugin.endOfDirectory(this_plugin)
示例8: panDir
def panDir():
while not panAuth():
if xbmcgui.Dialog().yesno(_name, ' Login Failed', 'Bad User / Pass / Proxy', ' Check Settings?'):
_settings.openSettings()
else: exit()
sort = _settings.getSetting('sort')
stations = _pandora.stations
quickmix = stations.pop(0) # Quickmix
if sort == '0': stations = stations # Normal
elif sort == '2': stations = stations[::-1] # Reverse
else: stations = sorted(stations, key=lambda s: s.name) # A-Z
stations.insert(0, quickmix) # Quickmix back on top
for station in stations:
li = xbmcgui.ListItem(station.name, station.id)
li.setProperty('IsPlayable', 'true')
img = _settings.getSetting("img-%s" % station.id)
li.setIconImage(img)
li.setThumbnailImage(img)
li.addContextMenuItems([('Select Thumb', "RunPlugin(plugin://%s/?thumb=%s)" % (_plugin, station.id))])
xbmcplugin.addDirectoryItem(_handle, "%s?station=%s" % (_base, station.id), li)
xbmcplugin.endOfDirectory(_handle, cacheToDisc = False)
xbmc.log("%s.Dir OK" % _plugin, xbmc.LOGDEBUG)
示例9: build_main_directory
def build_main_directory():
main=[
( settings.getLocalizedString(30000), search_thumb, '0' ),
( settings.getLocalizedString(30001), film_reel_thumb, '1' ),
( settings.getLocalizedString(30002), clapperboard_thumb, '2' ),
( settings.getLocalizedString(30003), oscar_thumb, '3' ),
( settings.getLocalizedString(30004), popcorn_thumb, '6' ),
( settings.getLocalizedString(30015), library_thumb, '7' )
]
for name, thumbnailImage, mode in main:
listitem = xbmcgui.ListItem( label = name, iconImage = "DefaultVideo.png", thumbnailImage = thumbnailImage )
u = { 'mode': mode, 'name': name }
addListItem(label = name, image = thumbnailImage, url = u, isFolder = True, totalItems = 0, infoLabels = False)
data = getUrl( 'http://www.traileraddict.com' )
url_thumb_x_title = re.compile( '<a href="/trailer/(.+?)"><img src="(.+?)" border="0" alt="(.+?)" title="(.+?)" style="margin:2px 10px 8px 10px;">' ).findall( data )
totalItems = len(url_thumb_x_title)
for url, thumb, x, title in url_thumb_x_title:
title = title.rsplit( ' - ' )
name1 = clean( title[0] )
if len( title ) > 1:
name2 = clean( title[0] ) + ' (' + clean( title[1] ) + ')'
else:
name2 = clean( title[0] )
url = 'http://www.traileraddict.com/trailer/' + url
thumb = 'http://www.traileraddict.com' + thumb
cm = []
run = sys.argv[0] + '?' + urllib.urlencode({ 'mode': '5', 'name': name2, 'url': url, 'download': 'True' })
cm.append( (settings.getLocalizedString(30059), "XBMC.RunPlugin(%s)" % run) )
cm.append( (settings.getLocalizedString(30014), "XBMC.RunPlugin(plugin://plugin.video.couchpotato_manager/movies/add?title=%s)" % name1) )
u = { 'mode': '5', 'name': name2, 'url': url }
addListItem(label = name1, image = thumb, url = u, isFolder = False, totalItems = totalItems, infoLabels = False, cm = cm)
xbmcplugin.addSortMethod( handle = int(sys.argv[1]), sortMethod = xbmcplugin.SORT_METHOD_NONE )
setViewMode("500", "movies")
xbmcplugin.endOfDirectory( int( sys.argv[1] ) )
示例10: listVideos
def listVideos(id):
content = getUrl("http://redux.com/hg.channelinfo/"+id)
spl=content.split('"pid":')
for i in range(1,len(spl),1):
entry=spl[i]
match=re.compile('"title":"(.+?)"', re.DOTALL).findall(entry)
title=match[0]
title=cleanTitle(title)
match=re.compile('"type":"(.+?)"', re.DOTALL).findall(entry)
type=match[0]
match=re.compile('"id":"(.+?)"', re.DOTALL).findall(entry)
id=match[0]
match=re.compile('</span>(.+?)<span class=', re.DOTALL).findall(entry)
desc=""
if len(match)>0:
desc=match[0]
match=re.compile('"duration":(.+?),', re.DOTALL).findall(entry)
try:
min=int(int(match[0])/60)
sec=int(int(match[0])%60)
duration=str(min)+":"+str(sec)
except:
duration=""
match=re.compile('"imagebase":"(.+?)"', re.DOTALL).findall(entry)
thumb=match[0]+"strip203x150"
if type=="youtube":
addLink(title,id,'playYoutube',thumb,desc,duration)
elif type=="vimeo":
addLink(title,id,'playVimeo',thumb,desc,duration)
xbmcplugin.endOfDirectory(pluginhandle)
if forceViewMode==True:
xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')
示例11: mainlist
def mainlist(params,url,category):
logger.info("[favoritos.py] mainlist")
import xbmctools
# Crea un listado con las entradas de favoritos
if usingsamba:
ficheros = samba.get_files(BOOKMARK_PATH)
else:
ficheros = os.listdir(BOOKMARK_PATH)
ficheros.sort()
for fichero in ficheros:
try:
# Lee el bookmark
titulo,thumbnail,plot,server,url = readbookmark(fichero)
# Crea la entrada
# En la categoría va el nombre del fichero para poder borrarlo
xbmctools.addnewvideo( CHANNELNAME , "play" , os.path.join( BOOKMARK_PATH, fichero ) , server , titulo , url , thumbnail, plot )
except:
pass
# Label (top-right)...
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 )
示例12: listChannels
def listChannels(type):
xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL)
content = getUrl("http://redux.com/hg.shellinit")
content = content[content.find('"'+type+'":'):]
content = content[:content.find('</div>\\n</div>\\n\\n",')]
spl=content.split("<div class='chan'")
for i in range(1,len(spl),1):
entry=spl[i]
match=re.compile("<div class='title'>(.+?)</div>", re.DOTALL).findall(entry)
match2=re.compile("<div class='title'>(.+?)</div>", re.DOTALL).findall(entry)
if len(match)>0:
title=match[0]
elif len(match2)>0:
title=match2[0]
title=cleanTitle(title)
id = entry[entry.find('chid=\\"')+7:]
id = id[:id.find('\\"')]
match=re.compile("preload='(.+?)'", re.DOTALL).findall(entry)
thumb=match[0]
if tvMode==True:
addLink(title,id,'playAll',thumb)
else:
addDir(title,id,'listVideos',thumb)
xbmcplugin.endOfDirectory(pluginhandle)
if forceViewMode==True:
xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')
示例13: 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)
示例14: schedule247
def schedule247():
import datetime
import time
i = datetime.datetime.now()
day,month,year=i.day, i.month, i.year
s="%s/%s/%s"%(day,month,year)
time=time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple())
time=str(time).replace('.0','')+'000'
url='https://tockify.com/api/readEventView?calname=pilkalive&max=30&start-inclusive=true&startms='+time
txt=json.loads(read_url(url))
events=txt['events']
for i in range (len(events)):
time=events[i]['when']['start']['millis']
time=str(time)[:-3]
event=events[i]['content']['summary']['text']
link=events[i]['content']['description']['text']
ts = datetime.datetime.fromtimestamp(float(time))
year,month,day,hour,minute=ts.strftime('%Y'),ts.strftime('%m'),ts.strftime('%d'),ts.strftime('%H'),ts.strftime('%M')
from utils import pytzimp
d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute)))
timezona= addon.get_setting('timezone_new')
my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
convertido=d.astimezone(my_location)
fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]"
time=convertido.strftime(fmt)
event=event[5:]
title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B]'%(time,event)
url = build_url({'mode': 'open_247_event','url':link})
li = xbmcgui.ListItem(title,iconImage='')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
xbmcplugin.endOfDirectory(addon_handle)
示例15: Test
def Test(params):
# -- get filter parameters
par = Get_Parameters(params)
# -- add header info
Get_Header(par, 1)
xbmcplugin.endOfDirectory(h)