add interpretation datas
authorcavaliet
Mon, 03 Nov 2014 17:53:20 +0100
changeset 147 fe5e9fe9c29c
parent 146 404a0085badf
child 148 62e750c7ef85
add interpretation datas
src/spel/management/commands/generate_demonstrateur_data.py
--- a/src/spel/management/commands/generate_demonstrateur_data.py	Mon Nov 03 17:05:50 2014 +0100
+++ b/src/spel/management/commands/generate_demonstrateur_data.py	Mon Nov 03 17:53:20 2014 +0100
@@ -110,10 +110,14 @@
                 except:
                     created_tcin_ms = False
                 try:
+                    created_tcout_ms = int(line[24])
+                except:
+                    created_tcout_ms = False
+                try:
                     created_ctt_dur = int(line[25])
                 except:
                     created_ctt_dur = False
-                if content_id != "" and created_ctt_id != "" and created_tcin_ms and created_ctt_dur:
+                if content_id != "" and created_ctt_id != "" and created_tcin_ms and created_tcout_ms and created_ctt_dur:
                     if last_content_id != content_id:
                         last_content_id = content_id
                         count_content = 0
@@ -156,12 +160,17 @@
                         proj_data["annotations"] = []
                         for a in project_source_data["annotations"]:
                             #print "get content 12"
-                            if a["id"] in [pre_annot_id, annot_id, post_annot_id]:
-                                self.apply_exceptions(a)
+                            if (a["id"] in [pre_annot_id, annot_id, post_annot_id] and a["meta"]["id-ref"]!="interpretation") or (a["meta"]["id-ref"]=="interpretation" and created_tcin_ms<=a["begin"] and a["begin"]<=created_tcout_ms):
+                                #if a["meta"]["id-ref"]=="interpretation":
+                                #    print "AJOUT interpretation " + a["id"]
+                                if a["meta"]["id-ref"]!="interpretation":
+                                    self.apply_exceptions(a)
                                 temp_a = copy.deepcopy(a)
                                 b = temp_a["begin"]
                                 temp_a["begin"] = temp_a["begin"] - created_tcin_ms
                                 temp_a["end"] = temp_a["end"] - created_tcin_ms
+                                if a["meta"]["id-ref"]=="interpretation":
+                                    temp_a["end"] = min(temp_a["end"], created_ctt_dur)
                                 temp_a["media"] = created_ctt_id
                                 if temp_a["begin"] < 0:
                                     print created_ctt_id + " : " + temp_a["id"] + " : < 0 : serveur : " + str(b) + ", excel : " + str(tc_offset) + ", created_tcin_ms : " + str(created_tcin_ms)