# Authors: Olivier Guilyardi <olivier@samalyse.com>
# Guillaume Pellerin <yomguy@parisson.com>
-
+import mimetypes
from telemeta.views.core import *
class ItemView(object):
grapher['graph'].render(grapher['path'])
f.close()
- mime_type = decoder.format()
+ mime_type = mimetypes.guess_type(item.file.path)[0]
analysis = MediaItemAnalysis(item=item, name='MIME type',
analyzer_id='mime_type', unit='', value=mime_type)
analysis.save()
analysis.save()
analysis = MediaItemAnalysis(item=item, name='Samplerate',
analyzer_id='samplerate', unit='Hz',
- value=unicode(decoder.audiorate))
+ value=unicode(decoder.samplerate()))
analysis.save()
analysis = MediaItemAnalysis(item=item, name='Resolution',
analyzer_id='resolution', unit='bits',
- value=unicode(decoder.audiowidth))
+ value=unicode(decoder.input_width))
analysis.save()
analysis = MediaItemAnalysis(item=item, name='Duration',
analyzer_id='duration', unit='s',
- value=unicode(datetime.timedelta(0,decoder.duration)))
+ value=unicode(datetime.timedelta(0,decoder.input_duration)))
analysis.save()
for analyzer in analyzers_sub:
if not self.cache_data.exists(image_file):
if item.file:
path = self.cache_data.dir + os.sep + image_file
- decoder = timeside.decoder.FileDecoder(item.file.path)
+ decoder = self.decoders[0](item.file.path)
graph = grapher(width = int(width), height = int(height))
- pipe = decoder | graph
- pipe.run()
+ (decoder | graph).run()
graph.watermark('timeside', opacity=.6, margin=(5,5))
f = open(path, 'w')
graph.render(path)
media = self.cache_export.dir + os.sep + file
if not self.cache_export.exists(file) or not flag.value:
# source > encoder > stream
- decoder = timeside.decoder.FileDecoder(audio)
+ decoder = self.decoders[0](audio)
decoder.setup()
proc = encoder(media, streaming=True)
proc.setup(channels=decoder.channels(), samplerate=decoder.samplerate())