]> git.parisson.com Git - timeside.git/commitdiff
Export Segment Result to Elan: only one tier in the annotation
authorThomas Fillon <thomas@parisson.com>
Fri, 27 Mar 2015 08:35:43 +0000 (09:35 +0100)
committerThomas Fillon <thomas@parisson.com>
Fri, 27 Mar 2015 08:35:43 +0000 (09:35 +0100)
timeside/core/analyzer.py
timeside/server/serializers.py

index c905c8cd9e7af0e67382cce96273aadc11acc2c2..0b2b89bb4b9aad4ce5ec366c25606f7d609a6d4f 100644 (file)
@@ -933,17 +933,23 @@ class SegmentLabelObject(LabelObject, SegmentObject):
         elan = pympi.Elan.Eaf(author='TimeSide')
         if media_file is not None:
             elan.add_linked_file(media_file)
-        for label in self.label_metadata.label.values():
-            elan.add_tier(label)
+        #for label in self.label_metadata.label.values():
+        tier_id = 'Analysis'
+        elan.add_tier(tier_id)
+         
         for n in xrange(len(self.label)):
-            label_id = self.label[n]
-            tier_id = self.label_metadata.label[unicode(label_id)]
+            label_id = self.label_metadata.label[unicode(self.label[n])]
+            #tier_id = self.label_metadata.label[unicode(label_id)]
             start = self.time[n]
+            if start < 0:
+                # TODO: check why start could be negative
+                start = 0
             end = start + self.duration[n]
             # Time has to be converted in millisecond integer values
             elan.add_annotation(id_tier=tier_id,
                                 start=int(start*1000),
-                                end=int(end*1000))
+                                end=int(end*1000),
+                                value=label_id)
         
         elan.to_file(elan_file)
 
index 1b18c2bd3b62faa01039faa336752ed235347168..9205610cd76d247f2ad80659a4bca4843ca760cb 100644 (file)
@@ -66,7 +66,7 @@ class PresetSerializer(serializers.ModelSerializer):
 
     def validate_parameters(self, attrs, source):
 
-        import timeside
+        import timeside.core
         proc = timeside.core.get_processor(attrs['processor'].pid)
         if proc.type == 'analyzer':
             processor = proc()