Пример #1
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
Пример #2
0
def add_videos(episode_tree, SITE):
    episodes = []
    episode_menu = episode_tree.find_all('div', class_='media-module')
    show_name = episode_tree.find('h1').text
    for episode_item in episode_menu:
        episode_name = episode_item.a['data-title']
        episode_thumb = urllib.unquote_plus(
            episode_item.a.img['data-src'].split('url=')[1])
        try:
            episode_duration = common.format_seconds(
                episode_item.find('div', class_='timestamp').text.strip())
        except:
            episode_duration = -1
        url = episode_item.a['href']
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'durationinseconds': episode_duration,
            'TVShowTitle': show_name
        }
        episodes.append((u, episode_name, episode_thumb, infoLabels,
                         'list_qualities', False, 'Full Episode'))
    return episodes
Пример #3
0
def episodes(episode_url = common.args.url):
	episodes = []
	episode_data = connection.getURL(episode_url)
	episode_json = simplejson.loads(episode_data)['result']
	episode_menu = episode_json['data']
	title = episode_json['title']
	valid_login = None
	for episode_item in episode_menu:
		url = BASE + episode_item['url']
		if episode_item['status'] == 'PREMIUM' and valid_login is None:
			valid_login = login(url)
			print "login", valid_login
		if episode_item['status'] == 'AVAILABLE' or (valid_login and episode_item['status'] == 'PREMIUM'):
			videourl = episode_item['streaming_url']
			HD = False
			
			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']
			try:
				episode_mpaa = re.compile('\((.*)\)$').findall(episode_plot)[0]
			except:
				episode_mpaa = None
			show_title = episode_item['series_title']
			episode_expires = episode_item['expiry_date']
			episode_type = episode_item['type']
			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,
								'mpaa' : episode_mpaa,
								'TVShowTitle': show_title}
				infoLabels = common.enrich_infolabels(infoLabels, episode_expires)
				episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', HD, episode_type))
			else:
				pass
	return episodes
Пример #4
0
def add_clips_southpark(episode_tree):
	try:
		episode_menu = episode_tree.find_all('li', class_ = 'clips_thumb')
		clip_titles = []
		for episode_item in episode_menu:
			episode_name = episode_item.find('a', class_ = 'clips_thumb_link', text = True).string
			if episode_name not in clip_titles:
				clip_titles.append(episode_name)
				episode_plot = episode_item.find('h6').string.replace('"', '')
				url = episode_item.find('a')['href']
				episode_thumb = episode_item.find('img')['src'].split('?')[0]
				try:
					episode_duration_seconds = common.format_seconds(episode_item.find('span', class_ = 'clips_duration').string)
				except:
					episode_duration_seconds = -1
				try:
					episode_season = int(episode_item.find('h5', class_ = 'clips_thumb_season').string.replace('Season ', ''))
				except:
					episode_season = -1
				u = sys.argv[0]
				u += '?url="' + urllib.quote_plus(url) + '"'
				u += '&mode="' + SITE + '"'
				u += '&sitemode="play_video"'
				infoLabels={	'title' : episode_name,
								'duration' : episode_duration_seconds,
								'season' : episode_season,
								'plot' : episode_plot,
								'tvshowtitle' : 'South Park'}
				common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	except:
		pass
Пример #5
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
Пример #6
0
def episodes(episode_url = common.args.url):
	episodes = []
	episode_data = connection.getURL(episode_url)
	episode_json = simplejson.loads(episode_data)['result']
	episode_menu = episode_json['data']
	title = episode_json['title']
	valid_login = None
	for episode_item in episode_menu:
		url = BASE + episode_item['url']
		if episode_item['status'] == 'PREMIUM' and valid_login is None:
			valid_login = login(url)
			print "login", valid_login
		if episode_item['status'] == 'AVAILABLE' or (valid_login and episode_item['status'] == 'PREMIUM'):
			videourl = episode_item['streaming_url']
			HD = False

			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']
			try:
				episode_mpaa = re.compile('\((.*)\)$').findall(episode_plot)[0]
			except:
				episode_mpaa = None
			show_title = episode_item['series_title']
			episode_expires = episode_item['expiry_date']
			episode_type = episode_item['type']
			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,
								'mpaa' : episode_mpaa,
								'TVShowTitle': show_title}
				infoLabels = common.enrich_infolabels(infoLabels, episode_expires)
				episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', HD, episode_type))
			else:
				pass
	return episodes
