]> git.parisson.com Git - timeside.git/commitdiff
add encoder mime_types to env, cleanup
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 6 Mar 2015 11:59:53 +0000 (12:59 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 6 Mar 2015 12:01:43 +0000 (13:01 +0100)
examples/deploy/nginx/sites-enabled/app.conf
timeside/core/tools/test_samples.py
timeside/server/management/commands/timeside-tests-boilerplate.py
timeside/server/models.py

index 38ca77f790a7c6402bfdde39d902d399e2095b95..1ef52b3d767c22d075f1243eece033fb955a4ec7 100644 (file)
@@ -23,7 +23,6 @@ server {
        }
 
        location / {
-             #proxy_pass django;
             uwsgi_pass app:8000;
             include /etc/nginx/uwsgi_params;
        }
index 7372d3eeb44aa54014e8ae6b048cc2988329d5c8..c486481e52d940089fff38d5573bc151fdce53f5 100644 (file)
@@ -79,10 +79,11 @@ class NumpySrc:
 class SampleArray(object):
     """Base Class for generating a data sample array"""
 
-    def __init__(self, duration=10, samplerate=44100):
+    def __init__(self, duration=10, samplerate=44100, gain=0.97):
         self.samplerate = int(samplerate)
         self.num_samples = int(numpy.ceil(duration * self.samplerate))
         self.array = NotImplemented
+        self.gain = gain
 
     @property
     def time_samples(self):
index dfef99e6e4599f9aa4979fa1414bc2b52cc8d312..2830773f95024e3b5463d8d42f6756746158c564 100644 (file)
@@ -13,16 +13,21 @@ from timeside.core.tools.test_samples import generateSamples
 class Command(BaseCommand):
     help = "Setup and run a boilerplate for testing"
 
-    def cleanup(self):
+    def processor_cleanup(self):
         for processor in Processor.objects.all():
             processor.delete()
 
+    def result_cleanup(self):
+        for result in Result.objects.all():
+            result.delete()
+
     def handle(self, *args, **options):
         # NOT for production
-        self.cleanup()
+        self.processor_cleanup()
+        # self.result_cleanup()
 
         presets = []
-        blacklist =['decoder', 'live', 'gain', 'yaafe']
+        blacklist =['decoder', 'live', 'gain']
         processors = timeside.core.processor.processors(timeside.core.api.IProcessor)
         for proc in processors:
             trig = True
@@ -54,3 +59,4 @@ class Command(BaseCommand):
 
         task, c = Task.objects.get_or_create(experience=experience, selection=selection)
         task.status_setter(2)
+        task.delete()
index f54a856f68c8cc709a3da5502838d199b2edf399..0ba128814ed29d6b88b0a5ecbb8429598124018b 100644 (file)
@@ -50,6 +50,21 @@ PROCESSOR_PIDS = [(name, [(processor.id(), processor.id())
                           in timeside.core.processor.processors(proc_type)])
                   for name, proc_type in _processor_types.items()]
 
+extra_types = {
+    '.webm': 'video/webm',
+    '.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 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')),
@@ -307,7 +322,7 @@ class Task(BaseResource):
                 result.status_setter(_DONE)
             elif proc.type == 'encoder':
                 result = Result.objects.get(preset=preset, item=item)
-                result.mime_type_setter(get_mime_type(result.file.path))
+                result.mime_type_setter(get_mime_type(result.file.path))
                 result.status_setter(_DONE)
             del proc