diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-03-02 19:06:31 -0600 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-03-02 19:06:31 -0600 |
commit | ddbf6af1e20222882a7ce559804ed48f4ad31a92 (patch) | |
tree | e53664048ed3f46d8c034eee64fff298b1f7ae13 /mediagoblin/db/mixin.py | |
parent | fd693e368bf7d344c29ff99b77acbb92f4524b73 (diff) | |
download | mediagoblin-ddbf6af1e20222882a7ce559804ed48f4ad31a92.tar.lz mediagoblin-ddbf6af1e20222882a7ce559804ed48f4ad31a92.tar.xz mediagoblin-ddbf6af1e20222882a7ce559804ed48f4ad31a92.zip |
Huge amount of work to (mostly) allow .ogg (and maybe other) formats to skip transcode
- Update get_display_media in several ways:
- now uses the media type's own declaration of the order of things
- returns both the media_size and the media_path, as per the docstring
- implicitly uses self.media_files as opposed to forcing you to pass it in
- update videos to use get_display_media
- update images to declare media_fetch_order in the media manager (videos also)
- update stl to use media.media_files['original'] instead of weird
use of get_display_media
- update sidebar to only conditionally show webm_640
TODO still: identify video type information *during* processing, show
that in the <video><source /></video> element.
This commit sponsored by Nathan Yergler. Thanks, nyergler!
Diffstat (limited to 'mediagoblin/db/mixin.py')
-rw-r--r-- | mediagoblin/db/mixin.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py index 6789a970..c4bd806c 100644 --- a/mediagoblin/db/mixin.py +++ b/mediagoblin/db/mixin.py @@ -126,24 +126,30 @@ class MediaEntryMixin(object): """ return cleaned_markdown_conversion(self.description) - def get_display_media(self, media_map, - fetch_order=common.DISPLAY_IMAGE_FETCHING_ORDER): + def get_display_media(self, fetch_order=None): """ Find the best media for display. Args: - - media_map: a dict like - {u'image_size': [u'dir1', u'dir2', u'image.jpg']} - - fetch_order: the order we should try fetching images in + - fetch_order: the order we should try fetching images in. + If this isn't supplied, we try checking + self.media_data.fetching_order if it exists. Returns: - (media_size, media_path) + (media_size, media_path) + or, if not found, None. """ - media_sizes = media_map.keys() + fetch_order = self.media_manager.get("media_fetch_order") - for media_size in common.DISPLAY_IMAGE_FETCHING_ORDER: + # No fetching order found? well, give up! + if not fetch_order: + return None + + media_sizes = self.media_files.keys() + + for media_size in fetch_order: if media_size in media_sizes: - return media_map[media_size] + return media_size, self.media_files[media_size] def main_mediafile(self): pass |