Пример #7
0
def add_clips(episode_tree):
	episodes = []
	try:
		try:
			episode_menu = episode_tree.find(class_ ='clips').find_all(class_= 'clip')
		except:
			episode_menu = episode_tree.find_all(class_ = 'block')
		for episode_item in episode_menu:
			try:
				episode_name = common.replace_signs(episode_item.find('a', class_ = 'title').text)
			except:
				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]
			try:
				url = episode_item.find('a', class_ = 'title')['href']
			except:
				url = episode_item.find('div', class_ = 'thumb_area').a['href']
			try:
				try:
					episode_airdate = episode_item.find('div', class_ ='info').contents[-1].split(' ', 1)[1].strip()
				except:
					episode_airdate = episode_item.find('div', class_ = 'details').find('small', text = re.compile('Posted')).text.split(' ', 1)[1].strip()
				episode_airdate = common.format_date(episode_airdate, '%B %d, %Y', '%d.%m.%Y')
			except:
				episode_airdate = -1
			try:
				episode_duration = re.compile('\((.*)\)').findall(episode_name)[0]
				episode_name = re.compile('(.*)\s\(.*\)').findall(episode_name)[0]
				episode_duration = common.format_seconds(episode_duration)
			except:
				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 }
			episodes.append((u, episode_name, episode_thumb, infoLabels, None, False, 'Clip'))
	except Exception, e:
		pass
Пример #8
0
def episodes(SITE, episode_url = common.args.url):
	episodes = []
	episode_data = connection.getURL(episode_url)
	episode_tree = simplejson.loads(episode_data)
	for episode_item in episode_tree['series']['playlists']:
		show_name = episode_tree['series']['title']
		episode_item = episode_item['playlist']
		if '|' in episode_item['headline']:
			episode_name = episode_item['headline'].split('|')[-1].strip()
		elif '- ' in episode_item['headline']:
			episode_name = episode_item['headline'].split('- ')[-1].strip()
		else:
			try:
				episode_name = episode_item['headline'].split(':')[1].strip()
			except:
				episode_name = episode_item['headline']
		try:
			episode_info = re.compile('[s|S]([0-9]).[e|E]?([0-9]{0,2}).*').findall(episode_item['title'])
			try:
				episode_season, episode_number = episode_info[0]
			except:
				episode_season = episode_info
				episode_number = -1
		except:
			episode_season = -1
			episode_number = -1
		url = episode_item['id']
		try:
			episode_plot = episode_item['subhead']
		except:
			episode_plot = ''
		episode_thumb = episode_item['image']
		try:
			episode_duration = common.format_seconds(episode_item['duration']['timecode'])
		except:
			continue
		episode_type = episode_item['contentType'][:-1]
		episode_airdate = common.format_date(epoch = episode_item['postedDate']['timestamp'])
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play"'
		infoLabels = {	'title' : episode_name,
						'plot' : episode_plot,
						'durationinseconds' : episode_duration,
						'TVShowTitle' : show_name,
						'season' : episode_season,
						'episode' : episode_number,
						'premiered' : episode_airdate}
		try:
			if (episode_item['distributionPolicies'][0]['distributionPolicy']['policyType'] == 'playable'):
				episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
		except:
			if (episode_item['distributionPolicies'][0]['policyType'] == 'playable'):
				episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
		else:
			pass
	return episodes
