Skip to content

Commit

Permalink
Small dependency updates + additional test (#14)
Browse files Browse the repository at this point in the history
* Update to current Gradle & AGP

* Added a unit test that actually triggers XMPNormalizer.tweakOldXMP()

* Increase patch version
  • Loading branch information
StefanOltmann authored Dec 2, 2023
1 parent 8af2a88 commit d3bc7e6
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 81 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It's part of [Ashampoo Photos](https://ashampoo.com/photos).
## Installation

```
implementation("com.ashampoo:xmpcore:0.2.1")
implementation("com.ashampoo:xmpcore:0.2.2")
```

## How to use
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework

plugins {
kotlin("multiplatform") version "1.9.21"
id("com.android.library") version "7.4.2"
id("com.android.library") version "8.0.2"
id("maven-publish")
id("signing")
id("io.gitlab.arturbosch.detekt") version "1.23.3"
Expand All @@ -22,7 +22,7 @@ repositories {

val productName = "Ashampoo XMP Core"

val ktorVersion: String = "2.3.5"
val ktorVersion: String = "2.3.6"
val xmlUtilVersion: String = "0.86.2"

description = productName
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 3 additions & 2 deletions src/commonMain/kotlin/com/ashampoo/xmp/XMPNormalizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ internal object XMPNormalizer {

if (checkUUIDFormat(nameStr)) {

// move UUID to xmpMM:InstanceID and remove it from the root node
/* move UUID to xmpMM:InstanceID and remove it from the root node */
val path = expandXPath(XMPConst.NS_XMP_MM, "InstanceID")
val idNode = XMPNodeUtils.findNode(tree, path, true, null)

if (idNode == null)
throw XMPException("Failure creating xmpMM:InstanceID", XMPError.INTERNALFAILURE)

idNode.options = PropertyOptions() // Clobber any existing xmpMM:InstanceID.
/* Clobber any existing xmpMM:InstanceID */
idNode.options = PropertyOptions()
idNode.value = "uuid:$nameStr"
idNode.removeChildren()
idNode.removeQualifiers()
Expand Down
5 changes: 5 additions & 0 deletions src/commonTest/kotlin/com/ashampoo/xmp/RewriteXmpTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ class RewriteXmpTest {

companion object {

/*
* Note: sample_100.xml is the only one that
* triggers XMPNormalizer.tweakOldXMP()
*/

const val TEST_PHOTO_COUNT = 100

private const val RESOURCE_PATH: String = "src/commonTest/resources/com/ashampoo/xmp"
Expand Down
86 changes: 53 additions & 33 deletions src/commonTest/resources/com/ashampoo/xmp/sample_100.xmp
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:MY="http://ns.mylollc.com/MyloEdit/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
exif:DateTimeOriginal="2023-07-03T10:24:16.000"
exif:SubSecTime="0"
exif:SubSecTimeOriginal="0"
exif:SubSecTimeDigitized="0"
xmp:CreateDate="2023-07-03T10:24:16.000"
xmp:ModifyDate="2023-07-03T10:24:16.000"
xmp:MetadataDate="2023-07-03T08:38:51.741Z"
xmp:Rating="1"
MY:DateRangeStart="2023-07-03T10:24:16.000"
MY:DateRangeEnd="2023-07-03T10:24:16.000"
MY:DateRangeScope=""
MY:Undated="false"
MY:flag="false"
MY:processVersion="1"
MY:MetadataDate="2023-07-03T08:38:51.741Z"
xmpMM:DocumentID="F4B0CBDE-3B21-46AB-BAD0-9BEA764E84D9"
xmpMM:OriginalDocumentID="F4B0CBDE-3B21-46AB-BAD0-9BEA764E84D9"
xmpMM:InstanceID="xmp.iid:6E5C4F82-0EAB-4EE1-9AB3-0748412A6A85">
<dc:subject>
<rdf:Bag>
<rdf:li>test</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.27'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about='uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b'
xmlns:MicrosoftPhoto='http://ns.microsoft.com/photo/1.0'>
<MicrosoftPhoto:DateAcquired>2013-09-01T10:58:46.904</MicrosoftPhoto:DateAcquired>
<MicrosoftPhoto:LastKeywordXMP>
<rdf:Bag>
<rdf:li>свадьба Алла+ Эльдар</rdf:li>
</rdf:Bag>
</MicrosoftPhoto:LastKeywordXMP>
</rdf:Description>

<rdf:Description rdf:about='uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b'
xmlns:dc='http://purl.org/dc/elements/1.1/'>
<dc:subject>
<rdf:Bag>
<rdf:li>свадьба Алла+ Эльдар</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>

<rdf:Description rdf:about='uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b'
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
<xmp:Rating>3</xmp:Rating>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
























<?xpacket end='w'?>
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,23 @@
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.3">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:MY="http://ns.mylollc.com/MyloEdit/"
xmlns:MicrosoftPhoto_1_="http://ns.microsoft.com/photo/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
<MY:DateRangeEnd>2023-07-03T10:24:16.000</MY:DateRangeEnd>
<MY:DateRangeScope/>
<MY:DateRangeStart>2023-07-03T10:24:16.000</MY:DateRangeStart>
<MY:MetadataDate>2023-07-03T08:38:51.741Z</MY:MetadataDate>
<MY:Undated>false</MY:Undated>
<MY:flag>false</MY:flag>
<MY:processVersion>1</MY:processVersion>
<MicrosoftPhoto_1_:DateAcquired>2013-09-01T10:58:46.904</MicrosoftPhoto_1_:DateAcquired>
<MicrosoftPhoto_1_:LastKeywordXMP>
<rdf:Bag>
<rdf:li>свадьба Алла+ Эльдар</rdf:li>
</rdf:Bag>
</MicrosoftPhoto_1_:LastKeywordXMP>
<dc:subject>
<rdf:Bag>
<rdf:li>test</rdf:li>
<rdf:li>свадьба Алла+ Эльдар</rdf:li>
</rdf:Bag>
</dc:subject>
<exif:DateTimeOriginal>2023-07-03T10:24:16.000</exif:DateTimeOriginal>
<exif:SubSecTime>0</exif:SubSecTime>
<exif:SubSecTimeDigitized>0</exif:SubSecTimeDigitized>
<exif:SubSecTimeOriginal>0</exif:SubSecTimeOriginal>
<xmp:CreateDate>2023-07-03T10:24:16.000</xmp:CreateDate>
<xmp:MetadataDate>2023-07-03T08:38:51.741Z</xmp:MetadataDate>
<xmp:ModifyDate>2023-07-03T10:24:16.000</xmp:ModifyDate>
<xmp:Rating>1</xmp:Rating>
<xmpMM:DocumentID>F4B0CBDE-3B21-46AB-BAD0-9BEA764E84D9</xmpMM:DocumentID>
<xmpMM:InstanceID>xmp.iid:6E5C4F82-0EAB-4EE1-9AB3-0748412A6A85</xmpMM:InstanceID>
<xmpMM:OriginalDocumentID>F4B0CBDE-3B21-46AB-BAD0-9BEA764E84D9</xmpMM:OriginalDocumentID>
<xmp:Rating>3</xmp:Rating>
<xmpMM:InstanceID>uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b</xmpMM:InstanceID>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,21 @@
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.3">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:MY="http://ns.mylollc.com/MyloEdit/"
xmlns:MicrosoftPhoto_1_="http://ns.microsoft.com/photo/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
MY:DateRangeEnd="2023-07-03T10:24:16.000"
MY:DateRangeScope=""
MY:DateRangeStart="2023-07-03T10:24:16.000"
MY:MetadataDate="2023-07-03T08:38:51.741Z"
MY:Undated="false"
MY:flag="false"
MY:processVersion="1"
exif:DateTimeOriginal="2023-07-03T10:24:16.000"
exif:SubSecTime="0"
exif:SubSecTimeDigitized="0"
exif:SubSecTimeOriginal="0"
xmp:CreateDate="2023-07-03T10:24:16.000"
xmp:MetadataDate="2023-07-03T08:38:51.741Z"
xmp:ModifyDate="2023-07-03T10:24:16.000"
xmp:Rating="1"
xmpMM:DocumentID="F4B0CBDE-3B21-46AB-BAD0-9BEA764E84D9"
xmpMM:InstanceID="xmp.iid:6E5C4F82-0EAB-4EE1-9AB3-0748412A6A85"
xmpMM:OriginalDocumentID="F4B0CBDE-3B21-46AB-BAD0-9BEA764E84D9">
MicrosoftPhoto_1_:DateAcquired="2013-09-01T10:58:46.904"
xmp:Rating="3"
xmpMM:InstanceID="uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b">
<MicrosoftPhoto_1_:LastKeywordXMP>
<rdf:Bag>
<rdf:li>свадьба Алла+ Эльдар</rdf:li>
</rdf:Bag>
</MicrosoftPhoto_1_:LastKeywordXMP>
<dc:subject>
<rdf:Bag>
<rdf:li>test</rdf:li>
<rdf:li>свадьба Алла+ Эльдар</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
Expand Down

0 comments on commit d3bc7e6

Please sign in to comment.