Пример #1
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
Пример #2
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
Пример #3
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
Пример #4
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
Пример #5
0
	def ExportShow(self, show):
		series_title, mode, sitemode, url, tvdb_id, imdb_id, tvdbbanner, tvdbposter, tvdbfanart, first_aired, date, year, actors, genres, studio, plot, runtime, rating, airs_dayofweek, airs_time, status, has_full_episodes, favor, hide, show_name = show
		allepisodes = []
		has_episodes = False
		has_movies = False
		if '--' not in series_title:
			directory = os.path.join(TV_SHOWS_PATH, self.cleanfilename(show_name))
			try:
				shutil.rmtree(directory)
			except:
				pass
			seasons = common.get_seasons(mode, sitemode, url)
			for season in seasons:
				section_title,  site, subsitemode, suburl, locked, unlocked = season
				if 'Clips' not in section_title and ('Episode' in section_title or 'Season' in section_title):
					episodes = common.get_episodes(mode, subsitemode, suburl, tvdb_id) 
					allepisodes.extend(episodes)
					if allepisodes != []:
						for episode in allepisodes:
							try:
								type = episode[-1]
							except:
								print "Type not found.............."
							try:
								
								info = episode[3]
							except:
								print "Info not found......................."
							try:
								number = info['episode']
							except:
								number = -1
							if type == 'Full Episode' and number > -1:
								has_episodes = True
		else:
			episodes = common.get_episodes(mode, sitemode, url, tvdb_id)
			allepisodes = episodes
			has_movies = True
		if has_movies:
			directory = MOVIE_PATH
			for episode in allepisodes:
				self.ExportVideo(episode, directory, studio = studio)
				icon = episode[2]
				self.Notification(addon.getLocalizedString(39036), addon.getLocalizedString(39037) % episode[1], image = icon)
		elif has_episodes:
			self.CreateDirectory(directory)
			if addon.getSetting('shownfo') == 'true':
				
				tvshowDetails  = '<tvshow>'
				tvshowDetails += '<title>'+ show_name + '</title>'
				tvshowDetails += '<showtitle>' + show_name + '</showtitle>'
				tvshowDetails +=  '<rating>' + str(rating) + '</rating>'
				tvshowDetails +=  '<year>' + str(year) + '</year>'
				try:
					plot = common.replace_signs(plot)
					tvshowDetails +=  '<plot>' + plot + '</plot>'
				except:
					pass
				try:
					tvshowDetails += '<runtime>' + runtime +'</runtime>'
				except:
					pass
				try:
					tvshowDetails += '<thumb>' + tvdbposter +'</thumb>'
				except:
					try:
						tvshowDetails += '<thumb>' + tvdbbanner +'</thumb>'
					except:
						pass
				try:
					tvshowDetails += '<fanart>'
					tvshowDetails += '<thumb dim="1920x1080" colors="" preview="' + tvdbfanart + '">' + tvdbposter + '</thumb></fanart>'
				except:
					pass
				try:
					epguide = common.TVDBURL + ('/api/%s/series/%s/all/en.zip' % (common.TVDBAPIKEY, TVDB_ID))
					tvshowDetails += '<episodeguide>'
					tvshowDetails += '<url cache="' + TVDB_ID + '.xml">'+ epguide +'</url>'
					tvshowDetails += '</episodeguide>'
					tvshowDetails += '<id>' + TVDB_ID +'</id>'
				except:
					pass
				try:
					for genre in genres.split('|'):
						if genre:
							tvshowDetails += '<genre>' + genre + '</genre>'
				except:
					pass
				try:
					tvshowDetails += '<premiered>' + first_aired + '</premiered>'
				except:
					pass
				try:
					tvshowDetails += '<status>' + status + '</status>'
				except:
					pass
				try:
					tvshowDetails += '<studio>' + studio + '</studio>'
				except:
					pass
				try:
					for actor in actors.split('|'):
						if actor:
							tvshowDetails += '<actor><name>' + common.smart_unicode(actor) + '</name></actor>'
				except:
					pass
				tvshowDetails +='<dateadded>' + time.strftime("%Y-%m-%d %H:%M:%S") + '</dateadded>'
				tvshowDetails +='</tvshow>'					
				self.SaveFile( 'tvshow.nfo', tvshowDetails, directory)
			for episode in allepisodes:
				try:
					self.ExportVideo(episode, directory, studio = studio)
				except Exception, e:
					print "Can't export video", e
			self.Notification(addon.getLocalizedString(39036), addon.getLocalizedString(39037) % show_name, image = tvdbposter)