Пример #9
0
def episodes(SITE, episode_url = common.args.url):
	episodes = []
	episode_data = connection.getURL(episode_url)
	episode_tree = simplejson.loads(episode_data)
	for episode_item in episode_tree['series']['playlists']:
		show_name = episode_tree['series']['title']
		episode_item = episode_item['playlist']
		if '|' in episode_item['headline']:
			episode_name = episode_item['headline'].split('|')[-1].strip()
		elif '- ' in episode_item['headline']:
			episode_name = episode_item['headline'].split('- ')[-1].strip()
		else:
			try:
				episode_name = episode_item['headline'].split(':')[1].strip()
			except:
				episode_name = episode_item['headline']
		try:
			episode_info = re.compile('[s|S]([0-9]).[e|E]?([0-9]{0,2}).*').findall(episode_item['title'])
			try:
				episode_season, episode_number = episode_info[0]
			except:
				episode_season = episode_info
				episode_number = -1
		except:
			episode_season = -1
			episode_number = -1
		url = episode_item['id']
		try:
			episode_plot = episode_item['subhead']
		except:
			episode_plot = ''
		episode_thumb = episode_item['image']
		try:
			episode_duration = common.format_seconds(episode_item['duration']['timecode'])
		except:
			continue
		episode_type = episode_item['contentType'][:-1]
		episode_airdate = common.format_date(epoch = episode_item['postedDate']['timestamp'])
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play"'
		infoLabels = {	'title' : episode_name,
						'plot' : episode_plot,
						'durationinseconds' : episode_duration,
						'TVShowTitle' : show_name,
						'season' : episode_season,
						'episode' : episode_number,
						'premiered' : episode_airdate}
		try:
			if (episode_item['distributionPolicies'][0]['distributionPolicy']['policyType'] == 'playable'):
				episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
		except:
			if (episode_item['distributionPolicies'][0]['policyType'] == 'playable'):
				episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
		else:
			pass
	return episodes
Пример #10
0
def videos(SITE):
	episode_url = common.args.url
	episode_data = connection.getURL(episode_url)
	episode_tree = simplejson.loads(episode_data)
	for episode_item in episode_tree['series']['playlists']:
		show_name = episode_tree['series']['title']
		episode_item = episode_item['playlist']
		if '|' in episode_item['headline']:
			episode_name = episode_item['headline'].split('|')[-1].strip()
		elif '- ' in episode_item['headline']:
			episode_name = episode_item['headline'].split('- ')[-1].strip()
		else:
			try:
				episode_name = episode_item['headline'].split(':')[1].strip()
			except:
				episode_name = episode_item['headline']
		try:
			episode_info = re.compile('[s|S]([0-9]).[e|E]?([0-9]{0,2}).*').findall(episode_item['title'])
			try:
				episode_season, episode_number = episode_info[0]
			except:
				episode_season = episode_info
				episode_number = -1
		except:
			episode_season = -1
			episode_number = -1
		url = episode_item['id']
		try:
			episode_plot = episode_item['subhead']
		except:
			episode_plot = ''
		episode_thumb = episode_item['image']
		try:
			episode_duration = common.format_seconds(episode_item['duration']['timecode'])
		except:
			continue
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play"'
		infoLabels = {	'title' : episode_name,
						'plot' : episode_plot,
						'durationinseconds' : episode_duration,
						'tvshowtitle' : show_name,
						'season' : episode_season,
						'episode' : episode_number }
		try:
			if (episode_item['distributionPolicies'][0]['distributionPolicy']['policyType'] == 'playable'):
				common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities')
		except:
			if (episode_item['distributionPolicies'][0]['policyType'] == 'playable'):
				common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities')
		else:
			pass
	common.set_view('episodes')
Пример #11
0
def add_clips(episode_tree, season_number=-1):
    episodes = []
    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
            }
            episodes.append((u, episode_name, episode_thumb, infoLabels,
                             'list_qualities', False, 'Clip'))
    except:
        pass
    return episodes
Пример #12
0
def add_fullepisodes(episode_tree, season_number=-1):
    episodes = []
    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
            show_name = episode_thumb.split('/')[5].replace('_', ' ').title()
            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
            }
            episodes.append((u, episode_name, episode_thumb, infoLabels,
                             'list_qualities', False, 'Full Episode'))
    except:
        pass
    return episodes
Пример #13
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:
		if episode_item['status'] == 'AVAILABLE' or (addon.getSetting('cbs_use_login') == 'true' and episode_item['status'] == 'PREMIUM'):
			videourl = episode_item['streaming_url']
			if '_hd_' in videourl:
				HD = True
			else:
				HD = False
			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', HD = HD)
			else:
				pass
	common.set_view('episodes')
