Add choice of video resolutions for instance owner
The instance owner can choose from the list of available resolutions. ['144p', '240p', '360p', '480p', '720p', '1080p'] Also, the default resolution is now set to 480p and the instance owner can choose the default resolution from that list as well.
This commit is contained in:
parent
336508bb17
commit
5161533a6f
@ -12,6 +12,14 @@ vorbis_quality = float(default=0.3)
|
||||
# Autoplay the video when page is loaded?
|
||||
auto_play = boolean(default=False)
|
||||
|
||||
# List of resolutions that the video should be transcoded to
|
||||
# Choose among ['144p', '240p', '360p', '480p', '720p', '1080p'],
|
||||
# preferrably in the order of transcoding.
|
||||
available_resolutions = string_list(default=list('480p', '360p', '720p'))
|
||||
|
||||
# Default resolution of video
|
||||
default_resolution = string(default='480p')
|
||||
|
||||
[[skip_transcode]]
|
||||
mime_types = string_list(default=list("video/webm"))
|
||||
container_formats = string_list(default=list("Matroska"))
|
||||
|
@ -549,6 +549,10 @@ class VideoProcessingManager(ProcessingManager):
|
||||
|
||||
def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None):
|
||||
|
||||
video_config = mgg.global_config['plugins'][MEDIA_TYPE]
|
||||
def_res = video_config['default_resolution']
|
||||
priority_num = len(video_config['available_resolutions']) + 1
|
||||
|
||||
entry.state = u'processing'
|
||||
entry.save()
|
||||
|
||||
@ -562,18 +566,22 @@ class VideoProcessingManager(ProcessingManager):
|
||||
if 'thumb_size' not in reprocess_info:
|
||||
reprocess_info['thumb_size'] = None
|
||||
|
||||
transcoding_tasks = group([
|
||||
main_task.signature(args=(entry.id, '480p', ACCEPTED_RESOLUTIONS['480p']),
|
||||
kwargs=reprocess_info, queue='default',
|
||||
priority=5, immutable=True),
|
||||
complimentary_task.signature(args=(entry.id, '360p', ACCEPTED_RESOLUTIONS['360p']),
|
||||
kwargs=reprocess_info, queue='default',
|
||||
priority=4, immutable=True),
|
||||
complimentary_task.signature(args=(entry.id, '720p', ACCEPTED_RESOLUTIONS['720p']),
|
||||
kwargs=reprocess_info, queue='default',
|
||||
priority=3, immutable=True),
|
||||
])
|
||||
tasks_list = [main_task.signature(args=(entry.id, def_res,
|
||||
ACCEPTED_RESOLUTIONS[def_res]),
|
||||
kwargs=reprocess_info, queue='default',
|
||||
priority=priority_num, immutable=True)]
|
||||
|
||||
for comp_res in video_config['available_resolutions']:
|
||||
if comp_res != def_res:
|
||||
priority_num += -1
|
||||
tasks_list.append(
|
||||
complimentary_task.signature(args=(entry.id, comp_res,
|
||||
ACCEPTED_RESOLUTIONS[comp_res]),
|
||||
kwargs=reprocess_info, queue='default',
|
||||
priority=priority_num, immutable=True)
|
||||
)
|
||||
|
||||
transcoding_tasks = group(tasks_list)
|
||||
cleanup_task = processing_cleanup.signature(args=(entry.id,),
|
||||
queue='default', immutable=True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user