Ejemplo n.º 1
0
def episodes(episode_url = _common.args.url):
	episode_menu = []
	episode_data = _connection.getURL(episode_url)
	episode_data2 = simplejson.loads(episode_data)['videos']
	episode_count = int(episode_data2['@count'])
	if episode_count > 1:
		episode_menu = episode_data2['video']
	elif episode_count == 1:
		episode_menu.append(dict(episode_data2['video']))
	for episode_item in episode_menu:
		if int(episode_item['@accesslevel']) == 0:
			highest_height = -1
			episode_name = episode_item['title']
			episode_duration = int(episode_item['duration']['$'])/60000
			season_number = episode_item['season']['@id']
			episode_id = episode_item['@id']
			episode_type = episode_item['@type']
			try:
				episode_description = _common.replace_signs(episode_item['longdescription'])
			except:
				episode_description = _common.replace_signs(episode_item['description'])
			try:
				episode_airdate = episode_item['airdates']['airdate'].rsplit(' ',1)[0]
				episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y')
			except:
				try:
					episode_airdate = episode_item['airdates']['airdate'][0].rsplit(' ',1)[0]
					episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y')
				except:
					episode_airdate = None
			try:
				episode_number = episode_item['number']
			except:
				episode_number = None
			try:
				for episode_picture in episode_item['thumbnails']['thumbnail']:
					try:
						picture_height = int(episode_picture['@width'])
					except:
						if episode_picture['@type'] == 'source-16x9':
							picture_height = 720
						else:
							picture_height = 0
					if picture_height > highest_height:
						highest_height = picture_height
						episode_thumb = episode_picture['$']
			except:
				episode_thumb = episode_item['thumbnails']['thumbnail']['$']
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(episode_id) + '#' + urllib.quote_plus(episode_type) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={'title' : episode_name,
						'plot' : episode_description,
						'premiered' : episode_airdate,
						'duration' : episode_duration,
						'episode' : episode_number,
						'season' : season_number }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 2
0
def add_video(episode_tree, episode = False):
	try:
		episode_menu = episode_tree.find_all(itemtype = 'http://schema.org/TVEpisode')
		if not episode_menu:
			episode_menu = episode_tree.find_all(itemtype = 'http://schema.org/VideoObject')
		for episode_item in episode_menu:
			if episode == False or episode_item.find(class_ = 'episode'):
				episode_name = episode_item.find('meta', itemprop = 'name')['content']
				episode_plot = episode_item.find('meta', itemprop = 'description')['content']
				url = episode_item.find('meta', itemprop = 'url')['content']
				try:
					episode_thumb = episode_item.find('meta', itemprop = 'image')['content'].split('?')[0]
					print episode_thumb
				except:
					try:
						episode_thumb = episode_item.find('meta', itemprop = 'thumbnailUrl')['content'].split('?')[0]
					except:
						episode_thumb = episode_item.find('img')['src'].split('?')[0]
				try:
					episode_airdate = episode_item.find('meta', itemprop = 'uploadDate')['content']
				except:
					try:
						episode_airdate = episode_item.find('meta', itemprop = 'datePublished')['content']
						print episode_airdate
						try:
							episode_airdate = _common.format_date(episode_airdate, '%B %d, %Y')
						except:
							episode_airdate = _common.format_date(episode_airdate, '%b %d, %Y')
						print episode_airdate
					except:
						episode_airdate = -1
				try:
					episode_duration = episode_item.find('meta', itemprop = 'duration')['content']
					try:
						duration_mins, duration_seconds = re.compile('([0-9]*)M([0-9]*)S').findall(episode_duration)[0]
						episode_duration_seconds = int(duration_mins) * 60 + int(duration_seconds)
					except:
						episode_duration_seconds = int(episode_duration.replace('S', '').replace('T',''))
				except:
					episode_duration_seconds = -1
				try:
					episode_meta = episode_item.find('div', class_ = 'video_meta').text.split('|')[0]
					season_number = int(episode_meta.split('-')[0].replace('Season', '').strip())
					episode_number = int(episode_meta.split('-')[1].replace('Episode', '').strip()[1:])
				except:
					season_number = -1
					episode_number = -1
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(url) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'durationinseconds' : episode_duration_seconds,
								'season' : season_number,
								'episode' : episode_number,
								'plot' : episode_plot,
								'premiered' : episode_airdate }
				_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
def episodes(SITE):
	episode_menu = []
	episode_data = _connection.getURL(_common.args.url)
	episode_data2 = simplejson.loads(episode_data)['videos']
	episode_count = int(episode_data2['@count'])
	if episode_count > 1:
		episode_menu = episode_data2['video']
	elif episode_count == 1:
		episode_menu.append(dict(episode_data2['video']))
	for episode_item in episode_menu:
		if int(episode_item['@accesslevel']) == 0:
			highest_height = -1
			episode_name = episode_item['title']
			episode_duration = int(episode_item['duration']['$']) / 1000
			season_number = episode_item['season']['@id']
			episode_id = episode_item['@id']
			episode_type = episode_item['@type']
			try:
				episode_description = _common.replace_signs(episode_item['longdescription'])
			except:
				episode_description = _common.replace_signs(episode_item['description'])
			try:
				episode_airdate = episode_item['airdates']['airdate'].rsplit(' ',1)[0]
				episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y')
			except:
				try:
					episode_airdate = episode_item['airdates']['airdate'][0].rsplit(' ',1)[0]
					episode_airdate = _common.format_date(episode_airdate,'%a, %d %b %Y %H:%M:%S', '%d.%m.%Y')
				except:
					episode_airdate = -1
			try:
				episode_number = episode_item['number']
			except:
				episode_number = -1
			try:
				for episode_picture in episode_item['thumbnails']['thumbnail']:
					try:
						picture_height = int(episode_picture['@width'])
					except:
						if episode_picture['@type'] == 'source-16x9':
							picture_height = 720
						else:
							picture_height = 0
					if picture_height > highest_height:
						highest_height = picture_height
						episode_thumb = episode_picture['$']
			except:
				episode_thumb = episode_item['thumbnails']['thumbnail']['$']
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(episode_id) + '#' + urllib.quote_plus(episode_type) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={'title' : episode_name,
						'plot' : episode_description,
						'premiered' : episode_airdate,
						'durationinseconds' : episode_duration,
						'episode' : episode_number,
						'season' : season_number }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 4
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(VIDEOLIST % episode_url.split('#')[0])
	episode_menu = simplejson.loads(episode_data)['videos']
	for episode_item in episode_menu:
		if int(episode_item['fullep']) == int(episode_url.split('#')[1]):
			show_name = episode_item['series_name']
			url = episode_item['guid']
			episode_duration = int(episode_item['duration_secs'])/60
			episode_plot = episode_item['description_long']
			episode_name = episode_item['title']
			season_number = int(episode_item['season'])
			episode_thumb = episode_item['large_thumbnail'].replace('media.cwtv.com', 'pdl.warnerbros.com')
			try:
				episode_number = int(episode_item['episode'][len(str(season_number)):])
			except:
				episode_number = None
			try:
				episode_airdate = _common.format_date(episode_item['airdate'],'%Y-%b-%d', '%d.%m.%Y')
			except:
				episode_airdate = None
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'duration' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'tvshowtitle': show_name }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 5
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data.replace('}{', '},{'))['results']
	for episode_item in episode_menu:
		show_name = _common.args.name
		url = episode_item['videoURL']
		episode_duration = int(episode_item['length']/60)
		episode_plot = episode_item['shortDescription']
		episode_airdate = _common.format_date(episode_item['airdate'],'%Y-%m-%d', '%d.%m.%Y')
		episode_name = episode_item['name']
		try:
			season_number = episode_item['season']
		except:
			season_number = None
		try:
			episode_number = episode_item['episode']
		except:
			episode_number = None
		try:
			episode_thumb = episode_item['videoStillURL']
		except:
			episode_thumb = None
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'duration' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate,
						'tvshowtitle': show_name }
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data)
	for episode_item in episode_menu['items']:
		if episode_item['videos']:
			url = episode_item['guid']
			episode_name = episode_item['title']
			episode_plot = episode_item['description']
			episode_airdate = _common.format_date(episode_item['airdate'], '%Y-%m-%d %H:%M:%S', '%d.%m.%Y')
			episode_duration = int(episode_item['videos'].itervalues().next()['length']) / 1000
			try:
				episode_thumb = episode_item['images']['kids-mezzannine-16x9']['url']
			except:
				try:
					episode_thumb = episode_item['images']['kids-mezzannine-4x3']['url']
				except:
					episode_thumb = episode_item['images']['mezzanine']['url']
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 7
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data)['entries']
	for i, episode_item in enumerate(episode_menu):
		url = episode_item['media$content'][0]['plfile$url']
		episode_duration = int(episode_item['media$content'][0]['plfile$duration'])
		episode_plot = episode_item['description']
		episode_airdate = _common.format_date(epoch = episode_item['pubDate']/1000)
		episode_name = episode_item['title']
		try:
			season_number = int(episode_item['pl' + str(i + 1) + '$season'][0])
		except:
			season_number = -1
		try:
			episode_number = int(episode_item['pl' + str(i + 1) + '$episode'][0])
		except:
			episode_number = -1
		try:
			episode_thumb = episode_item['plmedia$defaultThumbnailUrl']
		except:
			episode_thumb = None
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate }
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 8
0
def add_fullepisodes_southpark(episode_tree):
	try:
		season = urllib.unquote(sys.argv[2].split('&')[2].split('=')[1].replace('%22','')).split(' ')[1]
		episode_menu = episode_tree.find_all('article', class_ = 'thumb')
		for episode_item in episode_menu:
			episode_name = episode_item.find(class_ = 'title')
			if episode_name is None:
				continue
			url = episode_item.a['href']
			try:
				season_number, episode_number = re.compile('s([0-9]{2})e([0-9]{2})').findall(url)[0]
			except:
				episode_number = -1
				season_number = -1
			
			if int(season) != int(season_number):
				continue
			episode_name = episode_name.string.strip()
			episode_plot = episode_item.find('p', class_ = 'episode').string.strip()
			episode_airdate = episode_item.find(class_ = 'air-date').string.strip()
			episode_airdate = _common.format_date(episode_airdate , '%m.%d.%Y', '%d.%m.%Y')
			episode_thumb = re.match('(.*?)url\(\'(.*?)\'\)', episode_item.find('a', class_ = 'fill')['style']).group(2)
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 9
0
def add_fullepisodes(episode_tree, season_number = -1):
	try:
		episode_menu = episode_tree.find_all('div', class_ = 'episodeContainer')
		for episode_item in episode_menu:
			episode_name = episode_item.find('div', class_ = 'episodeTitle').a.text
			episode_airdate = _common.format_date(episode_item.find('div', class_ = 'episodeAirDate').contents[1].strip(), '%b %d, %Y', '%d.%m.%Y')
			episode_plot = episode_item.find('div', class_ = 'episodeDescription').contents[0].strip()
			episode_thumb = episode_item.find('div', class_ = 'episodeImage').img['src'].split('?')[0]
			url = episode_item.find('div', class_ = 'episodeTitle').a['href']
			try:
				episode_duration = _common.format_seconds(episode_item.find('span', class_ = 'episodeDuration').text.replace(')', '').replace('(', ''))
			except:
				episode_duration = -1
			try:
				episode_number = int(episode_item.find('div', class_ = 'episodeIdentifier').text.split('#' + season_number)[1])
			except:
				episode_number = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels = {	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 10
0
def episodes(episode_url = _common.args.url):
	episode_id, type = episode_url.split('#')
	episode_start = 0
	episode_count = 200
	while episode_start < episode_count:
		episode_data = cove.videos.filter(fields = 'associated_images,mediafiles', filter_program = episode_id, order_by = '-airdate', filter_availability_status = 'Available', limit_start = episode_start, filter_type = type)
		episode_menu = episode_data['results']
		episode_count = episode_data['count']
		episode_stop = episode_data['stop']
		del episode_data
		for episode_item in episode_menu:
			infoLabels={}
			if episode_item['mediafiles']:
				url = str(episode_item['tp_media_object_id'])
				episode_name = episode_item['title']
				episode_plot = episode_item['long_description']
				episode_airdate = _common.format_date(episode_item['airdate'], '%Y-%m-%d %H:%M:%S', '%d.%m.%Y')
				episode_duration = int(episode_item['mediafiles'][0]['length_mseconds'] / 1000)
				episode_thumb = episode_item['associated_images'][0]['url']
				for episode_thumbs in episode_item['associated_images']:
					if episode_thumbs['type']['eeid'] == 'iPad-Large':
						episode_thumb = episode_thumbs['url']
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(url) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'durationinseconds' : episode_duration,
								'plot' : episode_plot,
								'premiered' : episode_airdate }
				_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
		episode_start = episode_stop
	_common.set_view('episodes')
Ejemplo n.º 11
0
def add_fullepisodes_southpark(episode_tree):
	try:
		episode_menu = episode_tree.find('div', class_ = 'content_carouselwrap').ol.find_all('li', recursive = False)
		for episode_item in episode_menu:
			if not episode_item.find('a',class_ = 'unavailable'): 
				episode_name = episode_item.h5.string
				episode_airdate = episode_item.h6.string.replace('Original Air Date: ', '')
				episode_airdate = _common.format_date(episode_airdate , '%m.%d.%Y', '%d.%m.%Y')
				episode_plot = episode_item.p.string
				episode_thumb = episode_item.img['src'].split('?')[0]
				url = episode_item.a['href']
				try:
					season_number, episode_number = re.compile('s([0-9]{2})e([0-9]{2})').findall(url)[0]
				except:
					episode_number = -1
					season_number = -1
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(url) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'season' : season_number,
								'episode' : episode_number,
								'plot' : episode_plot,
								'premiered' : episode_airdate }
				_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 12
0
def add_fullepisodes(episode_tree, season_number = -1):
	try:
		episode_menu = episode_tree.find_all('div', class_ = 'episode_guide')
		for episode_item in episode_menu:
			episode_name = _common.replace_signs(episode_item.find('img')['title'])
			episode_airdate = _common.format_date(episode_item.find('p', class_ = 'aired_available').contents[1].strip(), '%m/%d/%Y', '%d.%m.%Y')
			episode_plot = _common.replace_signs(episode_item.find('p', class_ = False).text)
			episode_thumb = episode_item.find('img')['src'].split('?')[0]
			url = episode_item.find('div', class_ = 'thumb_image').a['href']
			try:
				episode_number = int(episode_item.find('a', class_ = 'title').contents[1].split('Episode ' + season_number)[1])
			except:
				try:
					episode_number = int(url.split('-0')[1])
				except:
					episode_number = -1
			if season_number == -1:
				season_number = int(url.split('-')[-3])
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels = {	'title' : episode_name,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 13
0
def add_clips(episode_tree):
	try:
		episode_menu = episode_tree.find_all('div', class_ = 'block')
		for episode_item in episode_menu:
			episode_name = _common.replace_signs(episode_item.find('h3').a.text)
			episode_plot = _common.replace_signs(episode_item.find('p', class_ = False).text)
			episode_thumb = episode_item.find('img')['src'].split('?')[0]
			url = episode_item.find('div', class_ = 'thumb_area').a['href']
			try:
				episode_airdate = episode_item.find('div', class_ = 'details').contents[0].split(' ', 1)[1].strip()
				episode_airdate = _common.format_date(episode_airdate, '%B %d, %Y', '%d.%m.%Y')
			except:
				episode_airdate = -1
			try:
				episode_duration = _common.format_seconds(episode_item.find('h3').small.text.replace(')', '').replace('(', ''))
			except:
				episode_duration = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels = {	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	except:
		pass
Ejemplo n.º 14
0
def add_fullepisodes_colbertnation(episode_tree):
	try:
		episode_menu = episode_tree.find('div', class_ = 'more_episode_listening').find_all('div', class_ = 'full_episode')
		tooltip_menu = episode_tree.find_all('div', class_ = 'carousel_view_tooltip')
		for episode_item, tooltip_item in izip(episode_menu, tooltip_menu):
			try:
				episode_name = episode_item.find('span', class_ = 'air_date').text + ' - ' + episode_item.find('span', class_ = 'guest').text
			except:
				episode_name = episode_item.find('span', class_ = 'title').text
			meta = tooltip_item.find('p', class_ = 'meta').string
			episode_airdate = re.compile('([0-9]+/[0-9]+/[0-9]+)').findall(meta)[0]
			episode_airdate = _common.format_date(episode_airdate , '%m/%d/%Y', '%d.%m.%Y')
			episode_plot = tooltip_item.find('p', class_ = 'description').string
			episode_thumb = episode_item.img['src'].split('?')[0]
			url = episode_item.a['href']
			try:
				season_number, episode_number = re.compile('([0-9]{2})([0-9]{3})').findall(meta)[0]
			except:
				episode_number = -1
				season_number = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 15
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_tree = BeautifulSoup(episode_data, 'html5lib')
	episode_menu = episode_tree.find('ul', id = 'browse_results').find_all('li', recursive = False)
	for episode_item in episode_menu:
		episode_name = episode_item.a['title']
		episode_thumb = episode_item.img['src']
		episode_plot = episode_item.find('div', class_ = 'browse_result_description').string.strip()
		show_name = _common.args.name
		url = BASE + episode_item.a['href']
		try:
			episode_duration = episode_item.find('span', class_ = 'duration').string.strip('()')
		except:
			episode_duration = 0
		try:
			episode_airdate = episode_item.find('p', class_ = 'browse_result_sale grid-visible').string.replace('Available: ','')
			episode_airdate = _common.format_date(episode_airdate, inputFormat = '%b %d, %Y')
		except:
			episode_airdate = None
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'duration' : episode_duration,
						'plot' : episode_plot,
						'premiered' : episode_airdate,
						'tvshowtitle': show_name }
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 16
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_tree = BeautifulSoup(episode_data, 'html.parser')
	episode_menu = episode_tree.find_all('episode')
	for episode_item in episode_menu:
		url = EPISODE % episode_item['id']
		try:
			episode_duration = episode_item['duration']
			episode_duration = int(_common.format_seconds(episode_duration))
		except:
			episode_duration = 0
			for segment_duration in episode_item.find_all('segment'):
				episode_duration += float(segment_duration['duration'])
		try:
			episode_airdate = _common.format_date(episode_item['originalpremieredate'].split(' ')[0],'%m/%d/%Y')
		except:
			try:
				episode_airdate = _common.format_date(episode_item['launchdate'].split(' ')[0],'%m/%d/%Y')
			except:
				episode_airdate = -1
		episode_name = episode_item['title']
		try:
			season_number = int(episode_item['episeasonnumber'])
		except:
			season_number = -1
		try:
			episode_number = int(episode_item['episodenumber'][:2])
		except:
			episode_number = -1
		try:
			episode_thumb = episode_item['thumbnailurl']
		except:
			episode_thumb = None
		episode_plot = episode_item.description.text
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate }
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 17
0
def add_video_from_manifestfile(manifest_feed):
	""" Add videos based on a manifest feed """
	try:
		shows = []

		items = manifest_feed['result']
		if 'episodes' in items:
			items = items['episodes']
		elif 'videos' in items:
			items = items['videos']
		elif 'playlist' in items:
			items = items['playlist']['videos']
		elif 'playlists' in items:
			t_items = []
			k = 0
			for i in items['playlists']:
				l = 0
				for j in items['playlists'][k]['videos']:
					t_items.append(items['playlists'][k]['videos'][l])
					l = l + 1
				k = k + 1
			items = t_items
		for item in items:
			try:
				episode_name = item['title']
			except:
				episode_name = item['shortTitle']
			epoch = float(item['airDate'])
			epoch = _common.convert_to_timezone(epoch, '', -5, epoch)  
			episode_airdate = _common.format_date(epoch , '', '%d.%m.%Y', epoch)
			episode_plot = item['shortDescription']
			episode_thumb = item['images'][0]['url']
			url = item['url']
			if not url:
				url = item['canonicalURL']
			try:
				season_number = item['season']['seasonNumber']
				episode_number = str(int(str(item['season']['episodeNumber'])[len(str(season_number)):]))
			except:
				season_number = -1
				episode_number = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate }
			show = {'u': u, 'episode_name': episode_name, 'episode_thumb': episode_thumb, 'infoLabels': infoLabels, 'epoch': epoch}
			shows.append(show)
		if len(shows):
			shows = sorted(shows, key=lambda show: show['epoch'], reverse=True)
			for show in shows:
				_common.add_video(show['u'], show['episode_name'], show['episode_thumb'], infoLabels = show['infoLabels'], quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 18
0
def episodes(episode_url=_common.args.url):
    episode_data = _connection.getURL(episode_url)
    episode_json = simplejson.loads(episode_data)['result']
    episode_menu = episode_json['data']
    title = episode_json['title']
    for episode_item in episode_menu:
        url_att = episode_item['url_att']
        type = episode_item['type']
        if (episode_item['url_in_window']
            ) or url_att or title != 'Full Episodes' or not episode_item[
                'url_amazon']:
            videourl = episode_item['streaming_url']
            url = BASE + episode_item['url']
            episode_duration = int(
                _common.format_seconds(episode_item['duration']))
            episode_airdate = _common.format_date(episode_item['airdate'],
                                                  '%m/%d/%y')
            episode_name = episode_item['label']
            if episode_name == '':
                episode_name = episode_item['title']
            try:
                season_number = int(episode_item['season_number'])
            except:
                season_number = -1
            try:
                episode_number = int(episode_item['episode_number'])
            except:
                episode_number = -1
            try:
                episode_thumb = episode_item['thumb']['large']
            except:
                episode_thumb = None
            if url_att:
                episode_pid = url_att.split('c___')[1]
                episode_plot = ''
            else:
                episode_plot, episode_pid = lookup_meta(url)
            if episode_pid is not None:
                u = sys.argv[0]
                u += '?url="' + urllib.quote_plus(episode_pid) + '"'
                u += '&mode="' + SITE + '"'
                u += '&sitemode="play_video"'
                infoLabels = {
                    'title': episode_name,
                    'durationinseconds': episode_duration,
                    'season': season_number,
                    'episode': episode_number,
                    'plot': episode_plot,
                    'premiered': episode_airdate
                }
                _common.add_video(u,
                                  episode_name,
                                  episode_thumb,
                                  infoLabels=infoLabels,
                                  quality_mode='list_qualities')
            else:
                pass
    _common.set_view('episodes')
Ejemplo n.º 19
0
def episodes(episode_url = _common.args.url):
	try:
		season_number = episode_url.split('#')[1]
	except:
		season_number = -1
	episode_url = episode_url.split('#')[0]
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data)['FolderList'][0]['PlaylistList'][0]
	for episode_item in episode_menu['MediaList']:
		if episode_item['Season'] == season_number or season_number == -1:
			''' THX to foreverguest '''
			path_pattern = re.compile('http:\\/\\/.+?\/(.+?)_[a-zA-Z0-9]+')
			pattern_url = episode_item['Thumbnail_Wide']
			path = path_pattern.findall(pattern_url)
			if not path and episode_item['ClosedCaptionFiles']:
				path = path_pattern.findall(episode_item['ClosedCaptionFiles'][0]['Path'])
			if not path:
				continue
			video_url = BASE + path[0] + '_'
			episode_duration = int(episode_item['DurationInSeconds'])
			episode_name = episode_item['Title']
			episode_plot = episode_item['Description']
			try:
				episode_airdate = _common.format_date(episode_item['ReleaseDate'], '%m/%d/%Y')
			except:
				episode_airdate = None
			try:
				episode_number = int(episode_item['Episode'])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item['Thumbnail_854x480']
			except:
				episode_thumb = None
			try:
				episode_caption = episode_item['ClosedCaptionFiles'][0]['Path']
			except:
				episode_caption = ''
			episode_MPAA = episode_item['Rating']
			episode_genre = episode_item['Genre']
			episode_showtitle = episode_item['ParentChannelName']
			video_url = video_url + '#' + episode_caption
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(video_url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'MPAA' : episode_MPAA,
							'Genre' : episode_genre,
							'TVShowTitle' : episode_showtitle}
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities')
	_common.set_view('episodes')