Пример #14
0
def add_clips_southpark(episode_tree):
    try:
        episode_menu = episode_tree.find_all('li', class_='clips_thumb')
        clip_titles = []
        for episode_item in episode_menu:
            episode_name = episode_item.find('a',
                                             class_='clips_thumb_link',
                                             text=True).string
            if episode_name not in clip_titles:
                clip_titles.append(episode_name)
                episode_plot = episode_item.find('h6').string.replace('"', '')
                url = episode_item.find('a')['href']
                episode_thumb = episode_item.find('img')['src'].split('?')[0]
                try:
                    episode_duration_seconds = common.format_seconds(
                        episode_item.find('span',
                                          class_='clips_duration').string)
                except:
                    episode_duration_seconds = -1
                try:
                    episode_season = int(
                        episode_item.find(
                            'h5', class_='clips_thumb_season').string.replace(
                                'Season ', ''))
                except:
                    episode_season = -1
                u = sys.argv[0]
                u += '?url="' + urllib.quote_plus(url) + '"'
                u += '&mode="' + SITE + '"'
                u += '&sitemode="play_video"'
                infoLabels = {
                    'title': episode_name,
                    'duration': episode_duration_seconds,
                    'season': episode_season,
                    'plot': episode_plot,
                    'tvshowtitle': 'South Park'
                }
                common.add_video(u,
                                 episode_name,
                                 episode_thumb,
                                 infoLabels=infoLabels,
                                 quality_mode='list_qualities')
    except:
        pass
Пример #15
0
def add_videos(episode_tree, SITE):
	episode_menu = episode_tree.find_all('div', class_ = 'media-module')
	show_name = episode_tree.find('h1').text
	for episode_item in episode_menu:
		episode_name = episode_item.a['data-title']
		episode_thumb = urllib.unquote_plus(episode_item.a.img['data-src'].split('url=')[1])
		try:
			episode_duration = common.format_seconds(episode_item.find('div', class_='timestamp').text.strip())
		except:
			episode_duration = -1
		url = episode_item.a['href']
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels = {	'title' : episode_name,
						'durationinseconds' : episode_duration,
						'TVShowTitle' : show_name }
		common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode = 'list_qualities')
Пример #16
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')
Пример #17
0
def add_clips(episode_tree, season_number = -1):
	episodes = []
	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 }
			episodes.append((u, episode_name, episode_thumb, infoLabels,'list_qualities', False, 'Clip'))
	except:
		pass
	return episodes
Пример #18
0
def episodes(episode_url = common.args.url):
	episode_data = connection.getURL(episode_url, header = {'X-Forwarded-For' : '12.13.14.15'})
	episode_menu = simplejson.loads(episode_data)['results']
	for episode_item in episode_menu:
		try:
			show_name = episode_item['seriesTitle']
		except:
			show_name = ''
		try:
			episode_name = episode_item['title'].split(':')[1].replace('"', '')
		except:
			episode_name = episode_item['title']
		url = EPISODE_URL % episode_item['urlKey']
		try:
			episode_plot = episode_item['description']
		except:
			episode_plot = ''
		try:
			image = episode_item['images'][0]['assets'][0]['path']
			episode_thumb = BASE + image
		except:
			episode_thumb = None
		try:
			episode_duration = common.format_seconds(episode_item['duration'])
		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,
						'plot' : episode_plot,
						'durationinseconds' : episode_duration,
						'tvshowtitle' : show_name }
		common.add_video(u, episode_name, episode_thumb, infoLabels = infoLabels, quality_mode  = 'list_qualities')
	common.set_view('episodes')
Пример #19
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
        if episode_season_number == season_number or 'filterBySeasonNumber'  not in episode_url:
            segments = episode_item.find_all('segment')
            if len(segments) == 0:
                print episode_item
                try:
                    type = episode_item['episodeType']
                except:
                    type = episode_item['episodetype']
                if type == 'EPI':
                    continue
                else:
                    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, quality_mode  = 'list_qualities')
    common.set_view('episodes')
