]> git.parisson.com Git - telemeta.git/commitdiff
fix audio path
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 9 Dec 2010 15:02:40 +0000 (16:02 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 9 Dec 2010 15:02:40 +0000 (16:02 +0100)
FIXME: item delete

telemeta/models/core.py
telemeta/web/base.py

index 02c48b5b8cb7c3439839d4edbb25a96b42dd9512..98572b9f5348f449fe0c3a28deaa18b04b9e4bcf 100644 (file)
@@ -231,7 +231,7 @@ class EnhancedQuerySet(models.query.QuerySet):
         for related in objects:
             i = 0
             while i < ii:
-                ids = [v[0] for v in self[i:i + CHUNK].values_list('pk')]
+                ids = [v[0].values_list('pk') for v in self[i:i + CHUNK]]
                 filter = {related.field.name + '__pk__in': ids}
                 q = related.model.objects.filter(**filter)
                 if isinstance(related.field, WeakForeignKey):
index 302bf7384675569a0bb629a8942b68d89703fd14..569ebb814e5e71d7ae7c9470d2655d71be3a1e28 100644 (file)
@@ -122,12 +122,12 @@ class WebView:
         if request.REQUEST.has_key('grapher_id'):
             grapher_id = request.REQUEST['grapher_id']
         else:
-            grapher_id = 'waveform_awdio'
+            grapher_id = 'waveform'
         
-        file = public_id + '.xml'
+        analyze_file = public_id + '.xml'
         
-        if self.cache.exists(file):
-            analyzers = self.cache.read_analyzer_xml(file)
+        if self.cache.exists(analyze_file):
+            analyzers = self.cache.read_analyzer_xml(analyze_file)
             if not item.approx_duration:
                 for analyzer in analyzers:
                     if analyzer['id'] == 'duration':
@@ -142,30 +142,27 @@ class WebView:
             analyzers_sub = []
             if item.file:
                 decoder  = timeside.decoder.FileDecoder(item.file.path)
-                self.pipe = decoder
+                pipe = decoder
                 for analyzer in self.analyzers:
                     subpipe = analyzer()
                     analyzers_sub.append(subpipe)
-                    self.pipe = self.pipe | subpipe
-                self.pipe.run()
+                    pipe = pipe | subpipe
+                pipe.run()
                 
                 for analyzer in analyzers_sub:
-                    if item.file:
-                        value = analyzer.result()
-                        if analyzer.id() == 'duration':
-                            approx_value = int(round(value))
-                            item.approx_duration = approx_value
-                            item.save()
-                            value = datetime.timedelta(0,value)
-                    else:
-                        value = 'N/A'
-
+                    value = analyzer.result()
+                    if analyzer.id() == 'duration':
+                        approx_value = int(round(value))
+                        item.approx_duration = approx_value
+                        item.save()
+                        value = datetime.timedelta(0,value)
+                    
                     analyzers.append({'name':analyzer.name(),
                                       'id':analyzer.id(),
                                       'unit':analyzer.unit(),
                                       'value':str(value)})
                 
-            self.cache.write_analyzer_xml(analyzers, file)
+            self.cache.write_analyzer_xml(analyzers, analyze_file)
         
         return render(request, template, 
                     {'item': item, 'export_formats': formats, 
@@ -226,7 +223,7 @@ class WebView:
         file = public_id + '.' + encoder.file_extension()
         
         item = MediaItem.objects.get(public_id=public_id)
-        audio = os.path.join(os.path.dirname(__file__), item.file.path)
+        audio = item.file.path
         decoder = timeside.decoder.FileDecoder(audio)
 
         if decoder.format() == mime_type: