]> git.parisson.com Git - telemeta.git/commitdiff
Merge branch 'dev' into crem
authorGuillaume Pellerin <yomguy@parisson.com>
Fri, 14 Feb 2014 20:27:31 +0000 (21:27 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Fri, 14 Feb 2014 20:27:31 +0000 (21:27 +0100)
Conflicts:
example/sandbox/settings.py
telemeta/urls.py
telemeta/views/item.py

1  2 
example/sandbox/settings.py
telemeta/templates/telemeta/base.html
telemeta/views/core.py
telemeta/views/item.py

index 5bd692c6ae5926b84563b014b48a24edf66a5b5a,c1bbc2eab765d437d3a81277a02a06a9e8687f30..c1e5738dd36292238391f8f6973cfe9d99d38762
@@@ -165,3 -164,6 +164,6 @@@ LOGIN_REDIRECT_URL = '/desk/lists/
  
  EMAIL_HOST = 'localhost'
  DEFAULT_FROM_EMAIL = 'webmaster@parisson.com'
 -TIMESIDE_AUTO_ZOOM = True
+ TIMESIDE_DEFAULT_GRAPHER_ID = 'waveform_centroid'
++TIMESIDE_AUTO_ZOOM = False
Simple merge
Simple merge
index f2f0cbe6c308fe7eafbd2f4982737e9da5d1129f,501f886b8dc8cbeb3703cff3981160c8ad2d6c77..b81cf6366d2a93c312ef244fd81b2488ccd10b6f
@@@ -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)
          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)
  
                      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',