Пример #20
0
def episodes(episode_url = common.args.url):
	episodes  = []
	episode_data = connection.getURL(episode_url, header = {'X-Forwarded-For' : '12.13.14.15'})
	episode_menu = simplejson.loads(episode_data)['results']
	for episode_item in episode_menu:
		try:
			show_name = episode_item['seriesTitle']
		except:
			show_name = ''
		try:
			episode_name = episode_item['title'].split(':')[1].replace('"', '')
		except:
			episode_name = episode_item['title']
		url = EPISODE_URL % episode_item['urlKey']
		try:
			episode_plot = episode_item['description']
		except:
			episode_plot = ''
		try:
			image = episode_item['images'][0]['assets'][0]['path']
			episode_thumb = BASE + image
		except:
			episode_thumb = None
		try:
			episode_duration = common.format_seconds(episode_item['duration'])
		except:
			episode_duration = -1
		episode_type = ' '.join(episode_item['urlKey'].split('-')[-2:]).title()
		try:
			episode_number = episode_item['episodeNumber'][1:]
		except:
			episode_number = -1
		try:
			episode_season = episode_item['episodeNumber'][0]
		except:
			episode_season = -1
		try:
			episode_mpaa = episode_item['rating']
		except:
			episode_mpaa = None
		try:
			episode_airdate = episode_item['airDate']
			episode_airdate = common.format_date(episode_airdate.split('.')[0], '%Y-%m-%dT%H:%M:%S')
		except:
			episode_airdate = -1
		try:
			episode_expires = episode_item['availableUntil']
			episode_expires = episode_expires.split('.')[0]
		except:
			episode_expires = -1
		u = sys.argv[0]
		u += '?url="' + urllib.quote_plus(url) + '"'
		u += '&mode="' + SITE + '"'
		u += '&sitemode="play_video"'
		infoLabels = {	'title' : episode_name,
						'plot' : episode_plot,
						'durationinseconds' : episode_duration,
						'TVShowTitle' : show_name,
						'episode' : episode_number,
						'season' : episode_season,
						'mpaa' : episode_mpaa,
						'premiered' : episode_airdate}
		episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
	return episodes
Пример #21
0
def episodes(episode_url = common.args.url):
	episode_data = connection.getURL(episode_url)
	if 'clips' in common.args.name.lower():
		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:
				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)
	else:
		episode_menu = simplejson.loads(episode_data)['episodes']
		for episode_item in episode_menu['episode']:
			url = str(episode_item['id'])
			episode_duration = common.format_seconds(episode_item['duration'])
			episode_plot = episode_item['description']
			episode_airdate = common.format_date(episode_item['publishDate'].replace(' EDT', '').replace(' EST', ''), '%a %b %d %H:%M:%S %Y')
			episode_name = episode_item['title']
			try:
				season_number = int(episode_item['seasonNumber'])
			except:
				season_number = -1
			try:
				episode_number = int(episode_item['episodeNumber'][:1])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item['Thumbs']['Thumb'][-1]['content']
			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')
Пример #22
0
def episodes(episode_url = common.args.url):
	episodes = []
	episode_data = connection.getURL(episode_url)
	episode_json = simplejson.loads(episode_data)
	if 'entries' in episode_json: # will break lib ex
		episode_menu = episode_json['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:
				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 }
			episodes.append((u, episode_name, episode_thumb, infoLabels, None, False, 'Clip'))
	else:
		episode_menu = episode_json['episodes']
		for episode_item in episode_menu['episode']:
			url = str(episode_item['id'])
			episode_duration = common.format_seconds(episode_item['duration'])
			episode_plot = episode_item['description']
			episode_airdate = common.format_date(episode_item['publishDate'].replace(' EDT', '').replace(' EST', ''), '%a %b %d %H:%M:%S %Y')
			episode_name = episode_item['title']
			try:
				season_number = int(episode_item['seasonNumber'])
			except:
				season_number = -1
			try:
				episode_number = int(str(episode_item['episodeNumber'])[1:])
			except:
				episode_number = -1
			try:
				episode_thumb = episode_item['Thumbs']['Thumb'][-1]['content']
			except:
				episode_thumb = None
			episode_expires = episode_item['expirationDate']
			show_title = episode_item['showTitle']
			episode_mpaa = episode_item['tvRatingCode']
			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,
							'mpaa' : episode_mpaa}
			infoLabels = common.enrich_infolabels(infoLabels, episode_expires, '%m/%d/%Y')
			episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, 'Full Episode'))
	return episodes