Пример #6
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
Пример #7
0
    def ExportShow(self, show):
        series_title, mode, sitemode, url, tvdb_id, imdb_id, tvdbbanner, tvdbposter, tvdbfanart, first_aired, date, year, actors, genres, studio, plot, runtime, rating, airs_dayofweek, airs_time, status, has_full_episodes, favor, hide, show_name = show
        allepisodes = []
        has_episodes = False
        has_movies = False
        if '--' not in series_title:
            seasons = common.get_seasons(mode, sitemode, url)
            for season in seasons:
                section_title, site, subsitemode, suburl, locked, unlocked = season
                if 'Clips' not in section_title and ('Episode' in section_title
                                                     or 'Season'
                                                     in section_title):
                    episodes = common.get_episodes(mode, subsitemode, suburl)
                    allepisodes.extend(episodes)
                    if allepisodes != []:
                        for episode in allepisodes:
                            try:
                                type = episode[-1]
                            except:
                                print "Type not found.............."
                            try:

                                info = episode[3]
                            except:
                                print "Info not found......................."
                            try:
                                number = info['episode']
                            except:
                                number = -1
                            if type == 'Full Episode' and number > -1:
                                has_episodes = True
        else:
            episodes = common.get_episodes(mode, sitemode, url)
            allepisodes = episodes
            has_movies = True
        if has_movies:
            directory = MOVIE_PATH
            for episode in allepisodes:
                self.ExportVideo(episode, directory, studio=studio)
                icon = episode[2]
                self.Notification(addon.getLocalizedString(39036),
                                  addon.getLocalizedString(39037) % episode[1],
                                  image=icon)
        elif has_episodes:
            directory = os.path.join(TV_SHOWS_PATH,
                                     self.cleanfilename(show_name))
            self.CreateDirectory(directory)
            if addon.getSetting('shownfo') == 'true':

                tvshowDetails = '<tvshow>'
                tvshowDetails += '<title>' + show_name + '</title>'
                tvshowDetails += '<showtitle>' + show_name + '</showtitle>'
                tvshowDetails += '<rating>' + str(rating) + '</rating>'
                tvshowDetails += '<year>' + str(year) + '</year>'
                try:
                    plot = common.replace_signs(plot)
                    tvshowDetails += '<plot>' + plot + '</plot>'
                except:
                    pass
                try:
                    tvshowDetails += '<runtime>' + runtime + '</runtime>'
                except:
                    pass
                try:
                    tvshowDetails += '<thumb>' + tvdbposter + '</thumb>'
                except:
                    try:
                        tvshowDetails += '<thumb>' + tvdbbanner + '</thumb>'
                    except:
                        pass
                try:
                    tvshowDetails += '<fanart>'
                    tvshowDetails += '<thumb dim="1920x1080" colors="" preview="' + tvdbfanart + '">' + tvdbposter + '</thumb></fanart>'
                except:
                    pass
                try:
                    epguide = common.TVDBURL + (
                        '/api/%s/series/%s/all/en.zip' %
                        (common.TVDBAPIKEY, TVDB_ID))
                    tvshowDetails += '<episodeguide>'
                    tvshowDetails += '<url cache="' + TVDB_ID + '.xml">' + epguide + '</url>'
                    tvshowDetails += '</episodeguide>'
                    tvshowDetails += '<id>' + TVDB_ID + '</id>'
                except:
                    pass
                try:
                    for genre in genres.split('|'):
                        if genre:
                            tvshowDetails += '<genre>' + genre + '</genre>'
                except:
                    pass
                try:
                    tvshowDetails += '<premiered>' + first_aired + '</premiered>'
                except:
                    pass
                try:
                    tvshowDetails += '<status>' + status + '</status>'
                except:
                    pass
                try:
                    tvshowDetails += '<studio>' + studio + '</studio>'
                except:
                    pass
                try:
                    for actor in actors.split('|'):
                        if actor:
                            tvshowDetails += '<actor><name>' + common.smart_unicode(
                                actor) + '</name></actor>'
                except:
                    pass
                tvshowDetails += '<dateadded>' + time.strftime(
                    "%Y-%m-%d %H:%M:%S") + '</dateadded>'
                tvshowDetails += '</tvshow>'
                self.SaveFile('tvshow.nfo', tvshowDetails, directory)
            for episode in allepisodes:
                try:
                    self.ExportVideo(episode, directory, studio=studio)
                except Exception, e:
                    print "Can't export video", e
            self.Notification(addon.getLocalizedString(39036),
                              addon.getLocalizedString(39037) % show_name,
                              image=tvdbposter)
