# HG changeset patch # User cavaliet # Date 1415033600 -3600 # Node ID fe5e9fe9c29cc21de0ee744b6855b42f451fe4e9 # Parent 404a0085badf23e46ec560382118b479d703c0b6 add interpretation datas diff -r 404a0085badf -r fe5e9fe9c29c 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)