Per Elrond's suggestions moving DEFAULT_WEBM_TYPE to media manager

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!
This commit is contained in:
Christopher Allan Webber 2013-03-03 14:27:36 -06:00
parent 787aafd644
commit 9d4cebfd36
3 changed files with 4 additions and 4 deletions

View File

@ -30,4 +30,5 @@ MEDIA_MANAGER = {
# Used by the media_entry.get_display_media method # Used by the media_entry.get_display_media method
"media_fetch_order": [u'webm_640', u'original'], "media_fetch_order": [u'webm_640', u'original'],
"default_webm_type": 'video/webm; codecs="vp8, vorbis"',
} }

View File

@ -21,13 +21,12 @@ from sqlalchemy import (
Column, Integer, SmallInteger, ForeignKey) Column, Integer, SmallInteger, ForeignKey)
from sqlalchemy.orm import relationship, backref from sqlalchemy.orm import relationship, backref
from mediagoblin.db.extratypes import JSONEncoded from mediagoblin.db.extratypes import JSONEncoded
from mediagoblin.media_types import video
BACKREF_NAME = "video__media_data" BACKREF_NAME = "video__media_data"
DEFAULT_WEBM_TYPE = 'video/webm; codecs="vp8, vorbis"'
class VideoData(Base): class VideoData(Base):
""" """
Attributes: Attributes:
@ -84,7 +83,7 @@ class VideoData(Base):
orig_metadata["tags"]["video-codec"].lower(), orig_metadata["tags"]["video-codec"].lower(),
orig_metadata["tags"]["audio-codec"].lower()) orig_metadata["tags"]["audio-codec"].lower())
else: else:
return DEFAULT_WEBM_TYPE return video.MEDIA_MANAGER["default_webm_type"]
DATA_MODEL = VideoData DATA_MODEL = VideoData

View File

@ -38,7 +38,7 @@
{% if media.media_data %} {% if media.media_data %}
type="{{ media.media_data.source_type() }}" type="{{ media.media_data.source_type() }}"
{% else %} {% else %}
type="video/webm; codecs="vp8, vorbis"" type="{{ media.media_manager['default_webm_type'] }}"
{% endif %} /> {% endif %} />
<div class="no_html5"> <div class="no_html5">
{%- trans -%}Sorry, this video will not work because {%- trans -%}Sorry, this video will not work because