Render webm_480 as default if webm_video is absent
authorvijeth-aradhya <vijthaaa@gmail.com>
Fri, 16 Jun 2017 21:04:58 +0000 (02:34 +0530)
committervijeth-aradhya <vijthaaa@gmail.com>
Fri, 16 Jun 2017 21:04:58 +0000 (02:34 +0530)
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.

mediagoblin/media_types/video/__init__.py
mediagoblin/media_types/video/processing.py
mediagoblin/user_pages/views.py

index 1862ffe12b697d43444d57c4f0fd57e78fccf29c..08e92080da59eb42a8bdcd263102462edc6c4c0a 100644 (file)
@@ -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"'
 
 
index e881636c214561be2a1358ed1b73db6a8cd51c0c..4da1ad23387600595fb26fe1b7a270a958ab8e2d 100644 (file)
@@ -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
index 484d27cd9ff42c3c5567e73c6edb26120aead5ab..5e629575d9e6d5a2676bca628b762068761eac32 100644 (file)
@@ -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)