# HG changeset patch # User cavaliet # Date 1326474555 -3600 # Node ID 454bd3bd6ffd0b276a45c678d57655d95b17732d # Parent af6e9560593426f5920944d682cdf57ca07fa4c9 Debug api for annotation creation in embed player. diff -r af6e95605934 -r 454bd3bd6ffd src/ldt/ldt/api/ldt/handlers.py --- a/src/ldt/ldt/api/ldt/handlers.py Fri Jan 13 16:24:16 2012 +0100 +++ b/src/ldt/ldt/api/ldt/handlers.py Fri Jan 13 18:09:15 2012 +0100 @@ -165,7 +165,7 @@ for a in new_annotations: dur = str(a['end'] - a['begin']) begin = str(a['begin']) - new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date) + type_id, new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date) if not new_id: protect_instance(project) return rc.BAD_REQUEST @@ -175,7 +175,9 @@ unprotect_instance(content) add_annotation_to_stat(content, project, a['begin'], a['end']) protect_instance(content) - + + # We update the ids + a['type'] = type_id a['id'] = new_id # We save if there were added annotation diff -r af6e95605934 -r 454bd3bd6ffd src/ldt/ldt/ldt_utils/utils.py --- a/src/ldt/ldt/ldt_utils/utils.py Fri Jan 13 16:24:16 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/utils.py Fri Jan 13 18:09:15 2012 +0100 @@ -171,7 +171,7 @@ self.to_add = True # add( a['media'], a['type'], a['type_title, a[data], '', a['tags'], begin, dur, author, date) - def add(self, media, cutting_id, cutting_title, title, text, tags_list, begin, dur, author, date, view_id=None, color="16776960"): + def add(self, media, cutting_id, cutting_title, title, text, tags_list, begin, dur, author, date, view_id="0", color="2194379"): """ Add an annotation to a project. begin and dur must be strings. Default color is yellow. """ @@ -202,7 +202,8 @@ path_ensemble = lxml.etree.SubElement(path_content[0], 'ensemble') path_ensemble.set('id', 'g_' + generate_uuid()) path_ensemble.set('title', _('Personal cutting')) - path_ensemble.set('author', 'undefined') + path_ensemble.set('author', 'IRI') + path_ensemble.set('abstract', 'IRI') path_ensemble = [path_ensemble] #else: # path_ensemble = path_content[0].xpath('ensemble') @@ -264,7 +265,7 @@ tag_node = lxml.etree.SubElement(tags, 'tag') tag_node.text = tag - return id_annotation + return cutting_id, id_annotation def save(self): if self.to_add: