Per Elrond's suggestions moving DEFAULT_WEBM_TYPE to media manager
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 3 Mar 2013 20:27:36 +0000 (14:27 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 3 Mar 2013 20:27:36 +0000 (14:27 -0600)
The reason for this is to avoid defining this twice as we were
previously (once in the template, once in video/models.py)

This commit sponsored by Roland McIntosh.  Thank you!

mediagoblin/media_types/video/__init__.py
mediagoblin/media_types/video/models.py
mediagoblin/templates/mediagoblin/media_displays/video.html

index fd364c027ba7ce7b20593d04989cc56b0b35a19f..fab601f66fb55f38cdc620053b1826ea35dcbd25 100644 (file)
@@ -30,4 +30,5 @@ MEDIA_MANAGER = {
 
     # Used by the media_entry.get_display_media method
     "media_fetch_order": [u'webm_640', u'original'],
+    "default_webm_type": 'video/webm; codecs="vp8, vorbis"',
 }
index 4639b8c823da1bfecb7c652fd246a95e86a22bd7..970ceb757dac68e21ea6093dc52cfa6c15ba0d54 100644 (file)
@@ -21,13 +21,12 @@ from sqlalchemy import (
     Column, Integer, SmallInteger, ForeignKey)
 from sqlalchemy.orm import relationship, backref
 from mediagoblin.db.extratypes import JSONEncoded
+from mediagoblin.media_types import video
 
 
 BACKREF_NAME = "video__media_data"
 
 
-DEFAULT_WEBM_TYPE = 'video/webm; codecs="vp8, vorbis"'
-
 class VideoData(Base):
     """
     Attributes:
@@ -84,7 +83,7 @@ class VideoData(Base):
                 orig_metadata["tags"]["video-codec"].lower(),
                 orig_metadata["tags"]["audio-codec"].lower())
         else:
-            return DEFAULT_WEBM_TYPE
+            return video.MEDIA_MANAGER["default_webm_type"]
 
 
 DATA_MODEL = VideoData
index dc0c7b55fcb12cd0d7568a56e5028e108f1e9e7c..b0854c9f7135b518849dc6783635d88d6bc434cf 100644 (file)
@@ -38,7 +38,7 @@
             {% if media.media_data %}
               type="{{ media.media_data.source_type() }}"
             {% else %}
-              type="video/webm; codecs=&quot;vp8, vorbis&quot;"
+              type="{{ media.media_manager['default_webm_type'] }}"
             {% endif %} />
     <div class="no_html5">
       {%- trans -%}Sorry, this video will not work because