Ejemplo n.º 20
0
def episodes(episode_url = _common.args.url):
	try:
		season_number = episode_url.split('#')[1]
	except:
		season_number = -1
	episode_url = episode_url.split('#')[0]
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data)['FolderList'][0]['PlaylistList'][0]
	for episode_item in episode_menu['MediaList']:
		if episode_item['Season'] == season_number or season_number == -1:
			''' THX to foreverguest '''
			path_pattern = re.compile('http:\\/\\/.+?\/(.+?)_[a-zA-Z0-9]+')
			pattern_url = episode_item['Thumbnail_Wide']
			path = path_pattern.findall(pattern_url)
			if not path and episode_item['ClosedCaptionFiles']:
				path = path_pattern.findall(episode_item['ClosedCaptionFiles'][0]['Path'])
			if not path:
				continue
			video_url = BASE + path[0] + '_'
			episode_duration = int(episode_item['DurationInSeconds'])
			episode_name = episode_item['Title']
			episode_plot = episode_item['Description']
			try:
				episode_airdate = _common.format_date(episode_item['ReleaseDate'], '%m/%d/%Y')
			except:
				episode_airdate = None
			try:
				episode_number = int(episode_item['Episode'])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item['Thumbnail_854x480']
			except:
				episode_thumb = None
			try:
				episode_caption = episode_item['ClosedCaptionFiles'][0]['Path']
			except:
				episode_caption = ''
			episode_MPAA = episode_item['Rating']
			episode_genre = episode_item['Genre']
			episode_showtitle = episode_item['ParentChannelName']
			video_url = video_url + '#' + episode_caption
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(video_url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'MPAA' : episode_MPAA,
							'Genre' : episode_genre,
							'TVShowTitle' : episode_showtitle}
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities')
	_common.set_view('episodes')
Ejemplo n.º 21
0
def add_videos_thetonightshow(url, type_, page=1, added_episodes=[]):
    this_url = (TONIGHT_SHOW_FEED % url) + '&offset=' + str((page - 1) * 10)
    root_data = _connection.getURL(this_url)
    data = simplejson.loads(root_data)
    for video in data['content']:
        if video['type'] == type_:
            if type_ == 'episode':
                episode_name = video['name']
                episode_id = video['episodeNumber']
            else:
                episode_name = video['title']
                episode_id = video['id']
            if episode_id in added_episodes:
                continue
            added_episodes.append(episode_id)
            pid = video['videos'][0]['mpxPublicId']
            episode_url = SMIL % pid
            episode_plot = BeautifulSoup(
                video['description']['value']).p.string
            try:
                episode_airdate = _common.format_date(video['airDate'][:-6],
                                                      '%Y-%m-%dT%H:%M:%S',
                                                      '%d.%m.%Y')
            except:
                episode_airdate = -1
            try:
                season_number = int(video['season'])
            except:
                season_number = -1
            try:
                episode_number = int(video['episodeNumber'])
            except:
                episode_number = -1
            try:
                episode_thumb = video['images'][0]['bitImageSmall']
            except:
                episode_thumb = None
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(episode_url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels,
                              quality_mode='list_qualities')
    if page < int(_addoncompat.get_setting('maxpages')):
        add_videos_thetonightshow(url, type_, page + 1, added_episodes)
    _common.set_view('episodes')
