Raises FileTypeNotSupported in case no such manager is enabled
"""
- manager = hook_handle('get_media_manager', self.media_type)
+ manager = hook_handle(('media_manager', self.media_type))
if manager:
return manager(self)
media_type = hook_handle('sniff_handler', media_file, media=media)
if media_type:
_log.info('{0} accepts the file'.format(media_type))
- return media_type, hook_handle('get_media_managers', media_type)
+ return media_type, hook_handle(('media_manager', media_type))
else:
_log.debug('{0} did not accept the file'.format(media_type))
default_thumb = "images/media_thumbs/ascii.jpg"
-def get_media_manager(media_type):
- if media_type == MEDIA_TYPE:
- return ASCIIMediaManager
-
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, ASCIIMediaManager
hooks = {
'setup': setup_plugin,
'get_media_type_and_manager': get_media_type_and_manager,
+ ('media_manager', MEDIA_TYPE): lambda: ASCIIMediaManager,
'sniff_handler': sniff_handler,
- 'get_media_manager': get_media_manager,
}
display_template = "mediagoblin/media_displays/audio.html"
-def get_media_manager(media_type):
- if media_type == MEDIA_TYPE:
- return AudioMediaManager
-
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, AudioMediaManager
'setup': setup_plugin,
'get_media_type_and_manager': get_media_type_and_manager,
'sniff_handler': sniff_handler,
- 'get_media_manager': get_media_manager,
+ ('media_manager', MEDIA_TYPE): lambda: AudioMediaManager,
}
return None
-def get_media_manager(media_type):
- if media_type == MEDIA_TYPE:
- return ImageMediaManager
-
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, ImageMediaManager
'setup': setup_plugin,
'get_media_type_and_manager': get_media_type_and_manager,
'sniff_handler': sniff_handler,
- 'get_media_manager': get_media_manager,
+ ('media_manager', MEDIA_TYPE): lambda: ImageMediaManager,
}
default_thumb = "images/media_thumbs/pdf.jpg"
-def get_media_manager(media_type):
- if media_type == MEDIA_TYPE:
- return PDFMediaManager
-
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, PDFMediaManager
+
hooks = {
'setup': setup_plugin,
'get_media_type_and_manager': get_media_type_and_manager,
'sniff_handler': sniff_handler,
- 'get_media_manager': get_media_manager,
+ ('media_manager', MEDIA_TYPE): lambda: PDFMediaManager,
}
default_thumb = "images/media_thumbs/video.jpg"
-def get_media_manager(media_type):
- if media_type == MEDIA_TYPE:
- return STLMediaManager
-
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, STLMediaManager
'setup': setup_plugin,
'get_media_type_and_manager': get_media_type_and_manager,
'sniff_handler': sniff_handler,
- 'get_media_manager': get_media_manager,
+ ('media_manager', MEDIA_TYPE): lambda: STLMediaManager,
}
default_webm_type = 'video/webm; codecs="vp8, vorbis"'
-def get_media_manager(media_type):
- if media_type == MEDIA_TYPE:
- return VideoMediaManager
-
-
def get_media_type_and_manager(ext):
if ext in ACCEPTED_EXTENSIONS:
return MEDIA_TYPE, VideoMediaManager
'setup': setup_plugin,
'get_media_type_and_manager': get_media_type_and_manager,
'sniff_handler': sniff_handler,
- 'get_media_manager': get_media_manager,
+ ('media_manager', MEDIA_TYPE): lambda: VideoMediaManager,
}