Media Types/Display

From GNU MediaGoblin Wiki
Revision as of 20:45, 22 June 2012 by Joar (talk | contribs)
Jump to navigation Jump to search
I'm currently working on this page
Joar 16:29, 22 June 2012 (EDT)

Media type display pages are media type-specific Jinja2 templates defined in the media type's MEDIA_MANAGER['display_template'].

Set the template path

The path for the media type display template is configured in the MEDIA_MANAGER object for each media type. The MEDIA_MANAGER is configured in (mediagoblin/)media_types/$MEDIA_TYPE/__init__.py.

  • The path to the template should be relative to the mediagoblin/templates/ directory.
  • The standard directory for media templates is mediagoblin/templates/mediagoblin/media_displays

THis is an example of a MEDIA_MANAGER dict, see the display_template key.

MEDIA_MANAGER = {
    "human_readable": "Video",
    "processor": process_video,  # alternately a string,
                                 # 'mediagoblin.media_types.image.processing'?
    "sniff_handler": sniff_handler,
    "display_template": "mediagoblin/media_displays/video.html",
    "default_thumb": "images/media_thumbs/video.jpg",
    "accepted_extensions": [
        "mp4", "mov", "webm", "avi", "3gp", "3gpp", "mkv", "ogv", "m4v"]}