コード例 #1
0
def add_video_from_manifestfile(manifest_feed, full_episodes=False):
    """ Add videos based on a manifest feed """
    try:
        episodes = []
        shows = []
        items = manifest_feed['result']
        if 'videos' in items:
            items = items['videos']
        elif 'playlist' in items:
            items = items['playlist']['videos']
        elif 'episode' in items:
            items = [items['episode']]
        elif 'playlists' in items:
            t_items = []
            k = 0
            for i in items['playlists']:
                l = 0
                for j in items['playlists'][k]['videos']:
                    t_items.append(items['playlists'][k]['videos'][l])
                    l = l + 1
                k = k + 1
            items = t_items
        elif 'items' in items:
            items = items['items']
        for item in items:
            try:
                episode_type = item['episodeType']
                if episode_type == 'fullEpisode':
                    episode_type = 'Full Episode'
                else:
                    episode_type = 'Clip'
            except:
                episode_type = 'Clip'
            if item['distPolicy']['authTve'] == False:
                if (full_episodes == True and episode_type
                        == 'Full Episode') or (full_episodes == False and
                                               episode_type != 'Full Episode'):
                    try:
                        episode_name = item['title']
                    except:
                        episode_name = item['shortTitle']
                    try:
                        epoch = float(item['airDate'])
                        epoch = common.convert_to_timezone(
                            epoch, '', -5, epoch)

                        episode_airdate = common.format_date(
                            epoch, '', '%d.%m.%Y', epoch)
                    except:
                        episode_airdate = -1
                    episode_plot = item['shortDescription']
                    episode_thumb = item['images'][0]['url']
                    try:
                        episode_duration = item['duration']
                    except:
                        episode_duration = -1
                    url = item['url']
                    if not url:
                        url = item['canonicalURL']
                    try:
                        season_number = item['season']['seasonNumber']
                        episode_number = str(
                            int(
                                str(item['season']['episodeNumber'])
                                [len(str(season_number)):]))
                    except:
                        season_number = -1
                        episode_number = -1
                    try:
                        show_name = item['show']['title']
                    except:
                        show_name = ''
                    episode_expires = item['distPolicy']['endDate']
                    try:
                        episode_mpaa = RATINGS[item['contentRating']]
                    except:
                        episode_mpaa = None
                    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,
                        'durationinseconds': episode_duration,
                        'TVShowTitle': show_name,
                        'mpaa': episode_mpaa
                    }
                    try:
                        infoLabels = common.enrich_infolabels(
                            infoLabels, epoch=episode_expires)
                    except Exception as e:
                        print "Can't enrich", e
                    episodes.append(
                        (u, episode_name, episode_thumb, infoLabels,
                         'list_qualities', False, episode_type))
        return episodes
    except Exception, e:
        print "Exception: ", e
コード例 #2
0
def add_video_from_manifestfile(manifest_feed):
	""" Add videos based on a manifest feed """
	try:
		episodes = []
		shows = []
		items = manifest_feed['result']
		if 'episodes' in items:
			items = items['episodes']
		elif 'videos' in items:
			items = items['videos']
		elif 'playlist' in items:
			items = items['playlist']['videos']
		elif 'episodeVideos' in items:
			items = items['episodeVideos']
		elif 'playlists' in items:
			t_items = []
			k = 0
			for i in items['playlists']:
				l = 0
				for j in items['playlists'][k]['videos']:
					t_items.append(items['playlists'][k]['videos'][l])
					l = l + 1
				k = k + 1
			items = t_items
		try:
			episode_type = manifest_feed['result']['promo']['promoType'].replace('_', ' ').title()
		except:
			episode_type = 'Clip'
		for item in items:
			try:
				episode_name = item['title']
			except:
				episode_name = item['shortTitle']
			epoch = float(item['airDate'])
			epoch = common.convert_to_timezone(epoch, '', -5, epoch)  
			episode_airdate = common.format_date(epoch , '', '%d.%m.%Y', epoch)
			episode_plot = item['shortDescription']
			episode_thumb = item['images'][0]['url']
			try:
				episode_duration = item['duration']
			except:
				episode_duration = -1
			url = item['url']
			if not url:
				url = item['canonicalURL']
			try:
				season_number = item['season']['seasonNumber']
				episode_number = str(int(str(item['season']['episodeNumber'])[len(str(season_number)):]))
			except:
				season_number = -1
				episode_number = -1
			show_name = item['show']['title']
			episode_expires = item['distPolicy']['endDate']
			try:
				episode_mpaa = RATINGS[item['contentRating']]
			except:
				episode_mpaa = None
			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,
							'durationinseconds' : episode_duration,
							'TVShowTitle' : show_name,
							'mpaa' : episode_mpaa
							}
			try:
				infoLabels = common.enrich_infolabels(infoLabels, epoch = episode_expires)
			except Exception as e:
				print "Can't enrich", e
			show = {'u': u, 'episode_name': episode_name, 'episode_thumb': episode_thumb, 'infoLabels': infoLabels, 'epoch': epoch}
			shows.append(show)
		if len(shows):
			shows = sorted(shows, key=lambda show: show['epoch'], reverse=True)
			for show in shows:
				episodes.append((show['u'], show['episode_name'], show['episode_thumb'], show['infoLabels'], 'list_qualities', False, episode_type))
		return episodes
	except:
		pass
コード例 #3
0
def add_video_from_manifestfile(manifest_feed):
	""" Add videos based on a manifest feed """
	try:
		shows = []
		items = manifest_feed['result']
		if 'episodes' in items:
			items = items['episodes']
		elif 'videos' in items:
			items = items['videos']
		elif 'playlist' in items:
			items = items['playlist']['videos']
		elif 'episodeVideos' in items:
			items = items['episodeVideos']
		elif 'playlists' in items:
			t_items = []
			k = 0
			for i in items['playlists']:
				l = 0
				for j in items['playlists'][k]['videos']:
					t_items.append(items['playlists'][k]['videos'][l])
					l = l + 1
				k = k + 1
			items = t_items
		for item in items:
			try:
				episode_name = item['title']
			except:
				episode_name = item['shortTitle']
			epoch = float(item['airDate'])
			epoch = common.convert_to_timezone(epoch, '', -5, epoch)  
			episode_airdate = common.format_date(epoch , '', '%d.%m.%Y', epoch)
			episode_plot = item['shortDescription']
			episode_thumb = item['images'][0]['url']
			try:
				episode_duration = item['duration']
			except:
				episode_duration = -1
			url = item['url']
			if not url:
				url = item['canonicalURL']
			try:
				season_number = item['season']['seasonNumber']
				episode_number = str(int(str(item['season']['episodeNumber'])[len(str(season_number)):]))
			except:
				season_number = -1
				episode_number = -1
			u = sys.argv[0]
			u += '?url="' + urllib.quote_plus(url) + '"'
			u += '&mode="' + SITE + '"'
			u += '&sitemode="play_video"'
			infoLabels={	'title' : episode_name,
							'season' : season_number,
							'episode' : episode_number,
							'plot' : episode_plot,
							'premiered' : episode_airdate,
							'durationinseconds' : episode_duration
							}
			show = {'u': u, 'episode_name': episode_name, 'episode_thumb': episode_thumb, 'infoLabels': infoLabels, 'epoch': epoch}
			shows.append(show)
		if len(shows):
			shows = sorted(shows, key=lambda show: show['epoch'], reverse=True)
			for show in shows:
				common.add_video(show['u'], show['episode_name'], show['episode_thumb'], infoLabels = show['infoLabels'], quality_mode  = 'list_qualities')
	except:
		pass
