From: Guillaume Pellerin Date: Mon, 24 Mar 2014 16:53:16 +0000 (+0100) Subject: cleanup X-Git-Tag: 0.5.5~1^2~75 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=26effe48978ff89c5935e92060c86facf17e5438;p=timeside.git cleanup --- diff --git a/timeside/views.py b/timeside/views.py index 4ff8ba5..91e5eb0 100644 --- a/timeside/views.py +++ b/timeside/views.py @@ -28,37 +28,7 @@ class IndexView(ListView): return super(IndexView, self).dispatch(*args, **kwargs) -class ItemGraphView(DetailView): +class ItemGrapherView(DetailView): + model = Item - - def item_visualize(self, request, public_id, grapher_id, width, height): - item = MediaItem.objects.get(public_id=public_id) - mime_type = 'image/png' - grapher = self.get_grapher(grapher_id) - - if grapher.id() != grapher_id: - raise Http404 - - size = width + '_' + height - image_file = '.'.join([public_id, grapher_id, size, 'png']) - - # FIX waveform grapher name change - old_image_file = '.'.join([public_id, 'waveform', size, 'png']) - if 'waveform_centroid' in grapher_id and self.cache_data.exists(old_image_file): - image_file = old_image_file - - if not self.cache_data.exists(image_file): - source = item.get_source() - if source: - path = self.cache_data.dir + os.sep + image_file - decoder = timeside.decoder.FileDecoder(source) - graph = grapher(width = int(width), height = int(height)) - (decoder | graph).run() - graph.watermark('timeside', opacity=.6, margin=(5,5)) - f = open(path, 'w') - graph.render(output=path) - f.close() - - response = HttpResponse(self.cache_data.read_stream_bin(image_file), mimetype=mime_type) - return response \ No newline at end of file