Add property to media_fetch_order

Due to configurable resolution settings, this change is necessary to set the
default resolution and the others.
This commit is contained in:
vijeth-aradhya 2017-07-01 04:06:02 +05:30
parent fe40b02e7d
commit ae7ebecdbb

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin import mg_globals as mgg
from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.video.processing import (VideoProcessingManager,
sniff_handler, sniffer)
@ -31,9 +32,17 @@ 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'webm_480p', u'original']
default_webm_type = 'video/webm; codecs="vp8, vorbis"'
@property
def media_fetch_order(self):
video_config = mgg.global_config['plugins'][MEDIA_TYPE]
video_res = video_config['available_resolutions']
video_res.remove(video_config['default_resolution'])
video_res.insert(0, video_config['default_resolution'])
video_res = map((lambda x: unicode('webm_' + str(x), 'utf-8')), video_res)
return ([u'webm_video'] + video_res + [u'original'])
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS: