From: Guillaume Pellerin Date: Fri, 14 Feb 2014 20:27:31 +0000 (+0100) Subject: Merge branch 'dev' into crem X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=1a38a48ca13cd85ddb24a755111b98b2284dadef;p=telemeta.git Merge branch 'dev' into crem Conflicts: example/sandbox/settings.py telemeta/urls.py telemeta/views/item.py --- 1a38a48ca13cd85ddb24a755111b98b2284dadef diff --cc example/sandbox/settings.py index 5bd692c6,c1bbc2ea..c1e5738d --- a/example/sandbox/settings.py +++ b/example/sandbox/settings.py @@@ -165,3 -164,6 +164,6 @@@ LOGIN_REDIRECT_URL = '/desk/lists/ EMAIL_HOST = 'localhost' DEFAULT_FROM_EMAIL = 'webmaster@parisson.com' + + TIMESIDE_DEFAULT_GRAPHER_ID = 'waveform_centroid' -TIMESIDE_AUTO_ZOOM = True ++TIMESIDE_AUTO_ZOOM = False diff --cc telemeta/views/item.py index f2f0cbe6,501f886b..b81cf636 --- a/telemeta/views/item.py +++ b/telemeta/views/item.py @@@ -115,21 -133,13 +133,12 @@@ class ItemView(object) messages.error(request, title) return render(request, 'telemeta/messages.html', {'description' : description}) - graphers = [] - for grapher in self.graphers: - graphers.append({'name':grapher.name(), 'id': grapher.id()}) - - if request.REQUEST.has_key('grapher_id'): - grapher_id = request.REQUEST['grapher_id'] - else: - grapher_id = getattr(settings, 'TELEMETA_DEFAULT_GRAPHER_ID', 'waveform') - previous, next = self.item_previous_next(item) - mime_type = self.item_analyze(item) - - #FIXME: use mimetypes.guess_type - if 'quicktime' in mime_type: - mime_type = 'video/mp4' + mime_type = item.mime_type + if mime_type and mime_type != 'none' : + if 'quicktime' in mime_type: + mime_type = 'video/mp4' playlists = get_playlists(request) related_media = MediaItemRelated.objects.filter(item=item) @@@ -160,23 -170,13 +169,12 @@@ item = MediaItem.objects.get(public_id=public_id) access = get_item_access(item, request.user) - graphers = [] - for grapher in self.graphers: - graphers.append({'name':grapher.name(), 'id': grapher.id()}) - if request.REQUEST.has_key('grapher_id'): - grapher_id = request.REQUEST['grapher_id'] - else: - try: - grapher_id = settings.TELEMETA_DEFAULT_GRAPHER_ID - except: - grapher_id = 'waveform' - previous, next = self.item_previous_next(item) - mime_type = self.item_analyze(item) - - #FIXME: use mimetypes.guess_type - if 'quicktime' in mime_type: - mime_type = 'video/mp4' + mime_type = item.mime_type + if mime_type: + if 'quicktime' in mime_type: + mime_type = 'video/mp4' format, created = Format.objects.get_or_create(item=item) @@@ -375,11 -374,28 +374,29 @@@ subpipe = analyzer() analyzers_sub.append(subpipe) pipe = pipe | subpipe - + + default_grapher = self.get_grapher(self.default_grapher_id) + for size in self.default_grapher_sizes: + width = size.split('x')[0] + height = size.split('x')[1] + image_file = '.'.join([item.public_id, self.default_grapher_id, size.replace('x', '_'), 'png']) + path = self.cache_data.dir + os.sep + image_file + graph = default_grapher(width = int(width), height = int(height)) + graphers_sub.append({'graph' : graph, 'path': path}) + pipe = pipe | graph + pipe.run() + for grapher in graphers_sub: + grapher['graph'].watermark('timeside', opacity=.6, margin=(5,5)) + f = open(grapher['path'], 'w') + grapher['graph'].render(grapher['path']) + f.close() + + mime_type = mimetypes.guess_type(source)[0] ++ analysis = MediaItemAnalysis(item=item, name='MIME type', - analyzer_id='mime_type', unit='', value=mime_type) + analyzer_id='mime_type', unit='', value=item.mime_type) analysis.save() analysis = MediaItemAnalysis(item=item, name='Channels', analyzer_id='channels',