From: vijeth-aradhya Date: Fri, 16 Jun 2017 21:04:58 +0000 (+0530) Subject: Render webm_480 as default if webm_video is absent X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=336508bb17bc9ce51b001c5b415da116fb137f73;p=mediagoblin.git Render webm_480 as default if webm_video is absent Currently, webm_video is still the higher priority in media_fetch_oder as older versions should not be broken. So, webm_480p (main_task) will be rendered by default for newer versions. All tests pass at this point. --- diff --git a/mediagoblin/media_types/video/__init__.py b/mediagoblin/media_types/video/__init__.py index 1862ffe1..08e92080 100644 --- a/mediagoblin/media_types/video/__init__.py +++ b/mediagoblin/media_types/video/__init__.py @@ -31,7 +31,7 @@ class VideoMediaManager(MediaManagerBase): type_icon = "images/type_icons/video.png" # Used by the media_entry.get_display_media method - media_fetch_order = [u'webm_video', u'original'] + media_fetch_order = [u'webm_video', u'webm_480p', u'original'] default_webm_type = 'video/webm; codecs="vp8, vorbis"' diff --git a/mediagoblin/media_types/video/processing.py b/mediagoblin/media_types/video/processing.py index e881636c..4da1ad23 100644 --- a/mediagoblin/media_types/video/processing.py +++ b/mediagoblin/media_types/video/processing.py @@ -166,6 +166,7 @@ def store_metadata(media_entry, metadata): @celery.task() def main_task(entry_id, resolution, medium_size, **process_info): + print "\nEntry processing\n" entry, manager = get_entry_and_processing_manager(entry_id) print "\nEntered main_task\n" with CommonVideoProcessor(manager, entry) as processor: @@ -175,6 +176,10 @@ def main_task(entry_id, resolution, medium_size, **process_info): processor.generate_thumb(thumb_size=process_info['thumb_size']) processor.store_orig_metadata() print "\nExited main_task\n" + # Make state of entry as processed + entry.state = u'processed' + entry.save() + print "\nEntry processed\n" @celery.task() @@ -544,6 +549,9 @@ class VideoProcessingManager(ProcessingManager): def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + entry.state = u'processing' + entry.save() + reprocess_info = reprocess_info or {} if 'vp8_quality' not in reprocess_info: reprocess_info['vp8_quality'] = None diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 484d27cd..5e629575 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -66,13 +66,12 @@ def user_home(request, page): {'user': user}) cursor = MediaEntry.query.\ - filter_by(actor = user.id, - state = u'processed').order_by(MediaEntry.created.desc()) + filter_by(actor = user.id).order_by(MediaEntry.created.desc()) pagination = Pagination(page, cursor) media_entries = pagination() - #if no data is available, return NotFound + # if no data is available, return NotFound if media_entries == None: return render_404(request)