equal
deleted
inserted
replaced
1 from datetime import datetime |
1 from datetime import datetime |
2 from django.utils.datastructures import SortedDict |
2 from django.utils.datastructures import SortedDict |
3 from ldt.ldt_utils.models import Content, Project |
3 from ldt.ldt_utils.models import Content |
4 from ldt.ldt_utils.utils import reduce_text_node |
4 from ldt.ldt_utils.utils import reduce_text_node |
5 import logging |
5 import logging |
6 import lxml.etree |
6 import lxml.etree |
7 import uuid |
7 import uuid |
8 |
8 |
148 element_media = content.iri_id |
148 element_media = content.iri_id |
149 element_color = element_node.attrib[u"color"] |
149 element_color = element_node.attrib[u"color"] |
150 |
150 |
151 element_title = reduce_text_node(element_node, "title/text()") |
151 element_title = reduce_text_node(element_node, "title/text()") |
152 element_description = reduce_text_node(element_node, "abstract/text()") |
152 element_description = reduce_text_node(element_node, "abstract/text()") |
153 element_twitter = reduce_text_node(element_node, "meta/twitter/text()") |
153 |
|
154 element_source_node_list = element_node.xpath("meta/source") |
|
155 |
|
156 if len(element_source_node_list) > 0: |
|
157 element_source_node = element_source_node_list[0] |
|
158 element_source = {"mimetype" :element_source_node.get(u'mimetype'), "url":element_source_node.get(u'url'), "content":reduce_text_node(element_source_node)} |
|
159 else: |
|
160 element_source = None |
154 |
161 |
155 element_audio_src = "" |
162 element_audio_src = "" |
156 element_audio_href = "" |
163 element_audio_href = "" |
157 res = element_node.xpath("audio") |
164 res = element_node.xpath("audio") |
158 if len(res) > 0: |
165 if len(res) > 0: |
224 "dc:created": decoupage_created, |
231 "dc:created": decoupage_created, |
225 "dc:modified": decoupage_modified, |
232 "dc:modified": decoupage_modified, |
226 } |
233 } |
227 } |
234 } |
228 |
235 |
229 if element_twitter: |
236 if element_source: |
230 new_annotation['meta']['twitter'] = element_twitter |
237 new_annotation['meta']['dc:source'] = element_source |
231 |
238 |
232 self.annotations_dict[element_id] = new_annotation |
239 self.annotations_dict[element_id] = new_annotation |
233 self.annotations_by_annotation_types[decoupage_id].append(new_annotation) |
240 self.annotations_by_annotation_types[decoupage_id].append(new_annotation) |
234 |
241 |
235 if not list_items: |
242 if not list_items: |