From 1f3097ffb81e900c60de442c1b64b43c77239344 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 17 Mar 2015 16:11:48 +0100 Subject: [PATCH] split new mimetype dict (private / public) --- timeside/server/models.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/timeside/server/models.py b/timeside/server/models.py index 0349095..d8ced2c 100644 --- a/timeside/server/models.py +++ b/timeside/server/models.py @@ -50,21 +50,28 @@ PROCESSOR_PIDS = [(name, [(processor.id(), processor.id()) in timeside.core.processor.processors(proc_type)]) for name, proc_type in _processor_types.items()] -extra_types = { +public_extra_types = { '.webm': 'video/webm', +} + +encoders = timeside.core.processor.processors(timeside.core.api.IEncoder) +for encoder in encoders: + public_extra_types['.' + encoder.file_extension()] = encoder.mime_type() + +private_extra_types = { '.eaf': 'text/xml', # ELAN Annotation Format '.trs': 'text/xml', # Trancriber Annotation Format '.svl': 'text/xml', # Sonic Visualiser layer file '.TextGrid': 'text/praat-textgrid', # Praat TextGrid annotation file } -encoders = timeside.core.processor.processors(timeside.core.api.IEncoder) -for encoder in encoders: - extra_types['.' + encoder.file_extension()] = encoder.mime_type() +for ext,mime_type in public_extra_types.items(): + mimetypes.add_type(mime_type, ext) -for ext,mime_type in extra_types.items(): +for ext,mime_type in private_extra_types.items(): mimetypes.add_type(mime_type, ext) + # Status _FAILED, _DRAFT, _PENDING, _RUNNING, _DONE = 0, 1, 2, 3, 4 STATUS = ((_FAILED, _('failed')), (_DRAFT, _('draft')), -- 2.39.5