TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "data/"
TELEMETA_DOWNLOAD_ENABLED = True
-TELEMETA_STREAMING_FORMATS = ('mp3', 'webm')
-TELEMETA_DOWNLOAD_FORMATS = ('wav', 'mp3', 'webm')
+TELEMETA_STREAMING_FORMATS = ('mp3', 'ogg')
+TELEMETA_DOWNLOAD_FORMATS = ('wav', 'mp3', 'ogg', 'flac')
TELEMETA_PUBLIC_ACCESS_PERIOD = 51
TELEMETA_DEFAULT_WAVEFORM_SIZES = ['360x130', '640x130']
export_enabled = getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', True)
export_formats = getattr(settings, 'TELEMETA_DOWNLOAD_FORMATS', ('mp3', 'wav'))
+ default_analyzers = ['mean_dc_shift', 'level']
+
def get_export_formats(self):
formats = []
for encoder in self.encoders:
def item_analyze(self, item):
analyses = MediaItemAnalysis.objects.filter(item=item)
mime_type = ''
-
+
if analyses:
for analysis in analyses:
if not item.approx_duration and analysis.analyzer_id == 'duration':
pipe = decoder
for analyzer in self.analyzers:
- subpipe = analyzer()
- analyzers_sub.append(subpipe)
- pipe = pipe | subpipe
+ if analyzer.id() in self.default_analyzers:
+ subpipe = analyzer()
+ analyzers_sub.append(subpipe)
+ pipe = pipe | subpipe
try:
sizes = settings.TELEMETA_DEFAULT_GRAPHER_SIZES
analyzer_id='duration', unit='s',
value=unicode(datetime.timedelta(0,decoder.input_duration)))
analysis.save()
-
+
for analyzer in analyzers_sub:
- value = analyzer.result()
- analysis = MediaItemAnalysis(item=item, name=analyzer.name(),
- analyzer_id=analyzer.id(),
- unit=analyzer.unit(), value=str(value))
- analysis.save()
+ for key in analyzer.results.keys():
+ result = analyzer.results[key]
+ value = result.data_object.value
+ if value.shape[0] == 1:
+ value = value[0]
+ analysis = MediaItemAnalysis(item=item, name=result.name,
+ analyzer_id=result.id, unit=result.unit, value = unicode(value))
+ analysis.save()
# FIXME: parse tags on first load
# tags = decoder.tags
media = self.cache_export.dir + os.sep + file
if not self.cache_export.exists(file) or not flag.value:
# source > encoder > stream
- decoder = self.decoders[0](audio)
+ decoder = timeside.decoder.FileDecoder(audio)
decoder.setup()
proc = encoder(media, streaming=True, overwrite=True)
- proc.setup(channels=decoder.channels(), samplerate=decoder.samplerate())
+ proc.setup(channels=decoder.channels(), samplerate=decoder.samplerate(),
+ blocksize=decoder.blocksize(), totalframes=decoder.totalframes())
if extension in mapping.unavailable_extensions:
metadata=None
response = HttpResponse(stream_from_processor(decoder, proc, flag, metadata=metadata), mimetype = mime_type)