Ejemplo n.º 22
0
def episodes(episode_url=_common.args.url):
    if 'the-tonight-show' in episode_url:
        if 'Clips' in _common.args.name:
            add_videos_thetonightshow(episode_url, 'segment')
        else:
            add_videos_thetonightshow(episode_url, 'episode')
        return
    episode_data = _connection.getURL(episode_url)
    episode_json = simplejson.loads(episode_data)
    episode_menu = episode_json['entries']
    for episode_item in episode_menu:
        pid = episode_item['media$content'][0]['plfile$releases'][0][
            'plrelease$pid']
        url = SMIL % pid
        try:
            episode_duration = int(episode_item['plfile$duration'].replace(
                ' min', '')) * 60
        except:
            episode_duration = -1
        episode_plot = HTMLParser.HTMLParser().unescape(
            episode_item['description'])
        epoch = int(episode_item['pubDate']) / 1000
        episode_airdate = _common.format_date(epoch=epoch)
        episode_name = HTMLParser.HTMLParser().unescape(episode_item['title'])
        show_title = episode_item['showShortName']
        try:
            season_number = int(episode_item['pl1$seasonNumber'])
        except:
            season_number = -1
        try:
            episode_number = int(episode_item['pl1$episodeNumber'])
        except:
            episode_number = -1
        try:
            episode_thumb = episode_item['plmedia$defaultThumbnailUrl']['big']
        except:
            episode_thumb = None
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'durationinseconds': episode_duration,
            'season': season_number,
            'episode': episode_number,
            'plot': episode_plot,
            'premiered': episode_airdate,
            'TVShowTitle': show_title
        }
        _common.add_video(u,
                          episode_name,
                          episode_thumb,
                          infoLabels=infoLabels,
                          quality_mode='list_qualities')
    _common.set_view('episodes')
Ejemplo n.º 23
0
def episodesClassic(episode_url=_common.args.url):
    episode_data = _connection.getURL(episode_url)
    episode_html = simplejson.loads(episode_data)['html']
    tree = BeautifulSoup(episode_html, 'html5lib')
    episode_menu = tree.find_all('div', class_='video-content-wrapper')
    for episode_item in episode_menu:
        url = episode_item.find('a')['href']
        episode_duration = episode_item.find(
            'div', class_='video-content-duration').contents[1].replace(
                '(', '').replace(')', '').strip()
        episode_duration = int(_common.format_seconds(episode_duration))
        episode_airdate = episode_item.find(
            'div',
            class_='video-content-air-date').contents[0].split(':')[1].strip()
        episode_airdate = _common.format_date(episode_airdate, '%m.%d.%Y')
        show_name = url.split('/')[2]
        episode_name = url.split('/')[-1].replace(show_name.replace(
            '_', '-'), '').replace('-', ' ').title().replace(' T ', '\'t ')
        url = BASE + url
        episode_info = episode_item.find(
            'div', class_='video-content-season-info').text
        try:
            season_number = int(
                episode_info.split(',')[0].split(' ')[1].strip())
        except:
            season_number = -1
        try:
            episode_number = int(
                episode_info.split(',')[1].strip().split(' ')[1])
        except:
            episode_number = -1
        try:
            episode_thumb = episode_item.find('img')['src']
        except:
            episode_thumb = None
        episode_plot = episode_item.find(
            'div', class_='video-content-description').string
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'durationinseconds': episode_duration,
            'season': season_number,
            'episode': episode_number,
            'plot': episode_plot,
            'premiered': episode_airdate
        }
        _common.add_video(u,
                          episode_name,
                          episode_thumb,
                          infoLabels=infoLabels,
                          quality_mode='list_qualities')
    _common.set_view('episodes')
Ejemplo n.º 24
0
def episodes_json(SITE):
	episode_url = _common.args.url
	master_name = episode_url.split('#')[0]
	episode_url = episode_url.split('#')[1]
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data)
	for episode_item in episode_menu:
		url = episode_item['episodeID']
		try:
			episode_duration = episode_item['length']
		except:
			episode_duration = -1
		try:
			episode_airdate = _common.format_date(episode_item['airDate'].split('on ')[1],'%B %d, %Y')
		except:
			episode_airdate = -1
		try:
			episode_plot = episode_item['summary']
		except:
			episode_plot = episode_item['shortdescription']
		episode_name = episode_item['title']
		if episode_name == master_name:
			video_url = EPISODE % url
			video_data = _connection.getURL(video_url)
			video_tree = BeautifulSoup(video_data, 'html.parser')
			episode_name = video_tree.headline.string
		elif episode_name == "":
			episode_name = episode_plot
		try:
			season_number = int(episode_item['identifier'].split(',')[0].split(' ')[1])
		except:
			season_number = -1
		try:
			episode_number =  int(episode_item['identifier'].split(', ')[1].split(' ')[1].replace(' Episode ', ''))
		except:
			try:
				episode_number =  int(episode_item['identifier'].split(', ')[1].split(' ')[1])
			except:
				episode_number = -1
		try:
			episode_thumb = episode_item['640x360_jpg']
		except:
			episode_thumb = None
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate }
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	_common.set_view('episodes')
Ejemplo n.º 25
0
def add_clips(episode_tree, season_number=None):
    try:
        episode_menu = episode_tree.find_all('div', class_='search_pad')
        for episode_item in episode_menu:
            show_name = episode_item.find('div', class_='search_show').text
            episode_name = episode_item.find(
                'div', class_='search_text').a.text.strip()
            episode_plot = episode_item.find(
                'div', class_='search_text').contents[4].strip()
            url = episode_item.find('div', class_='search_text').a['href']
            episode_thumb = episode_item.find(
                'div', class_='search_image').img['src'].split('?')[0]
            try:
                episode_airdate = episode_item.find(
                    'div', class_='episode_meta').contents[5].text.replace(
                        'Aired: ', '').strip()
                episode_airdate = _common.format_date(episode_airdate,
                                                      '%B %d, %Y', '%d.%m.%Y')
            except:
                episode_airdate = None
            try:
                episode_duration = episode_item.find(
                    'span', class_='search_duration').text.replace(')',
                                                                   '').replace(
                                                                       '(', '')
            except:
                episode_duration = None
            try:
                episode_number = int(
                    episode_item.find(
                        'div',
                        class_='episode_meta').contents[1].text.split('#')[1])
            except:
                episode_number = None
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'duration': episode_duration,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate,
                'tvshowtitle': show_name
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels)
    except:
        pass
Ejemplo n.º 26
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_json = simplejson.loads(episode_data)['result']
	episode_menu = episode_json['data']
	title = episode_json['title']
	for episode_item in episode_menu:
		url_att = episode_item['url_att']
		type = episode_item['type']
		if (episode_item['url_in_window']) or url_att or title != 'Full Episodes' or not episode_item['url_amazon']:
			videourl = episode_item['streaming_url']
			url = BASE + episode_item['url']
			episode_duration = int(_common.format_seconds(episode_item['duration']))
			episode_airdate = _common.format_date(episode_item['airdate'], '%m/%d/%y')
			if len(episode_item['label']) < len(episode_item['title']):
				episode_name = episode_item['label']
			else:
				episode_name = episode_item['title']
			try:
				season_number = int(episode_item['season_number'])
			except:
				season_number = -1
			try:
				episode_number = int(episode_item['episode_number'])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item['thumb']['large']
			except:
				episode_thumb = None
			if url_att:
				episode_pid = url_att.split('c___')[1]
				episode_plot = ''
			elif episode_item['description']:
				episode_plot = episode_item['description']
				episode_pid = url
			else:
				episode_plot, episode_pid = lookup_meta(url)
			if episode_pid is not None:
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(episode_pid) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'durationinseconds' : episode_duration,
								'season' : season_number,
								'episode' : episode_number,
								'plot' : episode_plot,
								'premiered' : episode_airdate }
				_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
			else:
				pass
	_common.set_view('episodes')
Ejemplo n.º 27
0
def episodes(SITE, quality = True):
	episode_url = _common.args.url
	episode_data = _connection.getURL(episode_url)
	episode_menu = simplejson.loads(episode_data)['entries']
	for i, episode_item in enumerate(episode_menu):
		default_mediacontent = None
		for mediacontent in episode_item['media$content']:
			if (mediacontent['plfile$isDefault'] == True) and (mediacontent['plfile$format'] == 'MPEG4'):
				default_mediacontent = mediacontent
			elif (mediacontent['plfile$format'] == 'MPEG4'):
				mpeg4_mediacontent = mediacontent
		if default_mediacontent is None:
			default_mediacontent = mpeg4_mediacontent
		url = default_mediacontent['plfile$url']
		episode_duration = int(episode_item['media$content'][0]['plfile$duration'])
		episode_plot = episode_item['description']
		episode_airdate = _common.format_date(epoch = episode_item['pubDate']/1000)
		episode_name = episode_item['title']
		try:
			season_number = int(episode_item['pl' + str(i + 1) + '$season'][0])
		except:
			try:
				season_number = int(episode_item['nbcu$seasonNumber'])
			except:
				season_number = -1
		try:
			episode_number = int(episode_item['pl' + str(i + 1) + '$episode'][0])
		except:
			try:
				episode_number = int(episode_item['nbcu$episodeNumber'])
			except:
				episode_number = -1
		try:
			episode_thumb = episode_item['plmedia$defaultThumbnailUrl']
		except:
			episode_thumb = None
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate }
		if quality:
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
		else:
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 28
0
def add_fullepisodes_southpark(episode_tree):
    try:
        season = urllib.unquote(
            sys.argv[2].split('&')[2].split('=')[1].replace('%22',
                                                            '')).split(' ')[1]
        episode_menu = episode_tree.find_all('article', class_='thumb')
        for episode_item in episode_menu:
            episode_name = episode_item.find(class_='title')
            if episode_name is None:
                continue
            url = episode_item.a['href']
            try:
                season_number, episode_number = re.compile(
                    's([0-9]{2})e([0-9]{2})').findall(url)[0]
            except:
                episode_number = -1
                season_number = -1

            if int(season) != int(season_number):
                continue

            episode_name = episode_name.string.strip()
            episode_plot = episode_item.find('p',
                                             class_='episode').string.strip()
            episode_airdate = episode_item.find(
                class_='air-date').string.strip()
            episode_airdate = _common.format_date(episode_airdate, '%m.%d.%Y',
                                                  '%d.%m.%Y')
            episode_thumb = re.match(
                '(.*?)url\(\'(.*?)\'\)',
                episode_item.find('a', class_='fill')['style']).group(2)

            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate
            }

            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels,
                              quality_mode='list_qualities')
    except:
        pass
