本文整理汇总了Python中common.DataObjects.ListItem.set_next_action_name方法的典型用法代码示例。如果您正苦于以下问题:Python ListItem.set_next_action_name方法的具体用法?Python ListItem.set_next_action_name怎么用?Python ListItem.set_next_action_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.DataObjects.ListItem
的用法示例。
在下文中一共展示了ListItem.set_next_action_name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: retrieveUserPlaylists
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def retrieveUserPlaylists(userId, pageNbr=0, maxCount=50):
url = 'http://gdata.youtube.com/feeds/api/users/' + userId + '/playlists?alt=json&v=2&max-results=' + str(maxCount) + '&start-index=' + str((pageNbr * maxCount) + 1)
jData = json.loads(HttpUtils.HttpClient().getHtmlContent(url))
entries = jData['feed']['entry']
items = []
for entry in entries:
playlistId = unicode(entry['yt$playlistId']['$t']).encode('utf-8')
title = unicode(entry['title']['$t']).encode('utf-8')
thumbnail = unicode(entry['media$group']['media$thumbnail'][1]['url']).encode('utf-8')
item = ListItem()
item.add_request_data('userId', userId)
item.add_request_data('playlistId', playlistId)
item.set_next_action_name('show_Playlist_Videos')
xbmcListItem = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail)
item.set_xbmc_list_item_obj(xbmcListItem)
items.append(item)
if(len(items) == maxCount):
item = ListItem()
item.add_request_data('userId', userId)
item.add_request_data('pageNbr', pageNbr + 1)
item.set_next_action_name('show_Playlists')
xbmcListItem = xbmcgui.ListItem(label='---- Next Page ---->')
item.set_xbmc_list_item_obj(xbmcListItem)
items.append(item)
return items
示例2: displayTVShowEpisodes
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def displayTVShowEpisodes(request_obj, response_obj):
url = request_obj.get_data()['tvChannelUrl']
contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
videoBoxes = soup.findChildren('div', {'id':'videobox'})
for videoBox in videoBoxes:
imgTag = videoBox.findChild('img')
imageUrl = str(imgTag['src'])
metaTag = videoBox.findChild('div', {'class':'meta'})
aTag = metaTag.findChild('a')
episodeName = aTag.getText()
episodeUrl = str(aTag['href'])
item = ListItem()
item.add_request_data('episodeName', episodeName)
item.add_request_data('episodeUrl', episodeUrl)
item.set_next_action_name('Show_Episode_VLinks')
xbmcListItem = xbmcgui.ListItem(label=episodeName, iconImage=imageUrl, thumbnailImage=imageUrl)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
pageTag = soup.findChild('div', {'class':'postnav'})
olderPageTag = pageTag.findChild('a', {'class':'blog-pager-older-link'})
if olderPageTag is not None:
item = ListItem()
item.add_request_data('tvChannelUrl', str(olderPageTag['href']))
pageName = AddonUtils.getBoldString(' -> Next Page')
item.set_next_action_name('Show_Episodes_Next_Page')
xbmcListItem = xbmcgui.ListItem(label=pageName)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
示例3: displayTVShowEpisodes
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def displayTVShowEpisodes(request_obj, response_obj):
url = request_obj.get_data()['tvChannelUrl']
contentDiv = GetContent(url)
newcontent = ''.join(contentDiv.encode("utf-8").splitlines()).replace('\t','')
contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
videoBoxes =re.compile("<div id='videobox'>(.+?)</h3><div style='clear: both;'>").findall(newcontent)
for videoBox in videoBoxes:
#imgTag = videoBox.findChild('img')
imageUrl = re.compile('<img [^>]*src=["\']?([^>^"^\']+)["\']?[^>]*>').findall(str(videoBox))[0]
match=re.compile('createSummaryThumb\("(.+?)","(.+?)","(.+?)",').findall(str(videoBox))
if(len(match)>0):
episodeName = match[0][1]
episodeUrl = str(match[0][2])
item = ListItem()
item.add_request_data('episodeName', episodeName)
item.add_request_data('episodeUrl', episodeUrl)
item.set_next_action_name('Show_Episode_VLinks')
xbmcListItem = xbmcgui.ListItem(label=episodeName, iconImage=imageUrl, thumbnailImage=imageUrl)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
pageTag = soup.findChild('div', {'class':'postnav'})
if(pageTag !=None):
olderPageTag = pageTag.findChild('a', {'class':'blog-pager-older-link'})
else:
olderPageTag = None
if olderPageTag is not None:
item = ListItem()
item.add_request_data('tvChannelUrl', str(olderPageTag['href']))
pageName = AddonUtils.getBoldString(' -> Next Page')
item.set_next_action_name('Show_Episodes_Next_Page')
xbmcListItem = xbmcgui.ListItem(label=pageName)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
示例4: playChannel
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def playChannel(request_obj, response_obj):
item = ListItem()
item.set_next_action_name('Play')
item.add_moving_data('videoStreamUrl', request_obj.get_data()['channelUrl'])
xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['channelName'], iconImage=request_obj.get_data()['channelLogo'], thumbnailImage=request_obj.get_data()['channelLogo'])
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
示例5: displayFavouriteTVShows
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def displayFavouriteTVShows(request_obj, response_obj):
addonContext = Container().getAddonContext()
filepath = AddonUtils.getCompleteFilePath(baseDirPath=addonContext.addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=FAV_TV_SHOWS_JSON_FILE, makeDirs=True)
try:
if AddonUtils.doesFileExist(filepath):
favTVShowsJsonObj = AddonUtils.getJsonFileObj(filepath)
if len(favTVShowsJsonObj) == 0:
d = xbmcgui.Dialog()
d.ok('No Favourites added yet!', 'Please use context menu on TV Show to add new favourite.', '')
for tvShowName in favTVShowsJsonObj:
tvShowInfo = favTVShowsJsonObj[tvShowName]
item = ListItem()
item.add_request_data('tvShowName', tvShowInfo['tvShowName'])
item.add_request_data('tvShowUrl', tvShowInfo['tvShowUrl'])
item.set_next_action_name('Show_Episodes')
xbmcListItem = xbmcgui.ListItem(label=unicode(tvShowInfo['tvShowName']).encode("utf-8"))
contextMenuItems = []
data = '?actionId=' + urllib.quote_plus("remove_Fav_TVShow") + '&data=' + urllib.quote_plus(AddonUtils.encodeData({"tvShowName":tvShowInfo['tvShowName'], "tvShowUrl":tvShowInfo['tvShowUrl']}))
contextMenuItems.append(('Remove favourite', 'XBMC.RunPlugin(%s?%s)' % (sys.argv[0], data)))
xbmcListItem.addContextMenuItems(contextMenuItems, replaceItems=True)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
else:
d = xbmcgui.Dialog()
d.ok('No favourites added yet!', 'Please use context menu on TV Show to add new favourite.', '')
except:
AddonUtils.deleteFile(filepath)
d = xbmcgui.Dialog()
d.ok('FAILED to display TV Shows', 'Please add favorite again.')
示例6: retrieveIndVideoLinks
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def retrieveIndVideoLinks(request_obj, response_obj):
video_source_id = 0
video_source_img = None
video_part_index = 0
video_playlist_items = []
contentDiv = BeautifulSoup.SoupStrainer('p', {'style':re.compile(r'\bcenter\b')})
soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=contentDiv)
for child in soup.findChildren():
if child.name == 'img':
if len(video_playlist_items) > 0:
response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
video_source_id = video_source_id + 1
video_source_img = child['src']
video_part_index = 0
video_playlist_items = []
elif child.name == 'a':
video_part_index = video_part_index + 1
video_link = {}
video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText()
video_link['videoLink'] = str(child['href'])
video_playlist_items.append(video_link)
item = ListItem()
item.add_request_data('videoLink', video_link['videoLink'])
item.add_request_data('videoTitle', video_link['videoTitle'])
item.set_next_action_name('SnapAndPlayVideo')
xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
if len(video_playlist_items) > 0:
response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_playlist_items))
示例7: prepareVideoItem
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def prepareVideoItem(request_obj, response_obj):
item = ListItem()
item.add_moving_data('videoUrl', request_obj.get_data()['videoLink'])
item.set_next_action_name('Play')
xbmcListItem = xbmcgui.ListItem(label=request_obj.get_data()['videoTitle'])
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
示例8: __preparePlayListItem__
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def __preparePlayListItem__(video_source_id, video_source_img, video_playlist_items):
item = ListItem()
item.add_request_data('videoPlayListItems', video_playlist_items)
item.set_next_action_name('SnapAndDirectPlayList')
xbmcListItem = xbmcgui.ListItem(label=AddonUtils.getBoldString('DirectPlay') + ' | ' + 'Source #' + str(video_source_id) + ' | ' + 'Parts = ' + str(len(video_playlist_items)) , iconImage=video_source_img, thumbnailImage=video_source_img)
item.set_xbmc_list_item_obj(xbmcListItem)
return item
示例9: __retrieveAndCreateMovieItem__
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def __retrieveAndCreateMovieItem__(movieTag):
thumbTag = movieTag.findChild('div', {'class':'thumbnail'})
imgUrl = ''
if thumbTag is not None:
aTag = thumbTag.findChild('a')
imgTag = aTag.findChild('img')
imgUrl = imgTag['src']
titleTag = movieTag.findChild('h2')
aTag = titleTag.findChild('a')
movieUrl = str(aTag['href'])
title = unicode(titleTag.getText()).encode('utf8').replace('’', '\'').replace('&', '&').replace('…', '...')
descTag = movieTag.findChild('div', {'class':'entry'})
desc = ''
if descTag is not None:
desc = unicode(descTag.getText()).encode('utf8').replace('’', '\'').replace('&', '&').replace('…', '...')
rating = 0.0
ratingTag = movieTag.findChild('div', {'class':'post-ratings'})
if ratingTag is not None:
ratingInfo = ratingTag.getText()
ratingFound = re.compile('average:(.+?)out of 5').findall(ratingInfo)
if len(ratingFound) > 0:
rating = float(ratingFound[0])
rating = (rating / 5) * 10
item = ListItem()
item.set_next_action_name('Movie_VLinks')
item.add_request_data('movieUrl', movieUrl)
xbmcListItem = xbmcgui.ListItem(label=title, iconImage=imgUrl, thumbnailImage=imgUrl)
xbmcListItem.setInfo('video', {'plot':desc, 'plotoutline':desc, 'title':title, 'originaltitle':title, 'rating':rating})
item.set_xbmc_list_item_obj(xbmcListItem)
return item
示例10: retrieveUserPlaylistVideos
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def retrieveUserPlaylistVideos(playlistId, pageNbr=0, maxCount=50):
url = 'http://gdata.youtube.com/feeds/api/playlists/' + playlistId + '?alt=json&v=2&max-results=' + str(maxCount) + '&start-index=' + str((pageNbr * maxCount) + 1)
jData = json.loads(HttpUtils.HttpClient().getHtmlContent(url))
entries = jData['feed']['entry']
items = []
for entry in entries:
videoId = entry['media$group']['yt$videoid']['$t']
title = unicode(entry['title']['$t']).encode('utf-8')
thumbnail = 'http://i.ytimg.com/vi/' + videoId + '/default.jpg'
item = ListItem()
item.add_request_data('videoLink', 'http://www.youtube.com/watch?v=' + videoId + '&')
item.add_request_data('videoTitle', title)
item.set_next_action_name('play_Video')
xbmcListItem = xbmcgui.ListItem(label=title, iconImage=thumbnail, thumbnailImage=thumbnail)
item.set_xbmc_list_item_obj(xbmcListItem)
items.append(item)
if(len(items) == maxCount):
item = ListItem()
item.add_request_data('playlistId', playlistId)
item.add_request_data('pageNbr', pageNbr + 1)
item.set_next_action_name('show_Playlist_Videos')
xbmcListItem = xbmcgui.ListItem(label='---- Next Page ---->')
item.set_xbmc_list_item_obj(xbmcListItem)
items.append(item)
return items
示例11: retrieveVideoLinks
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def retrieveVideoLinks(request_obj, response_obj):
video_source_id = 1
video_source_img = None
video_source_name = None
video_part_index = 0
video_playlist_items = []
ignoreAllLinks = False
content = BeautifulSoup.SoupStrainer('blockquote', {'class':re.compile(r'\bpostcontent\b')})
soup = HttpClient().getBeautifulSoup(url=request_obj.get_data()['episodeUrl'], parseOnlyThese=content)
for e in soup.findAll('br'):
e.extract()
Logger.logDebug(soup)
if soup.has_key('div'):
soup = soup.findChild('div', recursive=False)
prevChild = ''
prevAFont = None
for child in soup.findChildren():
if (child.name == 'img' or child.name == 'b' or (child.name == 'font' and not child.findChild('a'))):
if (child.name == 'b' and prevChild == 'a') or (child.name == 'font' and child == prevAFont):
continue
else:
if len(video_playlist_items) > 0:
response_obj.addListItem(__preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items))
if video_source_img is not None:
video_source_id = video_source_id + 1
video_source_img = None
video_source_name = None
video_part_index = 0
video_playlist_items = []
ignoreAllLinks = False
elif not ignoreAllLinks and child.name == 'a' and not re.search('multi', str(child['href']), re.IGNORECASE):
video_part_index = video_part_index + 1
video_link = {}
video_link['videoTitle'] = 'Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) + ' | ' + child.getText()
video_link['videoLink'] = str(child['href'])
try:
try:
__prepareVideoLink__(video_link)
except Exception, e:
Logger.logFatal(e)
video_hosting_info = SnapVideo.findVideoHostingInfo(video_link['videoLink'])
if video_hosting_info is None or video_hosting_info.get_video_hosting_name() == 'UrlResolver by t0mm0':
raise
video_link['videoSourceImg'] = video_hosting_info.get_video_hosting_image()
video_link['videoSourceName'] = video_hosting_info.get_video_hosting_name()
video_playlist_items.append(video_link)
video_source_img = video_link['videoSourceImg']
video_source_name = video_link['videoSourceName']
item = ListItem()
item.add_request_data('videoLink', video_link['videoLink'])
item.add_request_data('videoTitle', video_link['videoTitle'])
item.set_next_action_name('SnapAndPlayVideo')
xbmcListItem = xbmcgui.ListItem(label='Source #' + str(video_source_id) + ' | ' + 'Part #' + str(video_part_index) , iconImage=video_source_img, thumbnailImage=video_source_img)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
prevAFont = child.findChild('font')
except:
示例12: ping
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def ping(request_obj, response_obj):
Container().ga_client.reportAction('ping')
response_obj.addServiceResponseParam("response", "pong")
response_obj.addServiceResponseParam("message", "Hi there, I am PlayIt")
item = ListItem()
item.set_next_action_name('pong')
response_obj.addListItem(item)
示例13: displayMovies
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def displayMovies(request_obj, response_obj):
url = request_obj.get_data()['movieCategoryUrl']
print "indisplay" + url
if request_obj.get_data().has_key('page'):
url_parts = url.split('?')
url_part_A = ''
url_part_B = ''
if len(url_parts) == 2:
url_part_A = url_parts[0]
url_part_B = '?' + url_parts[1]
else:
url_part_A = url
if url_part_A[len(url_part_A) - 1] != '/':
url_part_A = url_part_A + '/'
url = url_part_A + 'page/' + request_obj.get_data()['page'] + url_part_B
contentDiv = BeautifulSoup.SoupStrainer('div', {'id':'content'})
soup = HttpClient().getBeautifulSoup(url=url, parseOnlyThese=contentDiv)
movieTags = soup.findChildren('div', {'class':'post'})
print "intags" + str(movieTags)
if len(movieTags) == 0:
movieTags = soup.findChildren('div', {'class':'videopost'})
for movieTag in movieTags:
item = __retrieveAndCreateMovieItem__(movieTag)
response_obj.addListItem(item)
response_obj.set_xbmc_content_type('movies')
try:
pagesInfoTag = soup.findChild('div', {'class':'navigation'})
current_page = int(pagesInfoTag.find('span', {'class':'page current'}).getText())
#print current_page
pages = pagesInfoTag.findChildren('a', {'class':'page'})
#print pages
last_page = int(pages[len(pages) - 1].getText())
if current_page < last_page:
for page in range(current_page + 1, last_page + 1):
createItem = False
if page == last_page:
pageName = AddonUtils.getBoldString(' -> Last Page #' + str(page))
createItem = True
elif page <= current_page + 4:
pageName = AddonUtils.getBoldString(' -> Page #' + str(page))
createItem = True
if createItem:
item = ListItem()
item.add_request_data('movieCategoryUrl', request_obj.get_data()['movieCategoryUrl'])
item.add_request_data('page', str(page))
item.set_next_action_name('Movies_List_Next_Page')
xbmcListItem = xbmcgui.ListItem(label=pageName)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
except: pass
示例14: addYeahLiveItem
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def addYeahLiveItem(request_obj, response_obj):
yeahfilepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonProfile, extraDirPath=AddonUtils.ADDON_SRC_DATA_FOLDER, filename=CHANNELS_JSON_FILE, makeDirs=False)
if AddonUtils.doesFileExist(yeahfilepath):
yeah_icon_filepath = AddonUtils.getCompleteFilePath(baseDirPath=AddonContext().addonPath, extraDirPath=AddonUtils.ADDON_ART_FOLDER, filename='YEAH.png')
item = ListItem()
item.set_next_action_name('Yeah_TV')
xbmcListItem = xbmcgui.ListItem(label='[B]YEAH[/B] STREAMS', iconImage=yeah_icon_filepath, thumbnailImage=yeah_icon_filepath)
item.set_xbmc_list_item_obj(xbmcListItem)
response_obj.addListItem(item)
示例15: __preparePlayListItem__
# 需要导入模块: from common.DataObjects import ListItem [as 别名]
# 或者: from common.DataObjects.ListItem import set_next_action_name [as 别名]
def __preparePlayListItem__(video_source_id, video_source_img, video_source_name, video_playlist_items):
item = ListItem()
item.add_request_data('videoPlayListItems', video_playlist_items)
item.set_next_action_name('SnapAndDirectPlayList')
item.add_moving_data('isContinuousPlayItem', True)
item.add_moving_data('videoSourceName', video_source_name)
xbmcListItem = xbmcgui.ListItem(label='[COLOR blue]' + AddonUtils.getBoldString('Continuous Play') + '[/COLOR]' + ' | ' + 'Source #' + str(video_source_id) + ' | ' + 'Parts = ' + str(len(video_playlist_items)) , iconImage=video_source_img, thumbnailImage=video_source_img)
item.set_xbmc_list_item_obj(xbmcListItem)
return item