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):
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
task, c = Task.objects.get_or_create(experience=experience, selection=selection)
task.status_setter(2)
+ task.delete()
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')),
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