本文整理汇总了Python中t0mm0.common.addon.Addon.add_directory方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.add_directory方法的具体用法?Python Addon.add_directory怎么用?Python Addon.add_directory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t0mm0.common.addon.Addon
的用法示例。
在下文中一共展示了Addon.add_directory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_video
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
#Search by IMDB ID
meta = metaget.get_meta('movie','The Hangover',imdb_id='tt1119646')
add_video(meta, 'movie')
#Search by Name + Year
meta = metaget.get_meta('movie','40 Year Old Virgin', year='2005')
add_video(meta, 'movie')
#Search by TMDB ID
meta = metaget.get_meta('movie','Horrible Bosses', tmdb_id='51540')
add_video(meta, 'movie')
#Search for TV Show
meta = metaget.get_meta('tvshow','The Simpsons')
addon.add_directory({'url': 'none', 'mode': 'tvseasons', 'imdb_id': meta['imdb_id']}, meta, img=meta['cover_url'], fanart=meta['backdrop_url'])
#episode=metaget.get_episode_meta('tt0096697', '1', '1')
#print episode
elif mode == 'watch_mark':
metaget=metahandlers.MetaData()
metaget.change_watched(video_type, name, imdb_id, tmdb_id)
xbmc.executebuiltin("Container.Refresh")
elif mode == 'refresh_meta':
year = addon.queries.get('year', None)
metaget=metahandlers.MetaData()
示例2: GetTitles
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
url = BASE_URL + '/browse/' + section + suffix
GetTitles(section, url, startPage= 1, numOfPages= 3)
def GetSeasons(section, url, img):
xbmcplugin.setContent( int( sys.argv[1] ), 'seasons' )
print 'Seasons for TV Show'
html = net.http_GET(url).content
match = re.search( 'coverImage">.+?src="(.+?)"', html, re.IGNORECASE | re.MULTILINE | re.DOTALL)
img = match.group(1)
shows = re.compile('<a class="behavior_trigger_season.+?id="trigger_(.+?)"(.+?)<h4>', re.DOTALL).findall(html)
if not shows: print 'couldn\'t find seasons'
else:
for season_name, episodes in shows:
season_name = season_name.replace( '_', ' ')
addon.add_directory({'mode': 'GetEpisodes', 'section': section, 'img': img, 'episodes': episodes.encode('utf-8')}, {'title': season_name}, img= img)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
def remove_accents(input_str):
nkfd_form = unicodedata.normalize('NFKD', unicode(input_str))
return u"".join([c for c in nkfd_form if not unicodedata.combining(c)])
def GetEpisodes(section, img, episodes):
print 'in Get Episodes'
xbmcplugin.setContent( int( sys.argv[1] ), 'episodes' )
episodes = re.compile('epnomber.+?href="(.+?)">(.+?)<.+?/episode-.+?/">(.+?)<.+?/episode-.+?/.+?>(.+?)<', re.IGNORECASE | re.MULTILINE | re.DOTALL).findall(episodes)
for epurl, epnbr, title, numOfLinks in episodes:
title = HTMLParser.HTMLParser().unescape(title)
#title = unicode_urlencode(title)
addon.add_directory({'mode': 'GetLinks', 'section': section, 'url': BASE_URL + epurl}, {'title': epnbr + ' - ' + title + ' (' + numOfLinks.strip() + ')'}, img= img)
示例3: get_blogspot
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
elif re.search('mms:', embedcode):
stream_url = re.search('"(mms:.+?)"', embedcode).group(1)
elif re.search('rtsp://', embedcode):
stream_url = re.search('"(rtsp://.+?)"', embedcode).group(1)
elif re.search('blogspot.com', embedcode):
stream_url = get_blogspot(embedcode)
elif re.search('bitgravity', embedcode):
stream_url = re.search('<param name="flashvars" value="File=(.+?)\?', embedcode).group(1)
#Play the stream
if stream_url:
addon.resolve_url(stream_url)
if mode == 'main':
addon.add_directory({'mode': 'channels', 'url': main_url + 'videos'}, {'title': 'Channels'}, img='')
addon.add_directory({'mode': 'parsexml', 'url': rss_recent}, {'title': 'Recently Added'}, img='')
addon.add_directory({'mode': 'parsexml', 'url': rss_views}, {'title': 'Most Viewed'}, img='')
addon.add_directory({'mode': 'parsexml','url': rss_rating}, {'title': 'Top Rated'}, img='')
addon.add_directory({'mode': 'parsexml', 'url': rss_watching}, {'title': 'Being Watched'}, img='')
elif mode == 'channels':
html = net.http_GET(url).content
r = re.search('<div class="categories">(.+?)</div>',html,re.DOTALL).group(1)
match = re.compile('<li.+?><a href="(.+?)">(.+?)</a></li>').findall(r)
for link, name in match:
addon.add_directory({'mode': 'channellist', 'url': link}, {'title': name}, img='')
示例4: int
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
url = '%s/?letter=%s&sort=alphabet&page=%s&%s' % (base_url, letter,
page, section)
try:
addon.log_debug('fetching %s' % url)
html = net.http_GET(url).content
except urllib2.URLError, e:
html = ''
addon.log_error('got http error %d fetching %s' %
(e.code, web_url))
r = 'class="index_item.+?href="(.+?)".+?src="(.+?)".+?alt="Watch (.+?)"'
regex = re.finditer(r, html, re.DOTALL)
for s in regex:
url, thumb, title = s.groups()
addon.add_directory({'mode': 'series',
'url': base_url + url},
title,
img=thumb)
if html.find('> >> <'):
addon.add_directory({'mode': 'browse',
'section': section,
'page': int(page) + 1,
'letter': letter}, 'Next Page')
else:
addon.add_directory({'mode': 'browse',
'section': section,
'letter': '123'}, '#')
for l in string.uppercase:
addon.add_directory({'mode': 'browse',
'section': section,
示例5: int
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
total = int(r.group(1).replace(',', ''))
else:
total = 0
r = 'class="index_item.+?href="(.+?)".+?src="(.+?)".+?' + \
'alt="Watch (.+?)"'
regex = re.finditer(r, html, re.DOTALL)
urls = []
for s in regex:
url, thumb, title = s.groups()
if url not in urls:
urls.append(url)
if section == 'tv':
addon.add_directory({'mode': 'series',
'url': base_url + url},
{'title': title},
img=thumb,
total_items=total)
else:
addon.add_video_item({'url': base_url + url},
{'title': title},
img=thumb, total_items=total)
elif genre:
if genre != 'All':
addon.add_directory({'mode': 'browse',
'section': section,
'genre': genre,
'letter': 'All'}, {'title': 'All'})
addon.add_directory({'mode': 'browse',
'section': section,
示例6:
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
nextpage = re.search('<a href="(.+?)"> Next Search Page</a>', html)
if not nextpage: loop = True
page += 1
for item in matches:
parts = re.match('(.+?)#####(.+?)$', item)
if parts:
addon.add_directory({'mode': 'tvseasons', 'url': parts.group(1), 'section': 'tv', 'show': parts.group(2)}, {'title': parts.group(2)}, img='', total_items=numMatches)
addon.end_of_directory()
if mode == 'main':
print 'main'
addon.add_directory({'mode': 'tvaz', 'section': 'tv'}, {'title':'A-Z'}, img='')
addon.add_directory({'mode': 'latest', 'url': main_url + '/latest', 'section': 'tv'}, {'title': 'Newest Episodes Added'})
addon.add_directory({'mode': 'popular', 'url': main_url + '/new', 'section': 'tv'}, {'title': 'This Weeks Popular Episodes'})
addon.add_directory({'mode': 'schedule', 'url': main_url + '/tvschedule', 'section': 'tv'}, {'title': 'TV Schedule'})
addon.add_directory({'mode': 'genres', 'url': main_url +'/genres/', 'section': 'tv'}, {'title': 'TV Shows Genres'})
addon.add_directory({'mode': 'search', 'section': 'tv'}, {'title':'Search'})
addon.end_of_directory()
elif mode == 'tvaz':
AZ_Menu('tvseriesaz','/letters/%s')
elif mode == 'tvseriesaz':
get_video_list(url)
elif mode == 'latest':
get_latest(url)
elif mode == 'popular':
get_latest(url)
示例7:
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
name = 'Full'
media = urlresolver.HostedMediaFile(host=host, media_id=linkid, title=name + ' - ' + host + ' - ' + load + ' - ' + working)
sources.append(media)
source = urlresolver.choose_source(sources)
if source:
stream_url = source.resolve()
else:
stream_url = False
#Play the stream
if stream_url:
addon.resolve_url(stream_url)
if mode == 'main':
addon.add_directory({'mode': 'movies', 'section': 'movies'}, {'title': 'Movies'}, img=IconPath + 'Movies.png')
addon.add_directory({'mode': 'tv', 'section': 'tv'}, {'title': 'TV Shows'})
addon.add_directory({'mode': 'resolver_settings'}, {'title': 'Resolver Settings'}, is_folder=False, img=IconPath + 'Resolver_Settings.png')
elif mode == 'movies':
addon.add_directory({'mode': 'moviesaz', 'section': 'moviesaz'}, {'title': 'A-Z'}, img=IconPath + "AZ.png")
addon.add_directory({'mode': 'moviesgenre', 'section': 'moviesgenre'}, {'title': 'Genre'}, img=IconPath + 'Genre.png')
addon.add_directory({'mode': 'movieslatest', 'section': 'movieslatest'}, {'title': 'Latest'})
addon.add_directory({'mode': 'moviespopular', 'section': 'moviespopular'}, {'title': 'Popular'})
addon.add_directory({'mode': 'moviesyear', 'section': 'moviesyear'}, {'title': 'Year'})
elif mode == 'moviesaz':
AZ_Menu('movieslist',MovieUrl + 'browse/')
elif mode == 'moviesgenre':
url = MovieUrl
示例8: sys_exit
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
elif mode == 'mainexit':
sys_exit()
mainmenu()
elif mode == 'tvchannels':
tvchannels()
elif mode == 'classics':
print 'Retrieving: %s' % url
html = net.http_GET(url).content
page = int(page_num)
if page > 1:
addon.add_directory({'mode': 'mainexit'}, {'title': '[COLOR red]Back to Main Menu[/COLOR]'}, img=icon_path + 'back_arrow.png')
if page < 4:
page = page + 1
addon.add_directory({'mode': 'classics', 'url': classic_shows_url % page, 'page_num': page}, {'title': '[COLOR blue]Next Page[/COLOR]'}, img=icon_path + 'next_arrow.png')
match = re.compile('<a Title="" href="(.+?)" target="img_m"><img border="0" src="(.+?)" style="filter:alpha\(opacity=50\); -moz-opacity:0.5" onMouseover="lightup\(this, 100\)" onMouseout="lightup\(this, 30\)" width="110" height="80"></a>(.+?)</td>').findall(html)
for link, thumb, name in match:
if not re.search('http://', thumb):
thumb = main_url + thumb
addon.add_video_item({'mode': 'channel', 'url': link}, {'title': name}, img=thumb)
elif mode == 'livetv':
print 'Retrieving: %s' % url
html = net.http_GET(url).content
示例9: MatchTvEntries
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
'tv')
page = 1
url = addon.queries['url']
while page <= numpages:
if addon.queries['multipage'] == 'yes':
if page == 1:
url = addon.queries['url']
else:
url = ('%s?page=%s') % (addon.queries['url'], page)
else:
page = 9998
html = net.http_GET(url).content
match = MatchTvEntries(html)
for thumbnail, title, url in match:
url = base_url + url
addon.add_directory( { 'mode' : 'findtvseasons', 'type' : 'tv',
'url' : url}, title, thumbnail, cm=cm)
page = page + 1
elif mode == 'findtvseasons':
cm.add_context('Jump to favorites', { 'mode' : 'showfavorites' }, True)
cm.add_context('Go to addon main screen', { 'mode' : 'main' }, True)
cm.add_favorite('Save solarmovie favorite',
{ 'mode' : 'findepisodes' },'savefavorite',
'tv')
html = net.http_GET(addon.queries['url']).content
match=re.compile('<h4><a href="(.+?)">\n\s+Season\s(.+?)</a>').findall(html)
if match:
dict = {}
for url, season in match:
season = season.rjust(2,'0')
示例10: str
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
print "tap_num::" + str(tap_num)
#get tid
pindex = url.find("id=")
stemp = url[pindex + 3:]
tid = stemp[:stemp.find("&")]
print "tid::" + tid
for i in range((tap_page-1)*20+1, min((tap_page-1)*20+21,tap_num+1)):
tap_url = "http://giaitri.com/new/loadplayer.php?tid=" + tid + "&sid=" + str(i)
#addon.add_directory({'mode': 'giaitricom_tap_play', 'tap_url' : tap_url}, {'title': 'Tap ' + str(i)})
addon.add_video_item({'url': tap_url, 'site' : 'giaitricom'},{'title': 'Tap ' + str(i)})
if tap_num > (tap_page*20):
addon.add_directory({'mode': 'giaitricom_tap_list','phim_url' : url, 'page' : str(tap_page+1)}, {'title': 'Next page ... ' + str(((tap_page)*20 +1)) + ' to ' + str(min(tap_num,(tap_page+1)*20))})
elif mode == 'giaitricom_cat':
url = addon.queries.get('cat_url', '')
#page
cat_page = addon.queries.get('cat_page', '1')
print "cat_page::" + cat_page
url1 = url + "&page=" + cat_page
html = utf8decode(net.http_GET(url1).content)
ret = common.parseDOM(html, "div", attrs = { "class": "s1" })
if not ret:
ret = common.parseDOM(html, "div", attrs = { "class": "s1_alt" })
示例11:
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
elif mode == 'tv':
browse = addon.queries.get('browse', False)
if browse == 'alpha':
letter = addon.queries.get('letter', False)
if letter:
url = 'http://tubeplus.me/browse/tv-shows/All_Genres/%s/' % letter
html = net.http_GET(url).content
r = '<div class="list_item.+?src="(.+?)".+?<a class="plot".+?' + \
'href="(.+?)".+?<b>(.+?)<\/b>.+?<\/b>(.+?)<'
regex = re.finditer(r, html, re.DOTALL)
for s in regex:
thumb, url, title, plot = s.groups()
addon.add_directory({'mode': 'series',
'url': base_url + url},
{'title': title},
img=base_url+thumb)
else:
addon.add_directory({'mode': 'tv',
'browse': 'alpha',
'letter': '-'}, {'title': '#'})
for l in string.uppercase:
addon.add_directory({'mode': 'tv',
'browse': 'alpha',
'letter': l}, {'title': l})
else:
addon.add_directory({'mode': 'tv', 'browse': 'alpha'}, {'title': 'A-Z'})
elif mode == 'movies':
示例12: setView
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
media = urlresolver.HostedMediaFile(host=host, media_id=linkid, title=vidname + ' - ' + host + ' - ' + load + ' - ' + working)
sources.append(media)
source = urlresolver.choose_source(sources)
if source:
stream_url = source.resolve()
else:
stream_url = False
#Play the stream
if stream_url:
addon.resolve_url(stream_url)
if mode == 'main':
addon.add_directory({'mode': 'movies', 'section': 'movies'}, {'title': 'Movies'}, img=IconPath + 'Movies.png')
addon.add_directory({'mode': 'tv', 'section': 'tv'}, {'title': 'TV Shows'})
addon.add_directory({'mode': 'search', 'section': SearchAll}, {'title': 'Search All'})
addon.add_directory({'mode': 'resolver_settings'}, {'title': 'Resolver Settings'}, is_folder=False, img=IconPath + 'Resolver_Settings.png')
setView(None, 'default-view')
elif mode == 'movies':
addon.add_directory({'mode': 'moviesaz', 'section': 'moviesaz'}, {'title': 'A-Z'}, img=IconPath + "AZ.png")
addon.add_directory({'mode': 'moviespopular', 'section': 'moviespopular'}, {'title': 'Popular'})
addon.add_directory({'mode': 'favourites', 'video_type': VideoType_Movies}, {'title': 'Favourites'})
addon.add_directory({'mode': 'search', 'section': SearchMovies}, {'title': 'Search'})
addon.add_directory({'mode': 'movieslatest', 'section': 'movieslatest'}, {'title': 'Latest Added Links'})
addon.add_directory({'mode': 'moviesgenre', 'section': 'moviesgenre'}, {'title': 'Genre'}, img=IconPath + 'Genre.png')
addon.add_directory({'mode': 'moviesyear', 'section': 'moviesyear'}, {'title': 'Year'})
setView(None, 'default-view')
示例13:
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
html = net.http_GET(url).content
media_id = re.search('<input type="hidden" value="(.+?)" id="vid" />', html, re.DOTALL).group(1)
host = re.search('<input type="hidden" value="(.+?)" id="vhost" />', html, re.DOTALL).group(1)
stream_url = urlresolver.HostedMediaFile(host=host, media_id=media_id).resolve()
else:
stream_url = False
#Play the stream
if stream_url:
addon.resolve_url(stream_url)
if mode == 'main':
addon.add_directory({'mode': 'movies', 'section': 'movies'}, {'title': 'Movies'}, img=icon_path + 'Movies.jpg')
addon.add_directory({'mode': 'tv', 'section': 'tv'}, {'title': 'TV Shows'}, img='')
addon.add_directory({'mode': 'cartoons', 'section': 'cartoons', 'url': main_url + 'videos?g=4&mt=1'}, {'title':'Cartoons'}, img='')
addon.add_directory({'mode': 'documentary', 'section': 'documentary', 'url': main_url + 'videos?g=5&mt=1'}, {'title': 'Documentaries'}, img='')
addon.add_directory({'mode': 'musicvid', 'section': 'musicvid', 'url': main_url + 'videos?g=17&mt=1'}, {'title': 'Music Videos'}, img='')
addon.add_directory({'mode': 'resolver_settings'}, {'title': 'Resolver Settings'}, is_folder=False, img='')
elif mode == 'movies':
addon.add_directory({'mode': 'moviestop', 'url': main_url, 'section': 'movie'}, {'title': 'Top Movies'}, img='')
addon.add_directory({'mode': 'moviesaz', 'section': 'movie'}, {'title': 'A-Z'}, img='')
addon.add_directory({'mode': 'moviesgenre', 'url': main_url + 'videos?mt=1', 'section': 'movie'}, {'title': 'Genre'}, img='')
addon.add_directory({'mode': 'moviesrecent', 'url': main_url + 'videos?a=dr&mt=1', 'section': 'movie'}, {'title': 'Recently Released'}, img='')
addon.add_directory({'mode': 'moviesadded', 'url': main_url + 'videos?a=da&mt=1', 'section': 'movie'}, {'title': 'Recently Added'}, img='')
addon.add_directory({'mode': 'moviespopular', 'url': main_url + 'videos?a=m&mt=1', 'section': 'movie'}, {'title': 'Most Popular'}, img='')
addon.add_directory({'mode': 'moviesyear', 'url': main_url + 'videos?mt=1', 'section': 'movie'}, {'title': 'Year'}, img='')
示例14: sys_exit
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
sys_exit()
mainmenu()
elif mode == "tvchannels":
tvchannels()
elif mode == "classics":
print "Retrieving: %s" % url
html = net.http_GET(url).content
page = int(page_num)
if page > 1:
addon.add_directory(
{"mode": "mainexit"}, {"title": "[COLOR red]Back to Main Menu[/COLOR]"}, img=icon_path + "back_arrow.png"
)
if page < 4:
page = page + 1
addon.add_directory(
{"mode": "classics", "url": classic_shows_url % page, "page_num": page},
{"title": "[COLOR blue]Next Page[/COLOR]"},
img=icon_path + "next_arrow.png",
)
match = re.compile(
'<a Title="" href="(.+?)" target="img_m"><img border="0" src="(.+?)" style="filter:alpha\(opacity=50\); -moz-opacity:0.5" onMouseover="lightup\(this, 100\)" onMouseout="lightup\(this, 30\)" width="110" height="80"></a>(.+?)</td>'
).findall(html)
for link, thumb, name in match:
if not re.search("http://", thumb):
示例15:
# 需要导入模块: from t0mm0.common.addon import Addon [as 别名]
# 或者: from t0mm0.common.addon.Addon import add_directory [as 别名]
{'title': '2gb-hosting'})
elif mode == 'tv':
browse = addon.queries.get('browse', False)
if browse == 'alpha':
letter = addon.queries.get('letter', False)
if letter:
url = 'http://tubeplus.me/browse/tv-shows/All_Genres/%s/' % letter
html = net.http_GET(url).content
r = '<div class="list_item.+?src="(.+?)".+?<a class="plot".+?' + \
'href="(.+?)".+?<b>(.+?)<\/b>.+?<\/b>(.+?)<'
regex = re.finditer(r, html, re.DOTALL)
for s in regex:
thumb, url, title, plot = s.groups()
addon.add_directory({'mode': 'series',
'url': base_url + url},
title,
img=base_url+thumb)
else:
addon.add_directory({'mode': 'tv',
'browse': 'alpha',
'letter': '-'}, '#')
for l in string.uppercase:
addon.add_directory({'mode': 'tv',
'browse': 'alpha',
'letter': l}, l)
else:
addon.add_directory({'mode': 'tv', 'browse': 'alpha'}, 'A-Z')
elif mode == 'series':