]> git.parisson.com Git - telemeta.git/commitdiff
Preliminary work on timseside.server use
authorThomas Fillon <thomas@parisson.com>
Wed, 13 Apr 2016 17:00:32 +0000 (19:00 +0200)
committerThomas Fillon <thomas@parisson.com>
Wed, 13 Apr 2016 17:00:32 +0000 (19:00 +0200)
telemeta/templates/telemeta/mediaitem_detail.html
telemeta/views/item.py

index 0f67a33be64cd0505341b8d2f71ad6630800c740..ad3b973fe1223e282c21cf5f70884665802a7dde 100644 (file)
                 </tr>
             </table>
         </div>
+
         <!--</div>-->
 
         {% if audio_export_enabled or perms.telemeta.can_download_all_items or user.is_superuser %}
                     <img src="{{ STATIC_URL }}telemeta/images/{{ format.extension }}.png" style="vertical-align:middle" alt="{{ format.extension }}" /></a>
                 {% endfor %}
         </div>
+       {% block DIADEMS %}
+       <a href="{% url "timeside-item-diadems" ts_item_id %}">
+         <button type="button" class="btn btn-primary" style="float:left;margin-top:0.5em;margin-bottom:1em;border-color: #ffffff; ">
+            <b>DIADEMS</b>
+         </button>
+       </a>      
+       {% endblock DIADEMS %}
+
+
+
         {% endif %}
 
     </div>
     </a>
     {% endblock dublincore %}
 
-    {% block TimeSide %}
-    <a href="{% url "timeside-item-detail" ts_item_id %}">
-      <button type="button" class="btn btn-default" style="float:left;margin-top:0.5em;margin-bottom:1em">
-        TimeSide
-      </button>
-    {% endblock TimeSide %}
-    </a>
-
-
 {% endif %}
 
 
index 640a8053333a874de77cf8671ed1d44c1753003e..c84ed33a3b223bd4f21ec8fd91c3dd604faab2c4 100644 (file)
@@ -25,8 +25,7 @@
 from telemeta.views.core import *
 from telemeta.views.marker import *
 import timeside.core
-from timeside.server import models as TS_models
-import timeside.server.models as TS_models
+import timeside.server as ts
 
 
 class ItemBaseMixin(TelemetaBaseMixin):
@@ -237,6 +236,23 @@ class ItemView(ItemBaseMixin):
 
         item = MediaItem.objects.get(public_id=public_id)
         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()
+
         grapher = self.get_grapher(grapher_id)
 
         if grapher.id() != grapher_id:
@@ -612,9 +628,6 @@ class ItemDetailView(ItemViewMixin, DetailView):
             source, _ = item.get_source()
 
             if source:
-                print '***************************'
-                print source
-                print '***************************'
 
                 decoder = timeside.core.get_processor('file_decoder')(source)
                 pipe = decoder = timeside.core.get_processor('file_decoder')(source)
@@ -706,7 +719,7 @@ 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})
+            ts_item, c = ts.models.Item.objects.get_or_create(**{source_type: source})
             if c:
                 ts_item.title = item.title
                 ts_item.save()