Merge pull request #4 from UrielMaD/xmp_feature

xmp feature
This commit is contained in:
Uriel Martinez 2020-12-25 21:40:23 -06:00 committed by GitHub
commit 5adffb5e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1320,23 +1320,22 @@ class Image:
def getxmp(self): def getxmp(self):
for segment, content in self.applist: for segment, content in self.applist:
if segment == 'APP1': if segment == 'APP1':
marker, xmp_tags = content.rsplit(b'\x00', 1) marker, xmp_tags = content.rsplit(b'\x00', 1)
#print(marker) #print(marker)
print(xmp_tags) print(xmp_tags)
if marker == b'http://ns.adobe.com/xap/1.0/': if marker == b'http://ns.adobe.com/xap/1.0/':
print(xmp_tags.decode('latin-1')) print(xmp_tags.decode('latin-1'))
root = ET.fromstring(xmp_tags) root = ET.fromstring(xmp_tags)
print(root) print(root)
for element in root.findall('.//'): for element in root.findall('.//'):
print(element.tag.split('}')[1]) print(element.tag.split('}')[1])
print(element.attrib) print(element.attrib)
for child, value in element.attrib.items(): for child, value in element.attrib.items():
print(child.split('}')[1] + ": " + value) print(child.split('}')[1] + ": " + value)
return root
return root
def getim(self): def getim(self):
""" """