Beta fix for Digikam reading XMP

This commit is contained in:
Rhet Turnbull
2021-01-18 08:55:44 -08:00
parent db430173b5
commit 3799594473
2 changed files with 101 additions and 79 deletions

View File

@@ -1,3 +1,3 @@
""" version info """ """ version info """
__version__ = "0.39.21" __version__ = "0.39.22"

View File

@@ -105,37 +105,44 @@
% endif % endif
</%def> </%def>
<%def name="face_regions(photo)"> <%def name="mwg_face_regions(photo)">
% if photo.face_info: % if photo.face_info:
<mwg-rs:Regions rdf:parseType="Resource"> <mwg-rs:Regions rdf:parseType="Resource">
<mwg-rs:AppliedToDimensions stDim:w=${photo.width} stDim:h=${photo.height} stDim:unit="pixel"/> <mwg-rs:AppliedToDimensions rdf:parseType="Resource">
<stDim:unit>pixel</stDim:unit>
</mwg-rs:AppliedToDimensions>
<mwg-rs:RegionList> <mwg-rs:RegionList>
<rdf:Bag> <rdf:Bag>
% for face in photo.face_info: % for face in photo.face_info:
<rdf:li> <rdf:li rdf:parseType="Resource">
<rdf:Description <mwg-rs:Area rdf:parseType="Resource">
mwg-rs:Rotation="${face.roll}" <stArea:h>${'{0:.6f}'.format(face.mwg_rs_area.h)}</stArea:h>
mwg-rs:Name="${face.name}" <stArea:w>${'{0:.6f}'.format(face.mwg_rs_area.w)}</stArea:w>
mwg-rs:Type="Face"> <stArea:x>${'{0:.6f}'.format(face.mwg_rs_area.x)}</stArea:x>
<mwg-rs:Area <stArea:y>${'{0:.6f}'.format(face.mwg_rs_area.y)}</stArea:y>
stArea:h="${'{0:.6f}'.format(face.mwg_rs_area.h)}" <stArea:unit>normalized</stArea:unit>
stArea:w="${'{0:.6f}'.format(face.mwg_rs_area.w)}" </mwg-rs:Area>
stArea:x="${'{0:.6f}'.format(face.mwg_rs_area.x)}" <mwg-rs:Name>${face.name}</mwg-rs:Name>
stArea:y="${'{0:.6f}'.format(face.mwg_rs_area.y)}" <mwg-rs:Rotation>${face.roll}</mwg-rs:Rotation>
stArea:unit="normalized"/> <mwg-rs:Type>Face</mwg-rs:Type>
</rdf:Description>
</rdf:li> </rdf:li>
% endfor % endfor
</rdf:Bag> </rdf:Bag>
</mwg-rs:RegionList> </mwg-rs:RegionList>
</mwg-rs:Regions> </mwg-rs:Regions>
% endif
</%def>
<%def name="mpri_face_regions(photo)">
% if photo.face_info:
<MP:RegionInfo rdf:parseType="Resource"> <MP:RegionInfo rdf:parseType="Resource">
<MPRI:Regions> <MPRI:Regions>
<rdf:Bag> <rdf:Bag>
% for face in photo.face_info: % for face in photo.face_info:
<rdf:li <rdf:li rdf:parseType="Resource">
MPReg:Rectangle="${'{0:.6f}'.format(face.mpri_reg_rect.x)}, ${'{0:.6f}'.format(face.mpri_reg_rect.y)}, ${'{0:.6f}'.format(face.mpri_reg_rect.h)}, ${'{0:.6f}'.format(face.mpri_reg_rect.w)}" <MPReg:PersonDisplayName>${face.name}</MPReg:PersonDisplayName>
MPReg:PersonDisplayName="${face.name}"/> <MPReg:Rectangle>${'{0:.6f}'.format(face.mpri_reg_rect.x)}, ${'{0:.6f}'.format(face.mpri_reg_rect.y)}, ${'{0:.6f}'.format(face.mpri_reg_rect.h)}, ${'{0:.6f}'.format(face.mpri_reg_rect.w)}</MPReg:Rectangle>
</rdf:li>
% endfor % endfor
</rdf:Bag> </rdf:Bag>
</MPRI:Regions> </MPRI:Regions>
@@ -143,6 +150,8 @@
% endif % endif
</%def> </%def>
<?xpacket begin="${"\uFEFF"}" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="osxphotos ${version}"> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="osxphotos ${version}">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" <rdf:Description rdf:about=""
@@ -154,35 +163,48 @@
${dc_subject(subjects)} ${dc_subject(subjects)}
${dc_datecreated(photo.date)} ${dc_datecreated(photo.date)}
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="" <rdf:Description rdf:about=""
xmlns:Iptc4xmpExt='http://iptc.org/std/Iptc4xmpExt/2008-02-29/'> xmlns:Iptc4xmpExt='http://iptc.org/std/Iptc4xmpExt/2008-02-29/'>
${iptc_personinimage(persons)} ${iptc_personinimage(persons)}
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="" <rdf:Description rdf:about=""
xmlns:digiKam='http://www.digikam.org/ns/1.0/'> xmlns:digiKam='http://www.digikam.org/ns/1.0/'>
${dk_tagslist(keywords)} ${dk_tagslist(keywords)}
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="" <rdf:Description rdf:about=""
xmlns:xmp='http://ns.adobe.com/xap/1.0/'> xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
${adobe_createdate(photo.date)} ${adobe_createdate(photo.date)}
${adobe_modifydate(photo.date)} ${adobe_modifydate(photo.date)}
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="" <rdf:Description rdf:about=""
xmlns:exif='http://ns.adobe.com/exif/1.0/'> xmlns:exif='http://ns.adobe.com/exif/1.0/'>
${gps_info(*photo.location)} ${gps_info(*photo.location)}
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about='' <rdf:Description rdf:about=''
xmlns:tiff='http://ns.adobe.com/tiff/1.0/'> xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
${orientation(photo.orientation)} ${orientation(photo.orientation)}
</rdf:Description> </rdf:Description>
<rdf:Description rdf:about="" <rdf:Description rdf:about=""
xmlns:mwg-rs="http://www.metadataworkinggroup.com/schemas/regions/" xmlns:mwg-rs="http://www.metadataworkinggroup.com/schemas/regions/"
xmlns:stArea="http://ns.adobe.com/xmp/sType/Area#" xmlns:stArea="http://ns.adobe.com/xmp/sType/Area#"
xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#" xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#">
${mwg_face_regions(photo)}
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:MP="http://ns.microsoft.com/photo/1.2/" xmlns:MP="http://ns.microsoft.com/photo/1.2/"
xmlns:MPRI="http://ns.microsoft.com/photo/1.2/t/RegionInfo#" xmlns:MPRI="http://ns.microsoft.com/photo/1.2/t/RegionInfo#"
xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#"> xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#">
${face_regions(photo)} ${mpri_face_regions(photo)}
</rdf:Description> </rdf:Description>
</rdf:RDF> </rdf:RDF>
</x:xmpmeta> </x:xmpmeta>
<?xpacket end="w"?>