Пример #8
0
def episodes(SITE, episode_url=common.args.url):
    episodes = []
    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']['$']) / 1000
            episode_id = episode_item['@id']
            episode_type = episode_item['@type']
            try:
                episode_description = common.replace_signs(
                    episode_item['longdescription'])
            except:
                try:
                    episode_description = common.replace_signs(
                        episode_item['description'])
                except:
                    episode_description = None
            try:
                episode_expires = episode_item['availabilities']['free']['end']
            except:
                episode_expires = None
            try:
                episode_genre = episode_item['show']['trackcode']['generic'][
                    'cgenre'].title()
            except:
                episode_genre = None
            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
            if episode_genre != 'Movies':
                season_number = episode_item['season']['@id']
                try:
                    episode_number = episode_item['number']
                except:
                    episode_number = -1
                try:
                    episode_number = re.compile('Episode (\d+)').findall(
                        episode_name)[0]
                except:
                    pass
            else:
                episode_number = -1
                season_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']['$']
            if episode_genre == 'Movies':
                type = 'Movie'
            elif episode_type == 'lf':
                type = 'Full Episode'
            else:
                type = 'Clip'
            show_name = episode_item['show']['title']
            try:
                episode_mpaa = episode_item['tvrating'][
                    'rating'] + ' ' + episode_item['tvrating']['descriptors']
            except:
                try:
                    episode_mpaa = episode_item['tvrating']['rating']
                except:
                    episode_mpaa = None
            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,
                'TVShowTitle': show_name,
                'mpaa': episode_mpaa,
                'genre': episode_genre
            }
            infoLabels = common.enrich_infolabels(
                infoLabels,
                episode_expires.rsplit(' ', 1)[0], '%a, %d %b %Y %H:%M:%S')
            episodes.append((u, episode_name, episode_thumb, infoLabels,
                             'list_qualities', False, type))
    return episodes
Пример #9
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
Пример #10
0
def episodes(SITE, episode_url = common.args.url):
	episodes = []
	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']['$']) / 1000
			episode_id = episode_item['@id']
			episode_type = episode_item['@type']
			try:
				episode_description = common.replace_signs(episode_item['longdescription'])
			except:
				try:
					episode_description = common.replace_signs(episode_item['description'])
				except:
					episode_description = None
			try:
				episode_expires = episode_item['availabilities']['free']['end']
			except:
				episode_expires = None
			try:
				episode_genre = episode_item['show']['trackcode']['generic']['cgenre'].title()
			except:
				episode_genre = None
			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
			if episode_genre != 'Movies':
				season_number = episode_item['season']['@id']
				try:
					episode_number = episode_item['number']
				except:
					episode_number = -1
				try:
					episode_number = re.compile('Episode (\d+)').findall(episode_name)[0]
				except:
					pass
			else:
				episode_number = -1
				season_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']['$']
			if episode_genre == 'Movies':
				type = 'Movie'
			elif episode_type == 'lf':
				type = 'Full Episode'
			else:
				type = 'Clip'
			show_name = episode_item['show']['title']
			try:
				episode_mpaa = episode_item['tvrating']['rating'] + ' ' + episode_item['tvrating']['descriptors']
			except:
				try:
					episode_mpaa = episode_item['tvrating']['rating']
				except:
					episode_mpaa = None
			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,
						'TVShowTitle' 		: show_name,
						'mpaa' 				: episode_mpaa,
						'genre' 			: episode_genre}
			infoLabels = common.enrich_infolabels(infoLabels, episode_expires.rsplit(' ',1)[0], '%a, %d %b %Y %H:%M:%S')
			episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities',False, type))
	return episodes
Пример #11
0
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:
				episode_number = re.compile('Episode (\d+)').findall(episode_name)[0]
			except:
				pass
			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,  quality_mode  = 'list_qualities')
	common.set_view('episodes')