Ejemplo n.º 29
0
def add_videos_thetonightshow(url, type_, page = 1, added_episodes = []):
	this_url = (TONIGHT_SHOW_FEED % url) + '&offset=' + str((page-1) * 10)
	root_data = _connection.getURL(this_url)
	data = simplejson.loads(root_data)
	for video in data['content']:
		if video['type'] == type_:
			if type_ == 'episode':
				episode_name = video['name']
				episode_id = video['episodeNumber']
			else:
				episode_name = video['title']
				episode_id = video['id']
			if episode_id in added_episodes:
				continue
			added_episodes.append(episode_id)
			pid = video['videos'][0]['mpxPublicId']
			episode_url = SMIL % pid
			try:
				episode_plot = BeautifulSoup(video['description']['value'], 'html.parser').p.string
			except:
				episode_plot = ''
			try:
				episode_airdate = _common.format_date(video['airDate'][:-6],'%Y-%m-%dT%H:%M:%S','%d.%m.%Y')
			except:
				episode_airdate = -1
			try:
				season_number = int(video['season'])
			except:
				season_number = -1
			try:
				episode_number = int(video['episodeNumber'])
			except:
				episode_number = -1
			try:
				episode_thumb = video['images'][0]['bitImageSmall']
			except:
				episode_thumb = None
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(episode_url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate}
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	if page < int(_addoncompat.get_setting('maxpages')):
		add_videos_thetonightshow(url, type_, page + 1, added_episodes)
	_common.set_view('episodes')
Ejemplo n.º 30
0
def episodes(episode_url = _common.args.url):
	try:
		shutil.rmtree(os.path.join(_common.CACHEPATH,'thumbs'))
	except:
		pass
	episode_data = _connection.getURL(VIDEOLIST % episode_url.split('#')[0])
	episode_menu = simplejson.loads(episode_data)['videos']
	os.mkdir(os.path.join(_common.CACHEPATH,'thumbs'))
	for episode_item in episode_menu:
		if int(episode_item['fullep']) == int(episode_url.split('#')[1]):
			show_name = episode_item['series_name']
			url = episode_item['guid']
			episode_duration = int(episode_item['duration_secs'])
			episode_plot = episode_item['description_long']
			episode_name = episode_item['title']
			season_number = int(episode_item['season'])
			episode_thumb = episode_item['large_thumbnail']
			thumb_file = episode_thumb.split('/')[-1]
			thumb_path = os.path.join(_common.CACHEPATH, 'thumbs', thumb_file)
			dbpath = xbmc.translatePath(_database.DBPATH)
			thumbcount = 0
			for name in glob.glob(os.path.join(dbpath, 'textures[0-9]*.db')):
				thumbcount = thumbcount+ _database.execute_command('select count(1) from texture where url = ?', [thumb_path,], fetchone = True, dbfile = name)[0]
			if thumbcount == 0:
				thumb_data = _connection.getURL(episode_thumb)
				file = open(thumb_path, 'wb')
				file.write(thumb_data)
				file.close()
			try:
				episode_number = int(episode_item['episode'][len(str(season_number)):])
			except:
				episode_number = -1
			try:
				episode_airdate = _common.format_date(episode_item['airdate'],'%Y-%b-%d', '%d.%m.%Y')
			except:
				episode_airdate = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'tvshowtitle': show_name }
			_common.add_video(u, episode_name, thumb_path, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 31
0
def episodes(episode_url=_common.args.url):
    episode_data = _connection.getURL(episode_url)
    episode_menu = simplejson.loads(episode_data)['entries']
    for i, episode_item in enumerate(episode_menu):
        default_mediacontent = None
        for mediacontent in episode_item['media$content']:
            if (mediacontent['plfile$isDefault']
                    == True) and (mediacontent['plfile$format'] == 'MPEG4'):
                default_mediacontent = mediacontent
            elif (mediacontent['plfile$format'] == 'MPEG4'):
                mpeg4_mediacontent = mediacontent
        if default_mediacontent is None:
            default_mediacontent = mpeg4_mediacontent
        url = default_mediacontent['plfile$url']
        episode_duration = int(default_mediacontent['plfile$duration'])
        episode_plot = episode_item['description']
        episode_airdate = _common.format_date(epoch=episode_item['pubDate'] /
                                              1000)
        episode_name = episode_item['title']
        try:
            season_number = int(episode_item['pl' + str(i + 1) + '$season'][0])
        except:
            season_number = -1
        try:
            episode_number = int(episode_item['pl' + str(i + 1) +
                                              '$episode'][0])
        except:
            episode_number = -1
        try:
            episode_thumb = episode_item['plmedia$defaultThumbnailUrl']
        except:
            episode_thumb = None
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'durationinseconds': episode_duration,
            'season': season_number,
            'episode': episode_number,
            'plot': episode_plot,
            'premiered': episode_airdate
        }
        _common.add_video(u,
                          episode_name,
                          episode_thumb,
                          infoLabels=infoLabels)
    _common.set_view('episodes')
Ejemplo n.º 32
0
def episodes(episode_url = _common.args.url):
	filter = episode_url.split('#')[1]
	season = episode_url.split('#')[2]
	episode_url = episode_url.split('#')[0]
	episode_data = _connection.getURL(episode_url)
	episode_tree = simplejson.loads(episode_data)[2]['data']
	episode_menu = BeautifulSoup(episode_tree, 'html.parser', parse_only = SoupStrainer('ul', id= 'full-episode-ul'))
	for episode_item in episode_menu.find_all('li', {'data-field_primary_filter_value' : filter , 'data-field_season_value' : season}):
		if 'locked' not in episode_item['class']:
			url = episode_item['data-public-url']
			episode_duration = episode_item['data-duration']
			episode_duration = int(_common.format_seconds(episode_duration))
			try:
				episode_airdate = _common.format_date(episode_item['data-date'].split(': ')[1],'%m/%d/%Y')
			except:
				episode_airdate = -1
			episode_name = HTMLParser.HTMLParser().unescape(episode_item['data-title'])
			try:
				season_number = int(episode_item['data-season'])
			except:
				season_number = -1
			try:
				episode_number = int(episode_item['data-episode'])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item.find('img')['data-src']
			except:
				try:
					episode_thumb = episode_item.find('img')['src']
				except:
					episode_thumb = None
			episode_plot = HTMLParser.HTMLParser().unescape(episode_item['data-description'])
			episode_showtitle = episode_item['data-page-title'].split('-')[1].strip()
			episode_MPAA = episode_item['data-rating']
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'TVShowTitle' : episode_showtitle,
							'MPAA' : episode_MPAA}
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels)
	_common.set_view('episodes')
Ejemplo n.º 33
0
def add_videos_colbertnation(episode_tree, type, feeds):
	try:
		shows = []
		scripts = episode_tree.find('script')
		for script in scripts:
			if ('triforceManifestFeed') in script:
				triforceManifestFeed = script.split(' = ')[1]
				triforceManifestFeed = triforceManifestFeed.strip()[:-1] # remove last ; from string
				triforceManifestFeed = simplejson.loads(triforceManifestFeed)
				break
		for feed in feeds:
			url = triforceManifestFeed['manifest']['zones'][feed]['feed']
			data = _connection.getURL(url)
			menu = simplejson.loads(data)
			for item in menu['result'][type]:
				episode_name = item['title']
				epoch = float(item['airDate'])
				epoch = _common.convert_to_timezone(epoch, '', -5, epoch)  
				episode_airdate = _common.format_date(epoch , '', '%d.%m.%Y', epoch)
				episode_plot = item['shortDescription']
				episode_thumb = item['images'][0]['url']
				url = item['url']
				if not url:
					url = item['canonicalURL']
				try:
					season_number = item['season']['seasonNumber']
					episode_number = str(int(str(item['season']['episodeNumber'])[len(str(season_number)):]))
				except:
					season_number = -1
					episode_number = -1
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(url) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'season' : season_number,
								'episode' : episode_number,
								'plot' : episode_plot,
								'premiered' : episode_airdate }
				show = {'u': u, 'episode_name': episode_name, 'episode_thumb': episode_thumb, 'infoLabels': infoLabels, 'epoch': epoch}
				shows.append(show)
		if len(shows):
			shows = sorted(shows, key=lambda show: show['epoch'], reverse=True)
			for show in shows:
				_common.add_video(show['u'], show['episode_name'], show['episode_thumb'], infoLabels = show['infoLabels'], quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 34
0
def add_fullepisodes(episode_tree, season_number=None):
    try:
        episode_menu = episode_tree.find_all('div', class_='episodeContainer')
        for episode_item in episode_menu:
            episode_name = episode_item.find('div',
                                             class_='episodeTitle').a.text
            episode_airdate = _common.format_date(
                episode_item.find('div',
                                  class_='episodeAirDate').contents[1].strip(),
                '%b %d, %Y', '%d.%m.%Y')
            episode_plot = episode_item.find(
                'div', class_='episodeDescription').contents[0].strip()
            episode_thumb = episode_item.find(
                'div', class_='episodeImage').img['src'].split('?')[0]
            url = episode_item.find('div', class_='episodeTitle').a['href']
            try:
                episode_duration = episode_item.find(
                    'span', class_='episodeDuration').text.replace(')',
                                                                   '').replace(
                                                                       '(', '')
            except:
                episode_duration = None
            try:
                episode_number = int(
                    episode_item.find('div',
                                      class_='episodeIdentifier').text.split(
                                          '#' + season_number)[1])
            except:
                episode_number = None
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'duration': episode_duration,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels)
    except:
        pass
