def seasonOptions(url=common.args.url): common.addDirectory('All Videos','vh1','videos',url) common.addDirectory('Full Episodes','vh1','videos',url+'fulleps') common.addDirectory('Bonus Clips','vh1','videos',url+'bonusclips') common.addDirectory('After Shows','vh1','videos',url+'aftershows') common.addDirectory('Sneak Peeks','vh1','videos',url+'sneakpeeks') common.setView('seasons')
def shows(cid=common.args.url, db=False): name = common.args.name xbmcplugin.setContent(pluginhandle, 'shows') if name == 'Full Episodes': mode = 'episode' else: mode = 'show' xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) url = getCollections + '?id=' + cid html = common.getURL(url) tree = BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) collections = tree.findAll('collection') db_shows = [] for collection in collections: cid = collection['id'] name = collection.find('name').string.replace(': Full Episodes', '') if db == True: db_shows.append((name, 'tbs', mode, cid)) else: common.addShow(name, 'tbs', mode, cid) if db == True: return db_shows else: common.setView('tvshows')
def fullepisodes(url=common.args.url): url = 'http://www.kidswb.com/video/playlists?pid=channel&chan=' + url data = common.getURL(url) html = demjson.decode(data)['list_html'] tree = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES).find( 'ul', attrs={'id': 'videoList_ul'}) if tree: videos = tree.findAll('li', recursive=False) for video in videos: infoLabels = {} vid_id = video['id'][6:] thumb = video.find('img')['src'] infoLabels['Title'] = video.find('span', attrs={ 'id': 'vidtitle_' + vid_id }).string infoLabels['TVShowTitle'] = video.find('p', attrs={ 'class': 'vidtitle' }).contents[1] infoLabels['Plot'] = video.find('p', attrs={ 'id': 'viddesc_' + vid_id }).string u = sys.argv[0] u += '?url="' + urllib.quote_plus(vid_id) + '"' u += '&mode="thewbkids"' u += '&sitemode="play"' common.addVideo(u, infoLabels['Title'], thumb, infoLabels=infoLabels) common.setView('episodes')
def listCatType(url,db,showtype=True): data = common.getURL(url) db_shows=[] if data: items = demjson.decode(data)['Entries'] for item in items: show_id=str(item['ID']) name=item['Name'] if db==True: db_shows.append((name, 'crackle', 'showroot', show_id)) else: if showtype: common.addShow(name, 'crackle', 'showroot', show_id) else: plot=item['Description'] genre=item['Genre'] thumb=item['ChannelArtTileLarge'] fanart=item['ChannelArtLandscape'] common.addDirectory(name, 'crackle', 'showroot', show_id, thumb, '', plot, '',genre) if db==True: return db_shows elif showtype: common.setView('tvshows') else: common.setView('seasons')
def episodes(): url = 'http://nicktoons.nick.com/ajax/videos/all-videos/' + common.args.url url += '?sort=date+desc&start=0&page=1&viewType=collectionAll&type=fullEpisodeItem' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes = tree.find('ul', attrs={ 'class': 'large-grid-list clearfix' }).findAll('li', recursive=False) for episode in episodes: h4link = episode.find('h4').find('a') name = h4link.string url = BASE + h4link['href'] thumb = episode.find('img')['src'].split('?')[0] plot = episode.find('p', attrs={ 'class': 'description text-small color-light' }).string u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="nicktoons"' u += '&sitemode="playvideo"' infoLabels = { "Title": name, #"Duration":duration, #"Season":0, #"Episode":0, "Plot": str(plot), "TVShowTitle": common.args.name } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def episodes(url=common.args.url): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) data = common.getURL(url) #print "D",data tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) seeall=tree.find('a', attrs={'class' : 'see_all'}) print "eall",seeall categories=tree.findAll('a',attrs={'class' : 'read_full'}) categories.append(seeall) try: for category in categories: print "cat",category if category is not None and category.string is not None: url = category['href'] print "catu",url print "cn",category.string,category name = category.string.replace('See all ','') print 'name',name if name == 'Video Clips': print "ADDD",name, 'spike', 'videos', url common.addDirectory(name, 'spike', 'videos', url) elif name == 'Full Episodes': common.addDirectory(name, 'spike', 'fullepisodes', url) common.setView('seasons') except: video=tree.find(attrs={'class' : 'see_all_videos clearfix'}).find('a') url = video['href'] name = video.contents[1].contents[0].replace('See All ','') common.addDirectory(name, 'spike', 'videos', url) common.setView('seasons')
def videos(): url = 'http://www.amctv.com/index.php' values = { 'video_browser_action': 'filter', 'params[type]': 'all', 'params[filter]': common.args.url, 'params[page]': '1', 'params[post_id]': '71306', 'module_id_base': 'rb-video-browser' } data = common.getURL(url, values) data = demjson.decode(data)['html']['date'] items = BeautifulSoup( data, convertEntities=BeautifulSoup.HTML_ENTITIES).findAll('li') for item in items: link = item.find('a') img = link.find('img') url = link['href'] name = img['title'] plot = img['alt'].replace('/n', ' ') thumb = img['src'] print item.prettify() u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="amc"' u += '&sitemode="play"' infoLabels = { "Title": name, #"Season":season, #"Episode":episode, "Plot": plot, #"TVShowTitle":common.args.name } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def showsubcats(url=common.args.url): #Add season options data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) subs = tree.find(attrs={'class': 'group-a'}).findAll('a') for sub in subs: name = sub.string url = sub['href'] if BASE not in url: url = BASE + url if name == None: name = sub.contents[-1] if 'Episodes' in name or 'Clips' in name or 'Peeks' in name or 'Watch' in name or 'Video' in name: if 'id=' in url: u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="vh1"' u += '&sitemode="playurl"' item = xbmcgui.ListItem(name) item.setInfo(type="Video", infoLabels={"Title": name}) item.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(pluginhandle, url=u, listitem=item, isFolder=False) else: common.addDirectory(name, 'vh1', 'videos', url) common.setView('seasons')
def videos(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) subs = tree.find(attrs={'class': 'group-b'}) try: try: finalsubs = subs.find(attrs={ 'class': 'video-list' }).findAll('tr', attrs={'class': True}) except: try: finalsubs = subs.find(attrs={ 'id': "vid_mod_1" }).findAll(attrs={'itemscope': True}) except: finalsubs = tree.find(attrs={ 'id': "vid_mod_1" }).findAll(attrs={'itemscope': True}) for sub in finalsubs: sub = sub.find('a') name = sub.string url = sub['href'] if BASE not in url: url = BASE + url u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="vh1"' u += '&sitemode="playurl"' common.addVideo(u, name, '', infoLabels={"Title": name}) common.setView('episodes') except: print 'No videos'
def episodes(): url = 'http://www.nick.com/ajax/all-videos-list/full-episode-videos' url += '?orderBy=Date&start=0&rows=25&type=videoplaylist-segmented&tag=' + common.args.url #url = 'http://www.nick.com/ajax/videos/full-episode-videos' #url += '?sort=date+desc&start=0&viewType=videoContentList&rows=25&artist=&show='+common.args.url+'&f_type=&f_contenttype=' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes = tree.findAll('article') for episode in episodes: print episode.prettify() name = episode.find('p', attrs={'class': 'short-title'}).string showname = episode.find('p', attrs={'class': 'show-name'}).string plot = episode.find('p', attrs={'class': 'description'}).string thumb = episode.find('img', attrs={'class': 'thumbnail'})['src'] #dataid = episode['data-id'] #dataid = '' url = BASE + episode.find('a')['href'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="nick"' u += '&sitemode="playvideo"' infoLabels = { "Title": name, #"Duration":duration, #"Season":season, #"Episode":episode, "Plot": str(plot), "TVShowTitle": showname } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def seasonOptions(url=common.args.url): common.addDirectory('All Videos', 'vh1', 'videos', url) common.addDirectory('Full Episodes', 'vh1', 'videos', url + 'fulleps') common.addDirectory('Bonus Clips', 'vh1', 'videos', url + 'bonusclips') common.addDirectory('After Shows', 'vh1', 'videos', url + 'aftershows') common.addDirectory('Sneak Peeks', 'vh1', 'videos', url + 'sneakpeeks') common.setView('seasons')
def sp_episodes(): import demjson xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_EPISODE) url = 'http://www.southparkstudios.com/feeds/full-episode/carousel/' + common.args.url + '/dc400305-d548-4c30-8f05-0f27dc7e0d5c' json = common.getURL(url) episodes = demjson.decode(json)['season']['episode'] for episode in episodes: title = episode['title'] description = episode['description'].encode('ascii', 'ignore') thumbnail = episode['thumbnail'].replace('width=55', '') episodeid = episode['id'] senumber = episode['episodenumber'] date = episode['airdate'].replace('.', '-') seasonnumber = senumber[:-2] episodenumber = senumber[len(seasonnumber):] try: season = int(seasonnumber) episode = int(episodenumber) except: season = 0 episode = 0 u = sys.argv[0] u += '?url="' + urllib.quote_plus(episodeid) + '"' u += '&mode="comedy"' u += '&sitemode="sp_play"' infoLabels = { "Title": title, "Season": season, "Episode": episode, "premiered": date, "Plot": description, "TVShowTitle": "South Park" } common.addVideo(u, title, thumbnail, infoLabels=infoLabels) common.setView('episodes')
def sp_seasons(url=common.args.url): for sn in range(1, 17): sn = str(sn) name = 'Season ' + sn url = sn common.addDirectory(name, 'comedy', 'sp_episodes', url) common.setView('seasons')
def rootlist(db=False): data = common.getURL(BASE_URL) data = unicode(data, 'utf-8', errors='ignore') tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu = tree.find('li', attrs={'class': 'nav_item_3'}).findAll('a') db_shows = [] for item in menu: name = item.string url = item['href'] if 'http://' not in url: url = BASE_URL + url if name <> 'Episodes': if name == 'South Park': mode = 'sp_seasons' elif name <> 'The Daily Show with Jon Stewart' and name <> 'The Colbert Report': mode = 'ccepisodes' else: mode = 'episodes' if db == True: db_shows.append((name, 'comedy', mode, url)) else: common.addShow(name, 'comedy', mode, url) if db == True: return db_shows else: common.setView('tvshows')
def show(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) sections=tree.find('ul',attrs={'class':'channel-list'}) if sections: sections = sections.findAll('li',recursive=False) for section in sections: name = section.find('h4').contents[1].strip() if common.args.name in name and common.args.name <> name: name = name.replace(common.args.name,'').strip().strip('-').strip(',').strip() url = section.find('a')['href'] if 'http://' not in url: url = BASE+url common.addDirectory(name, 'hgtv', 'videos', url) common.setView('seasons') else: xml_url=getShowXML_URL(data) if xml_url: videos(xml_url=xml_url) else: backup_url = tree.find('ul', attrs={'class' : "button-nav"}) if backup_url: if len(backup_url) > 2: show(backup_url.findAll('a')[1]['href']) else: backup2_url = tree.find('li', attrs={'class' : "tab-past-season"}) if backup2_url: show(backup2_url.a['href'])
def show_cats(url=common.args.url): data = common.getURL(url.replace(' ','%20')) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) homedir = tree.find('div',attrs={'id':'video_home_dir','style':'display : none'}).string series_base = 'http://www.aetv.com/minisite/videoajx.jsp' series_base += '?homedir='+homedir #full_series_url = series_url+'&pfilter=FULL%20EPISODES' #clips_series_url = series_url+'&pfilter=CLIPS' if homedir == '/lifestyle/' or homedir == '/classic/': series = url.split('=')[-1].replace(' ','%20') series_url = series_base + '&seriesfilter='+series else: series_url = series_base data = common.getURL(series_url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) seasons = tree.find('div',attrs={'id':'primary_filter'}).findAll('li',attrs={'class':None}) if len(seasons) > 0: for season in seasons: link = season.find('a') if '?' in series_base: season_url = series_base + '&pfilter='+link.string.strip().replace(' ','%20') else: season_url = series_base + '?pfilter='+link.string.strip().replace(' ','%20') if homedir == '/lifestyle/' or homedir == '/classic/': series = url.split('=')[-1].replace(' ','%20') season_url += '&seriesfilter='+series common.addDirectory(link.string.title(), 'aetv', 'showseasonThePlatform', season_url) xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) common.setView('seasons') else: showseasonThePlatform(url.replace(' ','%20'),tree=tree) common.setView('seasons')
def videosHTML(url=common.args.url): print "Using html" data = common.getURL(url) tree=BeautifulSoup(data,convertEntities=BeautifulSoup.HTML_ENTITIES) items = tree.find('ul',attrs={'class':'media-thumbs media-thumbs-videos clearfix'}).findAll('li') for item in items: title = item.find('a').string.strip() plot = item.findAll('p')[1].string thumb = item['style'].split('url(')[1].replace(')','') duration = item.find('span').string.strip('()') url = BASE+ item.find('a')['href'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="history"' u += '&sitemode="play"' infoLabels={ "Title":title, #"Season":season, #"Episode":episode, "Plot":plot, #"premiered":airdate, "Duration":duration, #"TVShowTitle":common.args.name } common.addVideo(u,title,thumb,infoLabels=infoLabels) common.setView('episodes')
def show(url=common.args.url): data = common.getURL(url) videos = demjson.decode(data.split(' = ')[1])[0]['videos'] for video in videos: if 'Season' in common.args.name: season = int(common.args.name.split('Season')[1]) showname = common.args.name.split('Season')[0] else: showname = common.args.name season = 0 #episode = int(video['number']) name = video['label'] duration = video['length'] thumb = video['thumbnailURL'] description = video['description'] airDate = video['delvStartDt'] playpath = video['videoURL'].replace('http://wms.scrippsnetworks.com','').replace('.wmv','') url = 'rtmp://flash.scrippsnetworks.com:1935/ondemand?ovpfv=1.1' url+= ' swfUrl=http://common.scrippsnetworks.com/common/snap/snap-3.0.3.swf playpath='+playpath displayname = name infoLabels={ "Title":name, "Season":season, #"Episode":episode, "Plot":description, "premiered":airDate, "Duration":duration, "TVShowTitle":showname } common.addVideo(url,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def episodes(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.findAll('div',attrs={'class':'tile'}) for item in menu: link = item.find('div',attrs={'class':'tile_title'}).find('a') name = link.string url = link['href'] thumb = item.find('img')['src'] try: description = item.find('div',attrs={'class':'tile_desc'}).string except: description = '' show_tile_sub = item.find('div',attrs={'class':'show_tile_sub'}).string.split('|') airDate = show_tile_sub[1].replace(' Aired on ','').strip() duration = show_tile_sub[0].strip() u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="abc"' u += '&sitemode="play"' infoLabels={ "Title":name, "Plot":description, "premiered":common.formatDate(airDate,'%m/%d/%y'), "Duration":duration, } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def shows(url=common.args.url,db=False): data = common.getURL(showlist) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu = tree.find('div',attrs={'id':'accordion','class':'view-content'}).findAll('h3') names = [] for item in menu: name = item.find('a',attrs={'href':'#'}).string names.append(name) if db == False: marker = names.index(url) elif db == True: marker = names.index('Current Shows') menu = tree.find('div',attrs={'id':'accordion','class':'view-content'}) shows = menu.findAll('div',recursive=False)[marker].findAll('li') dbshows = [] for show in shows: showdata = show.findAll(attrs={'class':'field-content'}) name = showdata[0].a.string showid = showdata[1].string if db == False: if 'Movies' in common.args.name: common.addDirectory(name, 'lifetime', 'showroot', showid) else: common.addShow(name, 'lifetime', 'showroot', showid) elif db == True: dbshows.append((name, 'lifetime', 'showroot', showid)) if db == True: return dbshows else: common.setView('tvshows')
def shows(cid = common.args.url,db=False): name = common.args.name xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) if name == 'Full Episodes' or name == 'Web Exclusives': mode = 'episode' #EPISODE() Mode else: mode = 'show' #SHOW() Mode url = 'http://www.tnt.tv/content/services/getCollections.do?site=true&id=58127' html=common.getURL(BASE_URL) tree=BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) collections = tree.findAll('collection') db_shows = [] for collection in collections: if collection['id'] == cid: subcollections = collection.findAll('subcollection') for subcollection in subcollections: scid = subcollection['id'] name = subcollection.find('name').string.split('-')[0].replace('Full Episodes','').strip() if db==True: db_shows.append((name,'tnt',mode,scid)) else: common.addShow(name, 'tnt', mode, scid) if db==True: return db_shows else: common.setView('tvshows')
def episodes(): url = 'http://www.nick.com/ajax/videos/full-episode-videos' url += '?sort=date+desc&start=0&viewType=videoContentList&rows=25&artist=&show='+common.args.url+'&f_type=&f_contenttype=' data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes=tree.findAll('article') for episode in episodes: name = episode.find('p',attrs={'class':'short-title'}).string showname = episode.find('p',attrs={'class':'show-name'}).string plot = episode.find('p',attrs={'class':'description'}).string thumb = episode.find('img',attrs={'class':'thumbnail'})['src'] dataid = episode['data-id'] url = BASE + episode.find('a')['href'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="nick"' u += '&sitemode="playvideo"' infoLabels={ "Title":name, #"Duration":duration, #"Season":season, #"Episode":episode, "Plot":str(plot), "TVShowTitle":showname } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def addVideos(tree): episodes = tree.find('ul', attrs={ 'class': 'grid cf' }).findAll('li', recursive=False) showname = tree.find('h3', attrs={ 'id': 'natgeov-section-title' }).contents[0] for episode in episodes: vidthumb = episode.find('div', attrs={'class': 'vidthumb'}) name = vidthumb.find('a')['title'] thumb = BASE + vidthumb.find('img')['src'] duration = vidthumb.find('span', attrs={ 'class': 'vidtimestamp' }).string url = BASE + vidthumb.find('a')['href'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="natgeowild"' u += '&sitemode="play"' infoLabels = { "Title": name, "Duration": duration, #"Season":season, #"Episode":episode, #"Plot":str(plot), "TVShowTitle": showname } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def episodes(): url = 'http://www.teennick.com/ajax/videos/all-videos/'+common.args.url url += '?sort=date+desc&start=0&page=1&viewType=collectionAll&type=fullEpisodeItem' data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) episodes=tree.find('ul',attrs={'class':'large-grid-list clearfix'}).findAll('li',recursive=False) for episode in episodes: h4link=episode.find('h4').find('a') name = h4link.string url = BASE + h4link['href'] thumb = episode.find('img')['src'].split('?')[0] plot = episode.find('p',attrs={'class':'description text-small color-light'}).string u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="nickteen"' u += '&sitemode="playvideo"' infoLabels={ "Title":name, #"Duration":duration, #"Season":0, #"Episode":0, "Plot":str(plot), "TVShowTitle":common.args.name } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def listCatType(url, db, showtype=True): data = common.getURL(url) db_shows = [] if data: items = demjson.decode(data)['Entries'] for item in items: show_id = str(item['ID']) name = item['Name'] if db == True: db_shows.append((name, 'crackle', 'showroot', show_id)) else: if showtype: common.addShow(name, 'crackle', 'showroot', show_id) else: plot = item['Description'] genre = item['Genre'] thumb = item['ChannelArtTileLarge'] fanart = item['ChannelArtLandscape'] common.addDirectory(name, 'crackle', 'showroot', show_id, thumb, '', plot, '', genre) if db == True: return db_shows elif showtype: common.setView('tvshows') else: common.setView('seasons')
def videos(url=common.args.url, xml_url=False): if not xml_url: data = common.getURL(url) xml_url = getShowXML_URL(data) data = common.getURL(xml_url) tree = BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.XML_ENTITIES) videos = tree.findAll('video') for video in videos: name = video.find('clipname').string showname = video.find('relatedtitle').string if not showname: showname = '' duration = video.find('length').string thumb = video.find('thumbnailurl').string.replace('_92x69', '_480x360') plot = video.find('abstract').string link = video.find('videourl').string playpath = link.replace('http://wms.scrippsnetworks.com', '').replace('.wmv', '') url = 'rtmp://flash.scrippsnetworks.com:1935/ondemand?ovpfv=1.1 swfUrl="http://common.scrippsnetworks.com/common/snap/snap-3.0.3.swf" playpath=' + playpath infoLabels = { "Title": name, "Duration": duration, #"Season":season, #"Episode":episode, "Plot": plot, "TVShowTitle": showname } common.addVideo(url, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def show(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.find('ul', attrs={ 'id': 'browse_results' }).findAll('li', recursive=False) for video in videos: infoLabels = {} link = video.find('a') thumb = video.find('img')['src'] url = BASE + link['href'] infoLabels['Title'] = link['title'] #infoLabels['premiered']=video.find('p',attrs={'class':'browse_result_sale grid-hidden'}) infoLabels['Plot'] = video.find('div', attrs={ 'class': 'browse_result_description' }).string.strip() infoLabels['TVShowTitle'] = common.args.name try: infoLabels['Duration'] = video.find('span', attrs={ 'class': 'duration' }).string.strip('()') except: pass u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="marvel"' u += '&sitemode="play"' common.addVideo(u, infoLabels['Title'], thumb, infoLabels=infoLabels) common.setView('episodes')
def show(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) sections = tree.find('ul', attrs={'class': 'channel-list'}) if sections: sections = sections.findAll('li', recursive=False) for section in sections: name = section.find('h4').contents[1].strip() if common.args.name in name and common.args.name <> name: name = name.replace(common.args.name, '').strip().strip('-').strip(',').strip() url = section.find('a')['href'] if 'http://' not in url: url = BASE + url common.addDirectory(name, 'hgtv', 'videos', url) common.setView('seasons') else: xml_url = getShowXML_URL(data) if xml_url: videos(xml_url=xml_url) else: backup_url = tree.find('ul', attrs={'class': "button-nav"}) if backup_url: if len(backup_url) > 2: show(backup_url.findAll('a')[1]['href']) else: backup2_url = tree.find('li', attrs={'class': "tab-past-season"}) if backup2_url: show(backup2_url.a['href'])
def full_bios(path=common.args.url): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) for page in range(1,4): url = BASE+path+'?page-number='+str(page)+'&pagination-sort-by=alphabetical&pagination-per-page=100&prev-sort=alphabetical&prev-per-page=100' data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos=tree.find('div',attrs={'class':'video-results clearfix'}).findAll('li') for video in videos: link = video.find('a') name = link.find('strong').string.strip() type = name.split(' - ')[1].strip() name = name.split(' - ')[0] if type == 'Full Episode' or type == 'Full Biography': pass else: name+=' ('+type+')' url = BASE + link['href'] #thumb = video.find('img')['src'] thumb = '' duration = video.find('span',attrs={'class':'video-duration'}).string.strip().replace('(','').replace(')','') u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="bio"' u += '&sitemode="play"' infoLabels={ "Title":name, "Duration":duration} common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def newvideos(url = common.args.url): data = common.getURL(url) itemList = demjson.decode(data)['itemList'] for video in itemList: url = video['pid'] description = video['description'] thumb = video['thumbnail'] seriesTitle = video['seriesTitle'] title = video['label'] try:episodeNum = int(video['episodeNum']) except:episodeNum = 0 try:seasonNum = int(video['seasonNum']) except:seasonNum = 0 duration = int(video['duration']) airDate = video['_airDate'] rating = video['rating'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="cbs"' u += '&sitemode="play"' displayname = '%sx%s - %s' % (seasonNum,episodeNum,title) infoLabels={ "Title":title, "Plot":description, "Season":seasonNum, "Episode":episodeNum, "premiered":airDate, "Duration":str(duration), "mpaa":rating, "TVShowTitle":seriesTitle } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def showsubcats(url=common.args.url): #Add season options data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) subs=tree.find(attrs={'class':'group-a'}).findAll('a') for sub in subs: name = sub.string url = sub['href'] if BASE not in url: url = BASE + url if name == None: name = sub.contents[-1] if 'Episodes' in name or 'Clips' in name or 'Peeks' in name or 'Watch' in name or 'Video' in name: if 'id=' in url: u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="vh1"' u += '&sitemode="playurl"' item=xbmcgui.ListItem(name) item.setInfo( type="Video", infoLabels={ "Title":name }) item.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(pluginhandle,url=u,listitem=item,isFolder=False) else: common.addDirectory(name,'vh1','videos',url) common.setView('seasons')
def videos(url=common.args.url,tree=False): if not tree: data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos=tree.find('ol',attrs={'id':'vid_mod_1'}) if videos: videos=videos.findAll('li',attrs={'id':re.compile('vidlist')}) for video in videos: thumb = BASE + video.find('img')['src'] name = video['maintitle'] url = BASE + video['mainurl'] uri = video['mainuri'] if uri == '': uri = url airDate = video['mainposted'] description = video['maincontent'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(uri)+'"' u += '&mode="mtv"' u += '&sitemode="play"' infoLabels={ "Title":name, #"Season":season, #"Episode":episode, "Plot":description, "premiered":airDate #"Duration":duration, #"TVShowTitle":common.args.name } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def videos(url=common.args.url,xml_url=False): if not xml_url: data = common.getURL(url) xml_url=getShowXML_URL(data) data = common.getURL(xml_url) tree = BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.XML_ENTITIES) videos = tree.findAll('video') for video in videos: name = video.find('clipname').string showname = video.find('relatedtitle').string if not showname: showname='' duration = video.find('length').string thumb = video.find('thumbnailurl').string.replace('_92x69','_480x360') plot = video.find('abstract').string link = video.find('videourl').string playpath = link.replace('http://wms.scrippsnetworks.com','').replace('.wmv','') url = 'rtmp://flash.scrippsnetworks.com:1935/ondemand?ovpfv=1.1 swfUrl="http://common.scrippsnetworks.com/common/snap/snap-3.0.3.swf" playpath='+playpath infoLabels={ "Title":name, "Duration":duration, #"Season":season, #"Episode":episode, "Plot":plot, "TVShowTitle":showname } common.addVideo(url,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def rootlist(db=False): start = 0 count = 200 db_shows = [] while start < count: data = cove.programs.filter(filter_producer__name='PBS', order_by='title', limit_start=start) results = data['results'] count = data['count'] stop = data['stop'] del data for result in results: if len(result['nola_root'].strip()) != 0: program_id = re.compile('/cove/v1/programs/(.*?)/').findall( result['resource_uri'])[0] name = result['title'].encode('utf-8') if db == True: db_shows.append((name, 'pbs', 'show', program_id)) else: common.addShow(name, 'pbs', 'show', program_id) start = stop if db == True: return db_shows else: common.setView('tvshows')
def videos(): url = 'http://www.amctv.com/index.php' values = {'video_browser_action':'filter', 'params[type]':'all', 'params[filter]':common.args.url, 'params[page]':'1', 'params[post_id]':'71306', 'module_id_base':'rb-video-browser'} data = common.getURL( url , values) data = demjson.decode(data)['html']['date'] items = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES).findAll('li') for item in items: link = item.find('a') img = link.find('img') url = link['href'] name = img['title'] plot = img['alt'].replace('/n',' ') thumb = img['src'] print item.prettify() u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="amc"' u += '&sitemode="play"' infoLabels={ "Title":name, #"Season":season, #"Episode":episode, "Plot":plot, #"TVShowTitle":common.args.name } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def episodesRSS(url=common.args.url): data = common.getURL(url) tree=BeautifulStoneSoup(data, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) menu=tree.findAll('item') for item in menu: namedata = item('title')[0].string.encode('utf-8').split(' Full Episode - ') name = namedata[0] season = int(namedata[1].split(' - ')[0].split(' | ')[1].replace('s','')) episode = int(namedata[1].split(' - ')[0].split(' | ')[0].replace('e','')) tvshow = namedata[1].split(' - ')[1] url = item('link')[0].string thumb = item('image')[0].string airDate = item('pubdate')[0].string.split('T')[0] descriptiondata = re.compile('<p>(.+?)</p>').findall(item('description')[0].string)[0].split('<br>') description = descriptiondata[0] duration = descriptiondata[-2].replace('Duration: ','') displayname = '%sx%s - %s' % (str(season),str(episode),name) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="abc"' u += '&sitemode="play"' infoLabels={ "Title":name, "Season":season, "Episode":episode, "Plot":description, "premiered":airDate, "Duration":duration, "TVShowTitle":tvshow } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def showsubClips(url = common.args.url): xbmcplugin.setContent(int(sys.argv[1]), 'episodes') data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos=tree.find('div',attrs={'class' : 'scet-browse-group detail-short-clips-view '}).findAll('div',attrs={'class' : 'thumb-block '}) for video in videos: #print video.prettify() url = BASE + video.find('a')['href'] thumb = video.find('img')['src'].replace('w=131&h=74','w=446&h=248') name = video.find('div',attrs={'class' : 'title'}).string.strip() showname = video.find('div',attrs={'class' : 'type'}).string.strip() description = video.find('p',attrs={'class' : 'description'}).find('span').string duration = video.find('div',attrs={'class' : 'runtime'}).string.split(':',1)[1].strip() u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="nbc"' u += '&sitemode="play"' infoLabels={ "Title":name, #"Season":season, #"Episode":episode, "Plot":description, #"premiered":airDate, "Duration":duration, "TVShowTitle":showname } common.addVideo(u,name,thumb,infoLabels=infoLabels) common.setView('episodes')
def showcats(): data = common.getURL(BASE_URL) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) video_types = tree.find('select', attrs={ 'id': 'rb-video-browser-content_type' }).findAll('option') shows = tree.find('select', attrs={ 'id': 'rb-video-browser-show' }).findAll('option') #,attrs={'title':True}) db_shows = [] for show in shows: if show['value'] == common.args.url: cats = show['title'].replace('[', '').replace(']', '').replace('"', '').split(',') for type in video_types: if type['value'] in cats: name = type.string url = 'rb-video-browser-num_items=100' url += '&module_id_base=rb-video-browser' url += '&rb-video-browser-show=' + show['value'] url += '&rb-video-browser-content_type=' + type['value'] common.addDirectory(name, 'amc', 'videos', url) common.setView('seasons')
def showroot(id=common.args.url): url = build_api_url('channel','',ID=id) data = common.getURL(url) if data: items = demjson.decode(data)['FolderList'] for item in items: if 'Full Episodes'==item['Name'] or 'Television Clips & Trailers'==item['Name'] or 'Minisodes'==item['Name'] or 'Original Series'==item['Name'] or 'Movie'==item['Name'] or 'Movie Clips & Trailers'==item['Name']: for season in item['PlaylistList']: for video in season['MediaList']: thumb=video['ThumbnailExternal'] ID=str(video['ID']) url = video['DetailsURL'] infoLabels={} infoLabels['Title']=video['Title'] infoLabels['Duration']=video['Duration'] try:infoLabels['Season']=int(video['Season']) except:pass try:infoLabels['Episode']=int(video['Episode']) except:pass infoLabels['MPAA']=video['Rating'] infoLabels['Genre']=video['Genre'] infoLabels['TVShowTitle']=video['ParentChannelName'] infoLabels['Plot']=video['Description'] try:infoLabels['AirDate']=common.formatDate(video['ReleaseDate'],'%m/%d/%Y') except: print video['ReleaseDate'] displayname=infoLabels['Title'] if infoLabels.has_key('Season') or infoLabels.has_key('Episode'): displayname = str(infoLabels['Season'])+'x'+str(infoLabels['Episode'])+' - '+infoLabels['Title'] u = sys.argv[0] u += '?url="'+urllib.quote_plus(ID)+'"' u += '&mode="crackle"' u += '&sitemode="play"' common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def show(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) carousels = tree.findAll('div', attrs={'class': 'tab-wrap'}) for carousel in carousels: videos = carousel.findAll('li', attrs={ 'id': True, 'class': re.compile('result-item') }) for video in videos: infoLabels = {} exp_id = video.find('a')['data-video'] thumb = video.find('img')['src'] infoLabels['Title'] = video.find('img')['title'] infoLabels['Plot'] = video.find('p', attrs={ 'class': 'description' }).string.strip() infoLabels['TVShowTitle'] = common.args.name u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&exp_id="' + urllib.quote_plus(exp_id) + '"' u += '&mode="marvelkids"' u += '&sitemode="play"' common.addVideo(u, infoLabels['Title'], thumb, infoLabels=infoLabels) common.setView('episodes')
def episodes(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu = tree.findAll('div', attrs={'class': 'tile'}) for item in menu: link = item.find('div', attrs={'class': 'tile_title'}).find('a') name = link.string url = link['href'] thumb = item.find('img')['src'] try: description = item.find('div', attrs={'class': 'tile_desc'}).string except: description = '' show_tile_sub = item.find('div', attrs={ 'class': 'show_tile_sub' }).string.split('|') airDate = show_tile_sub[1].replace(' Aired on ', '').strip() duration = show_tile_sub[0].strip() u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="abc"' u += '&sitemode="play"' infoLabels = { "Title": name, "Plot": description, "premiered": common.formatDate(airDate, '%m/%d/%y'), "Duration": duration, } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def episodes(url=common.args.url): data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.find(attrs={'id':'fullEpisodesList'}).findAll(attrs={'data-video-id':True}) for item in menu: videoObject = demjson.decode(item.find('script',attrs={'class':'videoObject','type':'application/json'}).string) thumb = videoObject['videoStillURL'] url = videoObject['videoURL'] videoid = str(item['data-video-id']).encode('utf-8') name = item.find(attrs={'class':'episodeName'}).find('a').string duration = item.find(attrs={'class':'episodeName'}).contents[2].string.replace('(','').replace(')','') episodenumber = item.find(attrs={'class':'episodeNumber'}).contents[1].split('/') season = int(episodenumber[0]) episode = int(episodenumber[1]) description = item.find(attrs={'class':'description'}).string airDate = item.find(attrs={'class':'airDate'}).string displayname = '%sx%s - %s' % (str(season),str(episode),name) u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="fox"' u += '&sitemode="play"' infoLabels={ "Title":name, "Season":season, "Episode":episode, "Plot":description, "premiered":airDate, "Duration":duration, "TVShowTitle":common.args.name } common.addVideo(u,displayname,thumb,infoLabels=infoLabels) common.setView('episodes')
def show(url=common.args.url): data = common.getURL(url) videos = demjson.decode(data.split(' = ')[1])[0]['videos'] for video in videos: if 'Season' in common.args.name: season = int(common.args.name.split('Season')[1]) showname = common.args.name.split('Season')[0] else: showname = common.args.name season = 0 #episode = int(video['number']) name = video['label'] duration = video['length'] thumb = video['thumbnailURL'] description = video['description'] airDate = video['delvStartDt'] playpath = video['videoURL'].replace('http://wms.scrippsnetworks.com', '').replace('.wmv', '') url = 'rtmp://flash.scrippsnetworks.com:1935/ondemand?ovpfv=1.1' url += ' swfUrl=http://common.scrippsnetworks.com/common/snap/snap-3.0.3.swf playpath=' + playpath displayname = name infoLabels = { "Title": name, "Season": season, #"Episode":episode, "Plot": description, "premiered": airDate, "Duration": duration, "TVShowTitle": showname } common.addVideo(url, displayname, thumb, infoLabels=infoLabels) common.setView('episodes')
def full_bios(path=common.args.url): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) for page in range(1, 4): url = BASE + path + '?page-number=' + str( page ) + '&pagination-sort-by=alphabetical&pagination-per-page=100&prev-sort=alphabetical&prev-per-page=100' data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.find('div', attrs={ 'class': 'video-results clearfix' }).findAll('li') for video in videos: link = video.find('a') name = link.find('strong').string.strip() type = name.split(' - ')[1].strip() name = name.split(' - ')[0] if type == 'Full Episode' or type == 'Full Biography': pass else: name += ' (' + type + ')' url = BASE + link['href'] #thumb = video.find('img')['src'] thumb = '' duration = video.find('span', attrs={ 'class': 'video-duration' }).string.strip().replace('(', '').replace(')', '') u = sys.argv[0] u += '?url="' + urllib.quote_plus(url) + '"' u += '&mode="bio"' u += '&sitemode="play"' infoLabels = {"Title": name, "Duration": duration} common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def sp_seasons(url=common.args.url): for sn in range(1,17): sn = str(sn) name = 'Season '+sn url = sn common.addDirectory(name,'comedy','sp_episodes',url) common.setView('seasons')
def sp_episodes(): import demjson xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_EPISODE) url = 'http://www.southparkstudios.com/feeds/full-episode/carousel/'+common.args.url+'/dc400305-d548-4c30-8f05-0f27dc7e0d5c' json = common.getURL(url) episodes = demjson.decode(json)['season']['episode'] for episode in episodes: title = episode['title'] description = episode['description'].encode('ascii', 'ignore') thumbnail = episode['thumbnail'].replace('width=55','') episodeid = episode['id'] senumber = episode['episodenumber'] date = episode['airdate'].replace('.','-') seasonnumber = senumber[:-2] episodenumber = senumber[len(seasonnumber):] try: season = int(seasonnumber) episode = int(episodenumber) except: season = 0 episode = 0 u = sys.argv[0] u += '?url="'+urllib.quote_plus(episodeid)+'"' u += '&mode="comedy"' u += '&sitemode="sp_play"' infoLabels={ "Title": title, "Season":season, "Episode":episode, "premiered":date, "Plot":description, "TVShowTitle":"South Park" } common.addVideo(u,title,thumbnail,infoLabels=infoLabels) common.setView('episodes')
def rootlist(db=False): data = common.getURL(BASE_URL) data = unicode(data, 'utf-8', errors='ignore') tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) menu=tree.find('li',attrs={'class':'nav_item_3'}).findAll('a') db_shows = [] for item in menu: name = item.string url = item['href'] if 'http://' not in url: url = BASE_URL+url if name <> 'Episodes': if name == 'South Park': mode = 'sp_seasons' elif name <> 'The Daily Show with Jon Stewart' and name <> 'The Colbert Report': mode = 'ccepisodes' else: mode = 'episodes' if db==True: db_shows.append((name,'comedy',mode,url)) else: common.addShow(name,'comedy',mode,url) if db==True: return db_shows else: common.setView('tvshows')
def rootlist(db=False): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) db_shows = [] data = common.getURL(BASEURL) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) showpages = tree.findAll(attrs={'class':'watch more'}) for show in showpages: url = show['href'] name = url.split('/')[2].replace('-',' ').title() url = BASE + url if db==True: db_shows.append((name,'history','showcats',url)) else: common.addShow(name, 'history', 'showcats', url) data = common.getURL(H2URL) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) showpages = tree.findAll(attrs={'class':'watch more'}) for show in showpages: url = show['href'] name = url.split('/')[2].replace('-',' ').title() url = BASE + url if db==True: db_shows.append((name,'history','showcats',url)) else: common.addShow(name, 'history', 'showcats', url) if db==True: return db_shows else: common.setView('tvshows')
def videosRSS(url=common.args.url): link = common.getURL(url) mrssData = re.compile('mrssData += +"(.+)"').findall(link)[0]; mrssData = urllib2.unquote(base64.decodestring(mrssData)) tree=BeautifulStoneSoup(mrssData,convertEntities=BeautifulStoneSoup.HTML_ENTITIES) print tree.prettify() items = tree.findAll('item') for item in items: title = item.title.contents[0] plot = item.description.contents[0] thumb = item.findAll('media:thumbnail')[0]['url'] duration = item.findAll('media:content')[0]['duration'] smil = item.findAll('media:text')[5].contents[0] smil = smil.replace('smilUrl=','') #episode_list.append((title, image, duration, plot, smil)) u = sys.argv[0] u += '?url="'+urllib.quote_plus(smil)+'"' u += '&mode="history"' u += '&sitemode="play"' infoLabels={ "Title":title, #"Season":season, #"Episode":episode, "Plot":plot, #"premiered":airdate, "Duration":duration, #"TVShowTitle":common.args.name } common.addVideo(u,title,thumb,infoLabels=infoLabels) common.setView('episodes')
def videos(url=common.args.url, tree=False): if not tree: data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.find('ol', attrs={'id': 'vid_mod_1'}) if videos: videos = videos.findAll('li', attrs={'id': re.compile('vidlist')}) for video in videos: thumb = BASE + video.find('img')['src'] name = video['maintitle'] url = BASE + video['mainurl'] uri = video['mainuri'] if uri == '': uri = url airDate = video['mainposted'] description = video['maincontent'] u = sys.argv[0] u += '?url="' + urllib.quote_plus(uri) + '"' u += '&mode="mtv"' u += '&sitemode="play"' infoLabels = { "Title": name, #"Season":season, #"Episode":episode, "Plot": description, "premiered": airDate #"Duration":duration, #"TVShowTitle":common.args.name } common.addVideo(u, name, thumb, infoLabels=infoLabels) common.setView('episodes')
def episode(): cid = common.args.url showname = common.args.name #url = 'http://www.tnt.tv/processors/services/getCollectionByContentId.do?offset=0&sort=&limit=200&id='+cid #url = 'http://www.tnt.tv/content/services/getCollectionByContentId.do?site=true&offset=0&sort=&limit=200&id='+cid url = 'http://www.tnt.tv/video/content/services/getCollectionByContentId.do?offset=0&sort=&limit=200&id='+cid html=common.getURL(url) tree=BeautifulStoneSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) episodes = tree.findAll('episode') for episode in episodes: episodeId = episode['id'] name = episode.find('title').string thumbnail = episode.find('thumbnailurl').string plot = episode.find('description').string duration = episode.find('duration').string try:seasonNum = int(episode.find('seasonnumber').string) except:seasonNum = 0 try: episodeNum = episode.find('episodenumber').string if len(episodeNum) > 2 and episodeNum.startswith(str(seasonNum)): episodeNum = episodeNum[1:] if len(episodeNum) > 2: episodeNum = episodeNum[-2:] print episodeNum episodeNum = int(episodeNum) except:episodeNum = 0 try:duration = episode.find('duration').string.strip() except: duration = '' try: mpaa = episode.find('tvratingcode').string.strip() except: mpaa = '' try: airdate = common.formatDate(episode.find('expirationdate').string,'%m/%d/%Y') except: airdate = '' displayname=name if episodeNum <> 0 or seasonNum <> 0: displayname = str(seasonNum)+'x'+str(episodeNum)+' - '+name segments = episode.findAll('segment') if len(segments) == 0: url = episodeId mode = 'play' else: url = '' for segment in segments: url += segment['id']+'<segment>' mode = 'playepisode' #PLAYEPISODE u = sys.argv[0] u += '?url="'+urllib.quote_plus(url)+'"' u += '&mode="tnt"' u += '&sitemode="'+mode+'"' infoLabels={ "Title":name, "Plot":plot, "Season":seasonNum, "Duration":duration, "MPAA":mpaa, "premiered":airdate, "Episode":episodeNum, "TVShowTitle":showname } common.addVideo(u,displayname,thumbnail,infoLabels=infoLabels) common.setView('episodes')
def episodes(url=common.args.url): data = common.getURL(url) tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) videos = tree.find("div", attrs={"id": "row1", "class": "fullEpisodes"}).findAll( "div", attrs={"id": True, "class": "episodeListing"} ) addvideos(videos) common.setView("episodes")
def showsubcats(url = common.args.url): moduleid = url.split('<moduleid>')[1] url = url.split('<moduleid>')[0] data = common.getURL(url) tree=BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES) vid_module = tree.find(attrs={'id' : moduleid}) PAGES(vid_module) common.setView('episodes')