script/lib/iri_tweet/export_twitter_alchemy.py
changeset 31 93fd53a97d6d
parent 27 c3ea041c6cde
child 39 c5d7dd0ec4e1
equal deleted inserted replaced
30:0f1a2764ad18 31:93fd53a97d6d
   197                     
   197                     
   198                     if file_type == "ldt":
   198                     if file_type == "ldt":
   199                         media_nodes = root.xpath("//media")
   199                         media_nodes = root.xpath("//media")
   200                         if len(media_nodes) > 0:
   200                         if len(media_nodes) > 0:
   201                             media = media_nodes[0]
   201                             media = media_nodes[0]
   202                             annotations_node = root.find(u"annotations")
   202                         annotations_node = root.find(u"annotations")
   203                             if annotations_node is None:
   203                         if annotations_node is None:
   204                                 annotations_node = etree.SubElement(root, u"annotations")
   204                             annotations_node = etree.SubElement(root, u"annotations")
   205                             content_node = annotations_node.find(u"content")
   205                         content_node = annotations_node.find(u"content")
   206                             if content_node is None:
   206                         if content_node is None:
   207                                 content_node = etree.SubElement(annotations_node,u"content", id=media["id"])
   207                             content_node = etree.SubElement(annotations_node,u"content", id=media.get(u"id"))
   208                             ensemble_parent = content_node
   208                         ensemble_parent = content_node
   209                     elif file_type == "iri":
   209                     elif file_type == "iri":
   210                         body_node = root.find(u"body")
   210                         body_node = root.find(u"body")
   211                         if body_node is None:
   211                         if body_node is None:
   212                             body_node = etree.SubElement(root, u"body")
   212                             body_node = etree.SubElement(root, u"body")
   213                         ensembles_node = body_node.find(u"ensembles")
   213                         ensembles_node = body_node.find(u"ensembles")