# HG changeset patch # User cavaliet # Date 1394545333 -3600 # Node ID 00a8a44543abb08bdf535bf3eefe53b583106f1d # Parent b425f929987da92864d2dc288cd8b75cd40e40f0 clean import and tag management diff -r b425f929987d -r 00a8a44543ab src/spel/management/commands/loadspeldata.py --- a/src/spel/management/commands/loadspeldata.py Mon Mar 10 18:26:42 2014 +0100 +++ b/src/spel/management/commands/loadspeldata.py Tue Mar 11 14:42:13 2014 +0100 @@ -94,7 +94,7 @@ iriurl=ctt_id+u"/"+ctt_id+u".iri", media_obj=media, title=json_data["meta"]["dc:title"], - duration=json_data["medias"][0]["meta"]["duration"], + duration=int(json_data["medias"][0]["meta"]["duration"]), content_creation_date = json_data["meta"]["dc:created"]) content.is_public = True # Get content front projet @@ -120,16 +120,18 @@ tags_label_id = {} for a in json_data["annotations"]: # "content": { "data": { "modalites_sceniques": "costumes,décors",... } } - if type(a["content"]["data"]) == type(dict()): + if "content" in a and "data" in a["content"] and type(a["content"]["data"]) == type(dict()): annot_tags = [] desc = "" + title = "" # Build tags for k,v in a["content"]["data"].iteritems(): - if k!="commentaire" and k!="description": + if k!="commentaire" and k!="description" and k!="titre": v = v.split(",") for val in v: - tag_label = k + u": " + val.strip() - if val.strip()!="": + val = val.strip() + tag_label = k + u": " + val + if val!="": if not tag_label in tags_label_id: tags_label_id[tag_label] = generate_uuid() tags_id_label[tags_label_id[tag_label]] = tag_label @@ -137,8 +139,10 @@ #logger.debug(tags_label_id[tag_label] + " = " + tags_id_label[tags_label_id[tag_label]]) proj_data["tags"].append({"meta": { "dc:title": tag_label }, "id": tags_label_id[tag_label] }) annot_tags.append({"id-ref": tags_label_id[tag_label] }) - else: + elif k=="commentaire" or k=="description": desc = v + elif k=="titre": + title = v # Build annotation with needed fields proj_data["annotations"].append({ "content": { @@ -147,7 +151,7 @@ # "img": { # "src": "" # }, - "title": a["id"], + "title": title, # "polemics": [ ], }, "begin": a["begin"], diff -r b425f929987d -r 00a8a44543ab src/spel/static/spel/css/spel.css --- a/src/spel/static/spel/css/spel.css Mon Mar 10 18:26:42 2014 +0100 +++ b/src/spel/static/spel/css/spel.css Tue Mar 11 14:42:13 2014 +0100 @@ -49,4 +49,10 @@ /*border-style: solid none;*/ border-width: 1px 0; margin: 3px 0; +} +.searched-annot .list-inline { + margin-left: 0px; +} +.annot-tag{ + background-color: #FFF; } \ No newline at end of file diff -r b425f929987d -r 00a8a44543ab src/spel/templates/partial/spel_annotations.html --- a/src/spel/templates/partial/spel_annotations.html Mon Mar 10 18:26:42 2014 +0100 +++ b/src/spel/templates/partial/spel_annotations.html Tue Mar 11 14:42:13 2014 +0100 @@ -4,13 +4,18 @@
{{ nb_annotations }} annotation(s) trouvée(s) sur {{ nb_contents }} vidéo(s)
{% for res in results %} {% for s in res.list %} -{{ res.content.title }} / {{ s.start_ts|str_duration }} - {{ s.start_ts|add:s.duration|str_duration }} / {{ s.cutting_id }}
-{{ s.tags|get_tags:"modscen_and_perso" }}
+{{ s.tags|get_tags:"modscen_and_perso"|join:', ' }}
{{ s.tags|get_tags:"ref_text_2" }}
-{{ s.abstract }}
-{{ s.tags|get_tags:"type_inter" }}
+{{ s.tags|get_tags:"ref_text"|join:', ' }}
+{% if s.title != "" %}{{ s.title }} : {% endif %}{{ s.abstract }}
+