コード例 #4
0
def add_video_from_manifestfile(manifest_feed, full_episodes = False):
	""" Add videos based on a manifest feed """
	try:
		episodes = []
		shows = []
		items = manifest_feed['result']
		if 'videos' in items:
			items = items['videos']
		elif 'playlist' in items:
			items = items['playlist']['videos']
		elif 'episode' in items:
			items = [items['episode']]
		elif 'playlists' in items:
			t_items = []
			k = 0
			for i in items['playlists']:
				l = 0
				for j in items['playlists'][k]['videos']:
					t_items.append(items['playlists'][k]['videos'][l])
					l = l + 1
				k = k + 1
			items = t_items
		elif 'items' in items:
			items = items['items']
		for item in items:
			try:
				episode_type = item['episodeType']
				if episode_type == 'fullEpisode':
					episode_type = 'Full Episode'
				else:
					episode_type = 'Clip'
			except:
				episode_type = 'Clip'
			if item['distPolicy']['authTve'] == False:
				if (full_episodes == True  and episode_type == 'Full Episode') or (full_episodes == False  and episode_type != 'Full Episode'):
					try:
						episode_name = item['title']
					except:
						episode_name = item['shortTitle']
					try:
						epoch = float(item['airDate'])
						epoch = common.convert_to_timezone(epoch, '', -5, epoch)  
						
						episode_airdate = common.format_date(epoch , '', '%d.%m.%Y', epoch)
					except:
						episode_airdate = -1
					episode_plot = item['shortDescription']
					episode_thumb = item['images'][0]['url']
					try:
						episode_duration = item['duration']
					except:
						episode_duration = -1
					url = item['url']
					if not url:
						url = item['canonicalURL']
					try:
						season_number = item['season']['seasonNumber']
						episode_number = str(int(str(item['season']['episodeNumber'])[len(str(season_number)):]))
					except:
						season_number = -1
						episode_number = -1
					try:
						show_name = item['show']['title']
					except:
						show_name = ''
					episode_expires = item['distPolicy']['endDate']
					try:
						episode_mpaa = RATINGS[item['contentRating']]
					except:
						episode_mpaa = None
					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,
									'durationinseconds' : episode_duration,
									'TVShowTitle' : show_name,
									'mpaa' : episode_mpaa
									}
					try:
						infoLabels = common.enrich_infolabels(infoLabels, epoch = episode_expires)
					except Exception as e:
						print "Can't enrich", e
					episodes.append((u, episode_name, episode_thumb, infoLabels, 'list_qualities', False, episode_type))
		return episodes
	except Exception,e:
		print "Exception: ", e
コード例 #5
0
def add_video_from_manifestfile(manifest_feed):
    """ Add videos based on a manifest feed """
    try:
        episodes = []
        shows = []
        items = manifest_feed['result']
        if 'episodes' in items:
            items = items['episodes']
        elif 'videos' in items:
            items = items['videos']
        elif 'playlist' in items:
            items = items['playlist']['videos']
        elif 'episodeVideos' in items:
            items = items['episodeVideos']
        elif 'playlists' in items:
            t_items = []
            k = 0
            for i in items['playlists']:
                l = 0
                for j in items['playlists'][k]['videos']:
                    t_items.append(items['playlists'][k]['videos'][l])
                    l = l + 1
                k = k + 1
            items = t_items
        try:
            episode_type = manifest_feed['result']['promo'][
                'promoType'].replace('_', ' ').title()
        except:
            episode_type = 'Clip'
        for item in items:
            try:
                episode_name = item['title']
            except:
                episode_name = item['shortTitle']
            epoch = float(item['airDate'])
            epoch = common.convert_to_timezone(epoch, '', -5, epoch)
            episode_airdate = common.format_date(epoch, '', '%d.%m.%Y', epoch)
            episode_plot = item['shortDescription']
            episode_thumb = item['images'][0]['url']
            try:
                episode_duration = item['duration']
            except:
                episode_duration = -1
            url = item['url']
            if not url:
                url = item['canonicalURL']
            try:
                season_number = item['season']['seasonNumber']
                episode_number = str(
                    int(
                        str(item['season']['episodeNumber'])
                        [len(str(season_number)):]))
            except:
                season_number = -1
                episode_number = -1
            show_name = item['show']['title']
            episode_expires = item['distPolicy']['endDate']
            try:
                episode_mpaa = RATINGS[item['contentRating']]
            except:
                episode_mpaa = None
            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,
                'durationinseconds': episode_duration,
                'TVShowTitle': show_name,
                'mpaa': episode_mpaa
            }
            try:
                infoLabels = common.enrich_infolabels(infoLabels,
                                                      epoch=episode_expires)
            except Exception as e:
                print "Can't enrich", e
            show = {
                'u': u,
                'episode_name': episode_name,
                'episode_thumb': episode_thumb,
                'infoLabels': infoLabels,
                'epoch': epoch
            }
            shows.append(show)
        if len(shows):
            shows = sorted(shows, key=lambda show: show['epoch'], reverse=True)
            for show in shows:
                episodes.append((show['u'], show['episode_name'],
                                 show['episode_thumb'], show['infoLabels'],
                                 'list_qualities', False, episode_type))
        return episodes
    except:
        pass