Ejemplo n.º 35
0
def episodes(episode_url = _common.args.url):
	if 'the-tonight-show' in episode_url:
		if 'Clips' in _common.args.name:
			add_videos_thetonightshow(episode_url, 'segment')
		else:
			add_videos_thetonightshow(episode_url, 'episode')
		return
	episode_data = _connection.getURL(episode_url)
	episode_json = simplejson.loads(episode_data)
	episode_menu = episode_json['entries']
	for episode_item in episode_menu:
		pid = episode_item['media$content'][0]['plfile$releases'][0]['plrelease$pid']	
		url = SMIL % pid	
		try:
			episode_duration = int(episode_item['plfile$duration'].replace(' min','')) * 60
		except:
			episode_duration = -1
		episode_plot = HTMLParser.HTMLParser().unescape(episode_item['description'])
		epoch = int(episode_item['pubDate']) / 1000
		episode_airdate = _common.format_date(epoch = epoch)
		episode_name = HTMLParser.HTMLParser().unescape(episode_item['title'])
		show_title = episode_item['showShortName']
		try:
			season_number = int(episode_item['pl1$seasonNumber'])
		except:
			season_number = -1
		try:
			episode_number = int(episode_item['pl1$episodeNumber'])
		except:
			episode_number = -1
		try:
			episode_thumb = episode_item['plmedia$defaultThumbnailUrl']['big']
		except:
			episode_thumb = None
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate,
						'TVShowTitle' : show_title}
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	_common.set_view('episodes')
Ejemplo n.º 36
0
def episodes(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_json = simplejson.loads(episode_data)['result']
	episode_menu = episode_json['data']
	title = episode_json['title']
	for episode_item in episode_menu:
		url_att = episode_item['streaming_url']
		type = episode_item['type']
		if episode_item['status'] == 'AVAILABLE' or (_addoncompat.get_setting('cbs_use_login') == 'true' and episode_item['status'] == 'PREMIUM'):
			videourl = episode_item['streaming_url']
			url = BASE + episode_item['url']
			episode_duration = int(_common.format_seconds(episode_item['duration']))
			episode_airdate = _common.format_date(episode_item['airdate'], '%m/%d/%y')
			if len(episode_item['label']) < len(episode_item['title']) and episode_item['label']:
				episode_name = episode_item['label']
			else:
				episode_name = episode_item['title']
			try:
				season_number = int(episode_item['season_number'])
			except:
				season_number = -1
			try:
				episode_number = int(episode_item['episode_number'])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item['thumb']['large']
			except:
				episode_thumb = None
			episode_plot = episode_item['description']
			if url is not None:
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(url) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'durationinseconds' : episode_duration,
								'season' : season_number,
								'episode' : episode_number,
								'plot' : episode_plot,
								'premiered' : episode_airdate }
				_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
			else:
				pass
	_common.set_view('episodes')
Ejemplo n.º 37
0
def add_fullepisodes(episode_tree, season_number=-1):
    try:
        episode_menu = episode_tree.find_all('div', class_='episode_guide')
        for episode_item in episode_menu:
            episode_name = _common.replace_signs(
                episode_item.find('img')['title'])
            episode_airdate = _common.format_date(
                episode_item.find(
                    'p', class_='aired_available').contents[1].strip(),
                '%m/%d/%Y', '%d.%m.%Y')
            episode_plot = _common.replace_signs(
                episode_item.find('p', class_=False).text)
            episode_thumb = episode_item.find('img')['src'].split('?')[0]
            url = episode_item.find('div', class_='thumb_image').a['href']
            try:
                episode_number = int(
                    episode_item.find(
                        'a',
                        class_='title').contents[1].split('Episode ' +
                                                          season_number)[1])
            except:
                try:
                    episode_number = int(url.split('-0')[1])
                except:
                    episode_number = -1
            if season_number == -1:
                season_number = int(url.split('-')[-3])
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels,
                              quality_mode='list_qualities')
    except:
        pass
Ejemplo n.º 38
0
def episodes(episode_url=_common.args.url):
    episode_data = _connection.getURL(episode_url)
    episode_menu = simplejson.loads(episode_data.replace('}{',
                                                         '},{'))['results']
    for episode_item in episode_menu:
        show_name = _common.args.name
        url = episode_item['videoURL']
        episode_duration = int(episode_item['length'] / 60)
        episode_plot = episode_item['shortDescription']
        episode_airdate = _common.format_date(episode_item['airdate'],
                                              '%Y-%m-%d', '%d.%m.%Y')
        episode_name = episode_item['name']
        try:
            season_number = episode_item['season']
        except:
            season_number = None
        try:
            episode_number = episode_item['episode']
        except:
            episode_number = None
        try:
            episode_thumb = episode_item['videoStillURL']
        except:
            episode_thumb = None
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'duration': episode_duration,
            'season': season_number,
            'episode': episode_number,
            'plot': episode_plot,
            'premiered': episode_airdate,
            'tvshowtitle': show_name
        }
        _common.add_video(u,
                          episode_name,
                          episode_thumb,
                          infoLabels=infoLabels)
    _common.set_view('episodes')
Ejemplo n.º 39
0
def episodes(episode_url=_common.args.url):
    episode_data = _connection.getURL(episode_url)
    episode_tree = BeautifulSoup(episode_data, 'html5lib')
    episode_menu = episode_tree.find('ul', id='browse_results').find_all(
        'li', recursive=False)
    for episode_item in episode_menu:
        episode_name = episode_item.a['title']
        episode_thumb = episode_item.img['src']
        episode_plot = episode_item.find(
            'div', class_='browse_result_description').string.strip()
        show_name = _common.args.name
        url = BASE + episode_item.a['href']
        try:
            episode_duration = episode_item.find(
                'span', class_='duration').string.strip('()')
        except:
            episode_duration = 0
        try:
            episode_airdate = episode_item.find(
                'p', class_='browse_result_sale grid-visible').string.replace(
                    'Available: ', '')
            episode_airdate = _common.format_date(episode_airdate,
                                                  inputFormat='%b %d, %Y')
        except:
            episode_airdate = None
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'duration': episode_duration,
            'plot': episode_plot,
            'premiered': episode_airdate,
            'tvshowtitle': show_name
        }
        _common.add_video(u,
                          episode_name,
                          episode_thumb,
                          infoLabels=infoLabels)
    _common.set_view('episodes')
Ejemplo n.º 40
0
def episodes(episode_url=_common.args.url):
    episode_data = _connection.getURL(VIDEOLIST % episode_url.split('#')[0])
    episode_menu = simplejson.loads(episode_data)['videos']
    for episode_item in episode_menu:
        if int(episode_item['fullep']) == int(episode_url.split('#')[1]):
            show_name = episode_item['series_name']
            url = episode_item['guid']
            episode_duration = int(episode_item['duration_secs']) / 60
            episode_plot = episode_item['description_long']
            episode_name = episode_item['title']
            season_number = int(episode_item['season'])
            episode_thumb = episode_item['large_thumbnail'].replace(
                'media.cwtv.com', 'pdl.warnerbros.com')
            try:
                episode_number = int(
                    episode_item['episode'][len(str(season_number)):])
            except:
                episode_number = None
            try:
                episode_airdate = _common.format_date(episode_item['airdate'],
                                                      '%Y-%b-%d', '%d.%m.%Y')
            except:
                episode_airdate = None
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'duration': episode_duration,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate,
                'tvshowtitle': show_name
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels)
    _common.set_view('episodes')
Ejemplo n.º 41
0
def add_clips(episode_tree):
    try:
        episode_menu = episode_tree.find_all('div', class_='block')
        for episode_item in episode_menu:
            episode_name = _common.replace_signs(
                episode_item.find('h3').a.text)
            episode_plot = _common.replace_signs(
                episode_item.find('p', class_=False).text)
            episode_thumb = episode_item.find('img')['src'].split('?')[0]
            url = episode_item.find('div', class_='thumb_area').a['href']
            try:
                episode_airdate = episode_item.find(
                    'div', class_='details').contents[0].split(' ',
                                                               1)[1].strip()
                episode_airdate = _common.format_date(episode_airdate,
                                                      '%B %d, %Y', '%d.%m.%Y')
            except:
                episode_airdate = -1
            try:
                episode_duration = _common.format_seconds(
                    episode_item.find('h3').small.text.replace(')',
                                                               '').replace(
                                                                   '(', ''))
            except:
                episode_duration = -1
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'durationinseconds': episode_duration,
                'plot': episode_plot,
                'premiered': episode_airdate
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels)
    except:
        pass
