]> git.parisson.com Git - telemeta.git/commitdiff
dont't use timeside item use for now (goto diadems branch)
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 28 Apr 2016 00:40:33 +0000 (02:40 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 28 Apr 2016 00:40:33 +0000 (02:40 +0200)
telemeta/views/item.py

index c84ed33a3b223bd4f21ec8fd91c3dd604faab2c4..a1507a64d980512856fab6b5d7b20bc46cffaccb 100644 (file)
@@ -36,8 +36,6 @@ class ItemBaseMixin(TelemetaBaseMixin):
     analyzers = timeside.core.processor.processors(timeside.core.api.IAnalyzer)
     value_analyzers = timeside.core.processor.processors(timeside.core.api.IValueAnalyzer)
 
-
-
     export_enabled = getattr(settings, 'TELEMETA_DOWNLOAD_ENABLED', True)
     export_formats = getattr(settings, 'TELEMETA_DOWNLOAD_FORMATS', ('mp3', 'wav'))
     default_grapher_id = getattr(settings, 'TIMESIDE_DEFAULT_GRAPHER_ID', ('waveform_simple'))
@@ -238,20 +236,20 @@ class ItemView(ItemBaseMixin):
         mime_type = 'image/png'
 
         source, source_type = item.get_source()
-        if source:
-            ts_item, c = ts.models.Item.objects.get_or_create(**{source_type: source})
-            if c:
-                ts_item.title = item.title
-                ts_item.save()
-
-        ts_grapher, c = ts.models.Processor.objects.get_or_create(pid=grapher_id)
-        ts_preset, c = ts.models.Preset.objects.get_or_create(processor=ts_grapher,
-                                                              parameters={'width': width, 'height': height})
-        ts_experience = ts_preset.get_single_experience()
-        ts_selection = ts_item.get_single_selection()
-        ts_task, c = ts.models.Task.objects.get_or_create(experience=ts_experience,
-                                                   selection=ts_selection)
-        ts_task.run()
+        if source:
+            ts_item, c = ts.models.Item.objects.get_or_create(**{source_type: source})
+            if c:
+                ts_item.title = item.title
+                ts_item.save()
+        #
+        ts_grapher, c = ts.models.Processor.objects.get_or_create(pid=grapher_id)
+        ts_preset, c = ts.models.Preset.objects.get_or_create(processor=ts_grapher,
+                                                              parameters={'width': width, 'height': height})
+        ts_experience = ts_preset.get_single_experience()
+        ts_selection = ts_item.get_single_selection()
+        ts_task, c = ts.models.Task.objects.get_or_create(experience=ts_experience,
+                                                   selection=ts_selection)
+        ts_task.run()
 
         grapher = self.get_grapher(grapher_id)
 
@@ -718,11 +716,11 @@ class ItemDetailView(ItemViewMixin, DetailView):
 
         # Corresponding TimeSide Item
         source, source_type = item.get_source()
-        if source:
-            ts_item, c = ts.models.Item.objects.get_or_create(**{source_type: source})
-            if c:
-                ts_item.title = item.title
-                ts_item.save()
+        if source:
+            ts_item, c = ts.models.Item.objects.get_or_create(**{source_type: source})
+            if c:
+                ts_item.title = item.title
+                ts_item.save()
 
         self.item_analyze(item)
 
@@ -761,10 +759,10 @@ class ItemDetailView(ItemViewMixin, DetailView):
         context['format'] = item_format
         context['private_extra_types'] = private_extra_types.values()
         context['site'] = 'http://' + Site.objects.all()[0].name
-        if ts_item:
-            context['ts_item_id'] = ts_item.pk
-        else:
-            context['ts_item_id'] = None
+        if ts_item:
+            context['ts_item_id'] = ts_item.pk
+        else:
+            context['ts_item_id'] = None
 
         return context