Пример #23
0
def episodes(episode_url=common.args.url):
    episodes = []
    episode_data = connection.getURL(episode_url)
    episode_json = simplejson.loads(episode_data)["result"]
    episode_menu = episode_json["data"]
    title = episode_json["title"]
    valid_login = None
    for episode_item in episode_menu:
        url = BASE + episode_item["url"]
        if episode_item["status"] == "PREMIUM" and valid_login is None:
            valid_login = login(url)
            print "login", valid_login
        if episode_item["status"] == "AVAILABLE" or (valid_login and episode_item["status"] == "PREMIUM"):
            videourl = episode_item["streaming_url"]
            HD = False

            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"]
            try:
                episode_mpaa = re.compile("\((.*)\)$").findall(episode_plot)[0]
            except:
                episode_mpaa = None
            show_title = episode_item["series_title"]
            episode_expires = episode_item["expiry_date"]
            episode_type = episode_item["type"]
            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,
                    "mpaa": episode_mpaa,
                    "TVShowTitle": show_title,
                }
                infoLabels = common.enrich_infolabels(infoLabels, episode_expires)
                episodes.append((u, episode_name, episode_thumb, infoLabels, "list_qualities", HD, episode_type))
            else:
                pass
    return episodes
Пример #24
0
def episodes(SITE, episode_url = common.args.url):
	episodes = []
	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
		try:
			type = episode_item['episodeType']
		except:
			type = episode_item['episodetype']

		if episode_season_number == season_number or 'filterBySeasonNumber'  not in episode_url:
			segments = episode_item.find_all('segment')
			if len(segments) == 0:
				if type == 'EPI':
					continue
				else:
					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_expires = episode_item['expirationdate']
			episode_name = episode_item['title']
			try:
				season_number = int(episode_item['episeasonnumber'])
			except:
				season_number = -1
			try:

				episode_number = int(episode_item['episodenumber'][:2])
				
				if episode_number == 0:
					try:
						episode_number = int(re.compile('Ep (\d)').findall(episode_name)[0])
					except:
						episode_number = int(episode_item['subepisodenumber']) 
			except:
				try:
					try:
						episode_number = int(re.compile('Ep (\d)').find_all(episode_name))
					except:
						episode_number = int(episode_item['subepisodenumber'])  - 1
				except:
					episode_number = -1
			try:

				episode_thumb = episode_item['thumbnailurl']
			except:
				episode_thumb = None
			episode_plot = episode_item.description.text.strip()
			try:
				show_title = common.replace_signs(episode_item['collectiontitle'])
			except:
				show_title = None
			episode_rating = episode_item['ranking']
			episode_mpaa = episode_item['rating'].upper()
			if type == 'EPI' or 'TVE':
				episode_type = 'Full Episode'
			else:
				episode_type = 'Clip'
			url = urllib.quote_plus(url)
			u = sys.argv[0]
			u += '?url="' + 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,
							'rating' : episode_rating,
							'mpaa' : episode_mpaa}
			infoLabels = common.enrich_infolabels(infoLabels, episode_expires, '%m/%d/%Y %I:%M %p')			
			episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
	return episodes
Пример #25
0
def episodes(episode_url=common.args.url):
    episodes = []
    episode_data = connection.getURL(episode_url,
                                     header={'X-Forwarded-For': '12.13.14.15'})
    episode_menu = simplejson.loads(episode_data)['results']
    for episode_item in episode_menu:
        try:
            show_name = episode_item['seriesTitle']
        except:
            show_name = ''
        try:
            episode_name = episode_item['title'].split(':')[1].replace('"', '')
        except:
            episode_name = episode_item['title']
        url = EPISODE_URL % episode_item['urlKey']
        try:
            episode_plot = episode_item['description']
        except:
            episode_plot = ''
        try:
            image = episode_item['images'][0]['assets'][0]['path']
            episode_thumb = BASE + image
        except:
            episode_thumb = None
        try:
            episode_duration = common.format_seconds(episode_item['duration'])
        except:
            episode_duration = -1
        episode_type = ' '.join(episode_item['urlKey'].split('-')[-2:]).title()
        try:
            episode_number = episode_item['episodeNumber'][1:]
        except:
            episode_number = -1
        try:
            episode_season = episode_item['episodeNumber'][0]
        except:
            episode_season = -1
        try:
            episode_mpaa = episode_item['rating']
        except:
            episode_mpaa = None
        try:
            episode_airdate = episode_item['airDate']
            episode_airdate = common.format_date(
                episode_airdate.split('.')[0], '%Y-%m-%dT%H:%M:%S')
        except:
            episode_airdate = -1
        try:
            episode_expires = episode_item['availableUntil']
            episode_expires = episode_expires.split('.')[0]
        except:
            episode_expires = -1
        u = sys.argv[0]
        u += '?url="' + urllib.quote_plus(url) + '"'
        u += '&mode="' + SITE + '"'
        u += '&sitemode="play_video"'
        infoLabels = {
            'title': episode_name,
            'plot': episode_plot,
            'durationinseconds': episode_duration,
            'TVShowTitle': show_name,
            'episode': episode_number,
            'season': episode_season,
            'mpaa': episode_mpaa,
            'premiered': episode_airdate
        }
        episodes.append((u, episode_name, episode_thumb, infoLabels,
                         'list_qualities', False, episode_type))
    return episodes
