equal
deleted
inserted
replaced
71 |
71 |
72 ensembleids = [] |
72 ensembleids = [] |
73 |
73 |
74 for node in ensemblesnode.childNodes: |
74 for node in ensemblesnode.childNodes: |
75 if node.nodeType == xml.dom.Node.ELEMENT_NODE and node.tagName == "ensemble": |
75 if node.nodeType == xml.dom.Node.ELEMENT_NODE and node.tagName == "ensemble": |
76 id = node.getAttributeNS("id",None) |
76 id = node.getAttributeNS(None,u"id") |
77 if id not in ensembleids: |
77 if id not in ensembleids: |
78 ensembleids.append(id) |
78 ensembleids.append(id) |
79 |
79 |
80 if self.annotations is not None: |
80 if self.annotations is not None: |
81 newEnsemble = None |
81 newEnsemble = None |
106 res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con) |
106 res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con) |
107 if self.flatten: |
107 if self.flatten: |
108 src_video = res[0].getAttribute('src') |
108 src_video = res[0].getAttribute('src') |
109 self.videourl = os.path.basename(src_video) |
109 self.videourl = os.path.basename(src_video) |
110 res[0].setAttributeNS(None,'src', self.videourl) |
110 res[0].setAttributeNS(None,'src', self.videourl) |
111 self.duration = res[0].getAttributeNS(None, 'dur') |
111 self.duration = res[0].getAttributeNS(None, u'dur') |
112 |
112 |
113 f = open(path, "w") |
113 f = open(path, "w") |
114 try: |
114 try: |
115 xml.dom.ext.Print(doc, stream=f) |
115 xml.dom.ext.Print(doc, stream=f) |
116 finally: |
116 finally: |
128 def saveContent(self): |
128 def saveContent(self): |
129 #if 'http' in self.src: |
129 #if 'http' in self.src: |
130 # url = self.src |
130 # url = self.src |
131 #else: |
131 #else: |
132 # url = self.id + u"/" + os.path.basename(self.src) |
132 # url = self.id + u"/" + os.path.basename(self.src) |
133 content, self.created = Content.objects.get_or_create(iri_id=self.id, defaults = {'iriurl': self.src, 'title':self.title, 'description':self.desc, 'videopath': self.videopath}) |
133 content, self.created = Content.objects.get_or_create(iri_id=self.id, defaults = {'src':self.videourl, 'iriurl': self.src, 'title':self.title, 'description':self.desc, 'videopath': self.videopath}) |
134 if not self.created: |
134 if not self.created: |
135 content.iriurl = self.src |
135 content.iriurl = self.src |
136 content.title = self.title |
136 content.title = self.title |
137 content.description = self.desc |
137 content.description = self.desc |
138 content.save() |
138 content.save() |
264 con = xml.xpath.Context.Context(doc, 1, 1, None) |
264 con = xml.xpath.Context.Context(doc, 1, 1, None) |
265 |
265 |
266 #get author from file ldt |
266 #get author from file ldt |
267 result = xml.xpath.Evaluate("/iri/project", context=con) |
267 result = xml.xpath.Evaluate("/iri/project", context=con) |
268 for pnode in result: |
268 for pnode in result: |
269 author = pnode.getAttributeNS("user",None) |
269 author = pnode.getAttributeNS(None,u"user") |
270 if author: |
270 if author: |
271 self.author = unicode(author) |
271 self.author = unicode(author) |
272 break |
272 break |
273 |
273 |
274 result = xml.xpath.Evaluate("/iri/medias/media", context=con) |
274 result = xml.xpath.Evaluate("/iri/medias/media", context=con) |