Ejemplo n.º 42
0
def episodesClassic(episode_url = _common.args.url):
	episode_data = _connection.getURL(episode_url)
	episode_html = simplejson.loads(episode_data)['html']
	tree = BeautifulSoup(episode_html, 'html.parser')
	episode_menu = tree.find_all('div', class_ = 'video-content-wrapper')
	for episode_item in episode_menu:
		url = episode_item.find('a')['href']
		episode_duration = episode_item.find('div', class_ = 'video-content-duration').contents[1].replace('(', '').replace(')', '').strip()
		episode_duration = int(_common.format_seconds(episode_duration))
		episode_airdate = episode_item.find('div', class_ = 'video-content-air-date').contents[0].split(':')[1].strip()
		episode_airdate = _common.format_date(episode_airdate, '%m.%d.%Y')
		show_name = url.split('/')[2]
		episode_name = url.split('/')[-1].replace(show_name.replace('_', '-'), '').replace('-', ' ').title().replace(' T ', '\'t ')
		url = BASE + url
		episode_info = episode_item.find('div', class_ = 'video-content-season-info').text
		try:
			season_number = int(episode_info.split(',')[0].split(' ')[1].strip())
		except:
			season_number = -1
		try:
			episode_number = int(episode_info.split(',')[1].strip().split(' ')[1])
		except:
			episode_number = -1
		try:
			episode_thumb = episode_item.find('img')['src']
		except:
			episode_thumb = None
		episode_plot = episode_item.find('div', class_ = 'video-content-description').string
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels={	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'season' : season_number,
						'episode' : episode_number,
						'plot' : episode_plot,
						'premiered' : episode_airdate }
		_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	_common.set_view('episodes')
Ejemplo n.º 43
0
def add_clips_colbertnation(episode_tree):
	try:
		episode_menu = episode_tree.find_all('div', class_ = 'video_result')
		for episode_item in episode_menu:
			episode_name = episode_item.find('a', class_ = 'clipTitle').string
			episode_plot = episode_item.find('p', class_ = 'description').string
			url = episode_item.find('a', class_ = 'clipTitle')['href']
			episode_thumb = episode_item.find('img')['src'].split('?')[0]
			try:
				episode_airdate = episode_item.find('span', class_ = 'posted').string.replace('Aired: ','')
				episode_airdate = _common.format_date(episode_airdate, '%m/%d/%Y', '%d.%m.%Y')
			except:
				episode_airdate = -1
			try:
				episode_duration_mins,episode_duration_secs = re.compile('([0-9]*):([0-9]*)').findall(episode_plot)[0]
				episode_duration = int(episode_duration_mins) * 60 + int(episode_duration_secs)
				episode_plot = re.sub(re.compile('\(([0-9]*):([0-9]*)\)'), '', episode_plot)
			except:
				episode_duration = -1
			try:
				episode_number = episode_item.find('p', class_ = 'episode').string.replace('Episode #', '')
				season_number = int(episode_number[:2])
				episode_number = int(episode_number[2:])
			except:
				episode_number = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'tvshowtitle' : 'The Colbert Report' }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 44
0
def add_clips(episode_tree, season_number = -1):
	try:
		episode_menu = episode_tree.find_all('div', class_ = 'search_pad')
		for episode_item in episode_menu:
			show_name = episode_item.find('div', class_ = 'search_show').text
			episode_name = episode_item.find('div', class_ = 'search_text').a.text.strip()
			episode_plot = episode_item.find('div', class_ = 'search_text').contents[4].strip()
			url = episode_item.find('div', class_ = 'search_text').a['href']
			episode_thumb = episode_item.find('div', class_ = 'search_image').img['src'].split('?')[0]
			try:
				episode_airdate = episode_item.find('div', class_ = 'episode_meta').contents[5].text.replace('Aired: ', '').strip()
				episode_airdate = _common.format_date(episode_airdate, '%B %d, %Y', '%d.%m.%Y')
			except:
				episode_airdate = -1
			try:
				episode_duration = _common.format_seconds(episode_item.find('span', class_ = 'search_duration').text.replace(')', '').replace('(', ''))
			except:
				episode_duration = -1
			try:
				episode_number = int(episode_item.find('div', class_ = 'episode_meta').contents[1].text.split('#')[1])
			except:
				episode_number = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels = {	'title' : episode_name,
							'durationinseconds' : episode_duration,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'tvshowtitle': show_name }
			_common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Ejemplo n.º 45
0
def add_video(episode_tree):
	episode_menu = episode_tree.find_all(itemtype = "http://schema.org/VideoObject", maincontent = re.compile('^((?!(quarantineDate|<b>)).)*$'))
	if not episode_menu:
		episode_menu = episode_tree.find_all(attrs = {'data-uri' : True, 'data-filter' : re.compile(_common.args.name.replace(' ', ''))})
	for episode_item in episode_menu:
		if not episode_item.find(class_ = "disabled-video"):
			try:
				episode_url = episode_item['mainuri']
			except:
				try:
					episode_url = BASE + episode_item.find(itemprop = "url")['href']
				except:
					episode_url = episode_item['data-uri']
			try:
				name =  episode_item.find(itemprop = "name")['content']
			except:
				try:
					name =  episode_item.find(itemprop = "name").string
				except:
					try:
						name =  episode_item.find(class_ = "sub-header").text.strip()
					except:
						try:
							name =  episode_item.find(class_ = "headline").text.strip()
						except:
							name =  episode_item.find(class_ = "header").text.strip()
			try:
				thumb =  episode_item.find(itemprop = "thumbnail")['content']
			except:
				try:
					thumb =  episode_item.find(itemprop = "thumbnail")['src']
				except:
					try:
						thumb =  episode_item.find(attrs ={'data-src' : True})['data-src']
					except:
						thumb = ''
			if 'http' not in thumb and thumb != '':
				thumb = BASE + thumb
			try: 
				plot = episode_item.find(itemprop = "description")['content']
			except:
				try: 
					plot = episode_item.find(class_ = "deck").text
				except:
					plot = ''
			plot = plot.replace('<i>', '').replace('</i>', '')
			try:
				episode_number = int(re.compile('s[0-9]/e([0-9]?[0-9])').findall(episode_item.find(class_ = "header").text.strip())[0])
			except:
				try:
					try:
						episode_number = episode_item.find('li', class_ ='list-ep').string
					except:
						episode_number = int(re.compile('[0-9]?([0-9]?[0-9])').findall(name)[0])
				except:
					episode_number = -1
			try:
				season_number = int(re.compile('Season ([0-9]+)').findall(_common.args.name + episode_item.a.string)[0])
			except:
				try:
					season_number = int(re.compile('([0-9])[0-9][0-9]').findall(name)[0])
				except:
					try:
						season_number = int(re.compile('s([0-9])/e[0-9]?[0-9]').findall(episode_item.find(class_ = "header").text.strip())[0])
					except:
						season_number = -1
			try:
				name = re.compile('\(([^0-9]+)\)').findall(name)[0]
			except: 
				try:
					name = re.compile('[\-:|(](.+?)(?: \(|$|\))').findall(name)[0]
				except: 
					pass
			try:
				airDate = episode_item.find(itemprop = "uploadDate")['content']
				airDate = _common.format_date(airDate, '%y-%m-%d') 
			except:
				try:
					airDate = episode_item.find(itemprop = "datePublished").string.split(' ')[0]
					airDate = _common.format_date(airDate, '%m/%d/%y') 
				except:
					try:
						airDate = episode_item.find(class_ = "meta").text.split(' ')[-1].strip()
						airDate = _common.format_date(airDate, '%m/%d/%y') 
					except:
						airDate = -1
			try:
				duration = episode_item.find(class_ = "meta").text.split('-')[0].strip()
				durationinseconds = _common.format_seconds(duration)
			except:
				durationinseconds = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(episode_url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play"'
			_common.add_video(u, name, thumb, infoLabels = {'title' : name, "Episode" : episode_number, "Season" : season_number, "Plot" : plot, "premiered" : airDate, "durationinseconds" : durationinseconds}, quality_mode  = 'list_qualities')
			_common.set_view('episodes')
Ejemplo n.º 46
0
def episodes(episode_url=_common.args.url):
    filter = episode_url.split('#')[1]
    season = episode_url.split('#')[2]
    episode_url = episode_url.split('#')[0]
    episode_data = _connection.getURL(episode_url)
    episode_tree = simplejson.loads(episode_data)[2]['data']
    episode_menu = BeautifulSoup(episode_tree,
                                 'html.parser',
                                 parse_only=SoupStrainer('ul',
                                                         id='full-episode-ul'))
    for episode_item in episode_menu.find_all(
            'li', {
                'data-field_primary_filter_value': filter,
                'data-field_season_value': season
            }):
        if 'locked' not in episode_item['class']:
            url = episode_item['data-public-url']
            episode_duration = episode_item['data-duration']
            episode_duration = int(_common.format_seconds(episode_duration))
            try:
                episode_airdate = _common.format_date(
                    episode_item['data-date'].split(': ')[1], '%m/%d/%Y')
            except:
                episode_airdate = -1
            episode_name = HTMLParser.HTMLParser().unescape(
                episode_item['data-title'])
            try:
                season_number = int(episode_item['data-season'])
            except:
                season_number = -1
            try:
                episode_number = int(episode_item['data-episode'])
            except:
                episode_number = -1
            try:
                episode_thumb = episode_item.find('img')['data-src']
            except:
                try:
                    episode_thumb = episode_item.find('img')['src']
                except:
                    episode_thumb = None
            episode_plot = HTMLParser.HTMLParser().unescape(
                episode_item['data-description'])
            episode_showtitle = episode_item['data-page-title'].split(
                '-')[1].strip()
            episode_MPAA = episode_item['data-rating']
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'durationinseconds': episode_duration,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate,
                'TVShowTitle': episode_showtitle,
                'MPAA': episode_MPAA
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels)
    _common.set_view('episodes')
