item.approx_duration = str(time)
item.save()
else:
+ # process first waveform to speed up imports
+ width = 360
+ height = 130
+ size = str(width) + '_' + str(height)
+ grapher_id = 'waveform'
+ image_file = '.'.join([public_id, grapher_id, size, 'png'])
+
analyzers = []
analyzers_sub = []
if item.file:
subpipe = analyzer()
analyzers_sub.append(subpipe)
pipe = pipe | subpipe
+ if not self.cache_data.exists(image_file):
+ path = self.cache_data.dir + os.sep + image_file
+ for grapher in self.graphers:
+ if grapher.id() == grapher_id:
+ break
+ graph = grapher(width = int(width), height = int(height))
+ pipe = pipe | graph
pipe.run()
+ if not self.cache_data.exists(image_file):
+ f = open(path, 'w')
+ graph.render(path)
+ f.close()
mime_type = decoder.format()
analyzers.append({'name': 'Mime type', 'id': 'mime_type', 'unit': '', 'value': mime_type})
analyzers.append({'name': 'Channels', 'id': 'channels', 'unit': '', 'value': decoder.channels()})