From 9d4cebfd36b7bba3d8d4ad2cb97a85ec63068cb5 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 3 Mar 2013 14:27:36 -0600 Subject: [PATCH] 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! --- mediagoblin/media_types/video/__init__.py | 1 + mediagoblin/media_types/video/models.py | 5 ++--- mediagoblin/templates/mediagoblin/media_displays/video.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mediagoblin/media_types/video/__init__.py b/mediagoblin/media_types/video/__init__.py index fd364c02..fab601f6 100644 --- a/mediagoblin/media_types/video/__init__.py +++ b/mediagoblin/media_types/video/__init__.py @@ -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"', } diff --git a/mediagoblin/media_types/video/models.py b/mediagoblin/media_types/video/models.py index 4639b8c8..970ceb75 100644 --- a/mediagoblin/media_types/video/models.py +++ b/mediagoblin/media_types/video/models.py @@ -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 diff --git a/mediagoblin/templates/mediagoblin/media_displays/video.html b/mediagoblin/templates/mediagoblin/media_displays/video.html index dc0c7b55..b0854c9f 100644 --- a/mediagoblin/templates/mediagoblin/media_displays/video.html +++ b/mediagoblin/templates/mediagoblin/media_displays/video.html @@ -38,7 +38,7 @@ {% if media.media_data %} type="{{ media.media_data.source_type() }}" {% else %} - type="video/webm; codecs="vp8, vorbis"" + type="{{ media.media_manager['default_webm_type'] }}" {% endif %} />
{%- trans -%}Sorry, this video will not work because -- 2.25.1