Ejemplo n.º 47
0
def add_video_from_manifestfile(manifest_feed):
    """ Add videos based on a manifest feed """
    try:
        shows = []

        items = manifest_feed['result']
        if 'episodes' in items:
            items = items['episodes']
        elif 'videos' in items:
            items = items['videos']
        elif 'playlist' in items:
            items = items['playlist']['videos']
        elif 'playlists' in items:
            t_items = []
            k = 0
            for i in items['playlists']:
                l = 0
                for j in items['playlists'][k]['videos']:
                    t_items.append(items['playlists'][k]['videos'][l])
                    l = l + 1
                k = k + 1
            items = t_items
        for item in items:
            try:
                episode_name = item['title']
            except:
                episode_name = item['shortTitle']
            epoch = float(item['airDate'])
            epoch = _common.convert_to_timezone(epoch, '', -5, epoch)
            episode_airdate = _common.format_date(epoch, '', '%d.%m.%Y', epoch)
            episode_plot = item['shortDescription']
            episode_thumb = item['images'][0]['url']
            url = item['url']
            if not url:
                url = item['canonicalURL']
            try:
                season_number = item['season']['seasonNumber']
                episode_number = str(
                    int(
                        str(item['season']['episodeNumber'])
                        [len(str(season_number)):]))
            except:
                season_number = -1
                episode_number = -1
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate
            }
            show = {
                'u': u,
                'episode_name': episode_name,
                'episode_thumb': episode_thumb,
                'infoLabels': infoLabels,
                'epoch': epoch
            }
            shows.append(show)
        if len(shows):
            shows = sorted(shows, key=lambda show: show['epoch'], reverse=True)
            for show in shows:
                _common.add_video(show['u'],
                                  show['episode_name'],
                                  show['episode_thumb'],
                                  infoLabels=show['infoLabels'],
                                  quality_mode='list_qualities')
    except:
        pass
Ejemplo n.º 48
0
def add_video(episode_tree, episode=False):
    try:
        episode_menu = episode_tree.find_all(
            itemtype='http://schema.org/TVEpisode')
        if not episode_menu:
            episode_menu = episode_tree.find_all(
                itemtype='http://schema.org/VideoObject')
        for episode_item in episode_menu:
            if episode == False or episode_item.find(class_='episode'):
                episode_name = episode_item.find('meta',
                                                 itemprop='name')['content']
                episode_plot = episode_item.find(
                    'meta', itemprop='description')['content']
                url = episode_item.find('meta', itemprop='url')['content']
                try:
                    episode_thumb = episode_item.find(
                        'meta', itemprop='image')['content'].split('?')[0]
                    print episode_thumb
                except:
                    try:
                        episode_thumb = episode_item.find(
                            'meta',
                            itemprop='thumbnailUrl')['content'].split('?')[0]
                    except:
                        episode_thumb = episode_item.find('img')['src'].split(
                            '?')[0]
                try:
                    episode_airdate = episode_item.find(
                        'meta', itemprop='uploadDate')['content']
                except:
                    try:
                        episode_airdate = episode_item.find(
                            'meta', itemprop='datePublished')['content']
                        print episode_airdate
                        try:
                            episode_airdate = _common.format_date(
                                episode_airdate, '%B %d, %Y')
                        except:
                            episode_airdate = _common.format_date(
                                episode_airdate, '%b %d, %Y')
                        print episode_airdate
                    except:
                        episode_airdate = -1
                try:
                    episode_duration = episode_item.find(
                        'meta', itemprop='duration')['content']
                    try:
                        duration_mins, duration_seconds = re.compile(
                            '([0-9]*)M([0-9]*)S').findall(episode_duration)[0]
                        episode_duration_seconds = int(
                            duration_mins) * 60 + int(duration_seconds)
                    except:
                        episode_duration_seconds = int(
                            episode_duration.replace('S', '').replace('T', ''))
                except:
                    episode_duration_seconds = -1
                try:
                    episode_meta = episode_item.find(
                        'div', class_='video_meta').text.split('|')[0]
                    season_number = int(
                        episode_meta.split('-')[0].replace('Season',
                                                           '').strip())
                    episode_number = int(
                        episode_meta.split('-')[1].replace('Episode',
                                                           '').strip()[1:])
                except:
                    season_number = -1
                    episode_number = -1
                u = sys.argv[0]
                u += '?url="' + urllib.quote_plus(url) + '"'
                u += '&mode="' + SITE + '"'
                u += '&sitemode="play_video"'
                infoLabels = {
                    'title': episode_name,
                    'durationinseconds': episode_duration_seconds,
                    'season': season_number,
                    'episode': episode_number,
                    'plot': episode_plot,
                    'premiered': episode_airdate
                }
                _common.add_video(u,
                                  episode_name,
                                  episode_thumb,
                                  infoLabels=infoLabels,
                                  quality_mode='list_qualities')
    except:
        pass
Ejemplo n.º 49
0
def episodes(SITE):
    episode_url = _common.args.url
    try:
        season_number = int(episode_url.split('filterBySeasonNumber=')[1])
    except:
        season_number = 0
    episode_data = _connection.getURL(episode_url)
    episode_tree = BeautifulSoup(episode_data, 'html.parser')
    episode_menu = episode_tree.find_all('episode')
    for episode_item in episode_menu:
        try:
            episode_season_number = int(episode_item['episeasonnumber'])
        except:
            episode_season_number = 0
        print "Es", episode_season_number
        if episode_season_number == season_number or 'filterBySeasonNumber' not in episode_url:
            print "HRE"
            segments = episode_item.find_all('segment')
            if len(segments) == 0:
                url = episode_item['id']
            else:
                url = ''
                for segment in segments:
                    url = url + ',' + segment['id']
                url = url[1:]
            try:
                episode_duration = episode_item['duration']
                episode_duration = int(
                    _common.format_seconds(episode_duration))
            except:
                episode_duration = 0
                for segment_duration in segments:
                    episode_duration += float(segment_duration['duration'])
            try:
                episode_airdate = _common.format_date(
                    episode_item['originalpremieredate'].split(' ')[0],
                    '%m/%d/%Y')
            except:
                try:
                    episode_airdate = _common.format_date(
                        episode_item['launchdate'].split(' ')[0], '%m/%d/%Y')
                except:
                    episode_airdate = -1
            episode_name = episode_item['title']
            try:
                season_number = int(episode_item['episeasonnumber'])
            except:
                season_number = -1
            try:
                episode_number = int(episode_item['episodenumber'][:2])
            except:
                episode_number = -1
            try:
                episode_thumb = episode_item['thumbnailurl']
            except:
                episode_thumb = None
            episode_plot = episode_item.description.text
            u = sys.argv[0]
            u += '?url="' + urllib.quote_plus(url) + '"'
            u += '&mode="' + SITE + '"'
            u += '&sitemode="play_video"'
            infoLabels = {
                'title': episode_name,
                'durationinseconds': episode_duration,
                'season': season_number,
                'episode': episode_number,
                'plot': episode_plot,
                'premiered': episode_airdate
            }
            _common.add_video(u,
                              episode_name,
                              episode_thumb,
                              infoLabels=infoLabels)
    _common.set_view('episodes')
Ejemplo n.º 50
0
def episodes_json(SITE):
    episode_url = _common.args.url
    master_name = episode_url.split('#')[0]
    episode_url = episode_url.split('#')[1]
    episode_data = _connection.getURL(episode_url)
    episode_menu = simplejson.loads(episode_data)
    for episode_item in episode_menu:
        url = episode_item['episodeID']
        try:
            episode_duration = episode_item['length']
        except:
            episode_duration = -1
        try:
            episode_airdate = _common.format_date(
                episode_item['airDate'].split('on ')[1], '%B %d, %Y')
        except:
            episode_airdate = -1
        try:
            episode_plot = episode_item['summary']
        except:
            episode_plot = episode_item['shortdescription']
        episode_name = episode_item['title']
        if episode_name == master_name:
            video_url = EPISODE % url
            video_data = _connection.getURL(video_url)
            video_tree = BeautifulSoup(video_data, 'html.parser')
            episode_name = video_tree.headline.string
        elif episode_name == "":
            episode_name = episode_plot
        try:
            season_number = int(
                episode_item['identifier'].split(',')[0].split(' ')[1])
        except:
            season_number = -1
        try:
            episode_number = int(
                episode_item['identifier'].split(', ')[1].split(' ')[1][1:])
        except:
            try:
                episode_number = int(
                    episode_item['identifier'].split(', ')[1].split(' ')[1])
            except:
                episode_number = -1
        try:
            episode_thumb = episode_item['640x360_jpg']
        except:
            episode_thumb = None
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'durationinseconds': episode_duration,
            'season': season_number,
            'episode': episode_number,
            'plot': episode_plot,
            'premiered': episode_airdate
        }
        _common.add_video(u,
                          episode_name,
                          episode_thumb,
                          infoLabels=infoLabels)
    _common.set_view('episodes')