Пример #26
0
def add_clips(episode_tree):
    episodes = []
    try:
        try:
            episode_menu = episode_tree.find(class_='clips').find_all(
                class_='clip')
        except:
            episode_menu = episode_tree.find_all(class_='block')
        for episode_item in episode_menu:
            try:
                episode_name = common.replace_signs(
                    episode_item.find('a', class_='title').text)
            except:
                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]
            try:
                url = episode_item.find('a', class_='title')['href']
            except:
                url = episode_item.find('div', class_='thumb_area').a['href']
            try:
                try:
                    episode_airdate = episode_item.find(
                        'div', class_='info').contents[-1].split(' ',
                                                                 1)[1].strip()
                except:
                    episode_airdate = episode_item.find(
                        'div', class_='details').find(
                            'small', text=re.compile('Posted')).text.split(
                                ' ', 1)[1].strip()
                episode_airdate = common.format_date(episode_airdate,
                                                     '%B %d, %Y', '%d.%m.%Y')
            except:
                episode_airdate = -1
            try:
                episode_duration = re.compile('\((.*)\)').findall(
                    episode_name)[0]
                episode_name = re.compile('(.*)\s\(.*\)').findall(
                    episode_name)[0]
                episode_duration = common.format_seconds(episode_duration)
            except:
                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
            }
            episodes.append((u, episode_name, episode_thumb, infoLabels, None,
                             False, 'Clip'))
    except Exception, e:
        pass
Пример #27
0
def episodes(SITE, episode_url=common.args.url):
    episodes = []
    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
        try:
            type = episode_item['episodeType']
        except:
            type = episode_item['episodetype']

        if episode_season_number == season_number or 'filterBySeasonNumber' not in episode_url:
            segments = episode_item.find_all('segment')
            if len(segments) == 0:
                if type == 'EPI':
                    continue
                else:
                    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_expires = episode_item['expirationdate']
            episode_name = episode_item['title']
            try:
                season_number = int(episode_item['episeasonnumber'])
            except:
                season_number = -1
            try:

                episode_number = int(episode_item['episodenumber'][:2])

                if episode_number == 0:
                    try:
                        episode_number = int(
                            re.compile('Ep (\d)').findall(episode_name)[0])
                    except:
                        episode_number = int(episode_item['subepisodenumber'])
            except:
                try:
                    try:
                        episode_number = int(
                            re.compile('Ep (\d)').find_all(episode_name))
                    except:
                        episode_number = int(
                            episode_item['subepisodenumber']) - 1
                except:
                    episode_number = -1
            try:

                episode_thumb = episode_item['thumbnailurl']
            except:
                episode_thumb = None
            episode_plot = episode_item.description.text.strip()
            try:
                show_title = common.replace_signs(
                    episode_item['collectiontitle'])
            except:
                show_title = None
            episode_rating = episode_item['ranking']
            episode_mpaa = episode_item['rating'].upper()
            if type == 'EPI' or 'TVE':
                episode_type = 'Full Episode'
            else:
                episode_type = 'Clip'
            url = urllib.quote_plus(url)
            u = sys.argv[0]
            u += '?url="' + 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,
                'rating': episode_rating,
                'mpaa': episode_mpaa
            }
            infoLabels = common.enrich_infolabels(infoLabels, episode_expires,
                                                  '%m/%d/%Y %I:%M %p')
            episodes.append((u, episode_name, episode_thumb, infoLabels,
                             'list_qualities', False, episode_type))
    return episodes