xmpr 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/README.md +45 -2
- data/lib/xmpr/version.rb +1 -1
- data/lib/xmpr.rb +2 -3
- data/test/fixtures/xmp.xml +2 -0
- data.tar.gz.sig +0 -0
- metadata +31 -27
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bab4db436ec9741a2221b830828d4fb6cc8f87b6edf25140d9db8bbd25a49894
|
4
|
+
data.tar.gz: ad83eaf84b845cd4aed03695ab63344c7136432b0d38ef19caba1cf05a8c5d05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19fed278428575a766e57ca64c370403fb06b2ec4f83939bb2fa6566e7a7cbd280a1b3e26093201d2382b24ef3a22bcb0b0fa72274cf71110c4107996e3999a4
|
7
|
+
data.tar.gz: 21602c286bf2a8a7446f6e136150509bdc7d0e734e1f6e31d873e18841a9a1d1813f2cb08737a72509d6ed1cc49611e861fe99d834aa00de30644b12feac4197
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,9 +1,48 @@
|
|
1
1
|
# XMP Reader
|
2
2
|
|
3
|
-
[](https://travis-ci.org/sj26/xmpr)
|
4
|
-
|
5
3
|
XMP Reader in Ruby. Parse XMP data extracted from an image into rich data types.
|
6
4
|
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Use something like imagemagick to extract the XMP, then read it with this class:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
require "xmpr"
|
11
|
+
raw_xmp = `convert image.jpg xmp:-`
|
12
|
+
xmp = XMPR.parse(raw_xmp)
|
13
|
+
xmp["dc", "title"] # => "Amazing Photo"
|
14
|
+
xmp["photoshop", "Category"] # => "summer"
|
15
|
+
xmp["photoshop", "SupplementalCategories"] # => ["morning", "sea"]
|
16
|
+
```
|
17
|
+
|
18
|
+
The xmp instance fetches namespaced attributes. You can use fully qualified namespaces, or some namespaces have shortcuts:
|
19
|
+
|
20
|
+
```
|
21
|
+
xmp["http://purl.org/dc/elements/1.1/", "title"] # => "Amazing Photo"
|
22
|
+
xmp["dc", "title"] # => "Amazing Photo" (same thing)
|
23
|
+
```
|
24
|
+
|
25
|
+
The following namespaces have shortcuts:
|
26
|
+
|
27
|
+
* `aux` — `http://ns.adobe.com/exif/1.0/aux/`
|
28
|
+
* `cc` — `http://creativecommons.org/ns#` ([Creative Commons](http://creativecommons.org))
|
29
|
+
* `crs` — `http://ns.adobe.com/camera-raw-settings/1.0/`
|
30
|
+
* `dc` — `http://purl.org/dc/elements/1.1/` ([Dublin Core](http://dublincore.org/))
|
31
|
+
* `exif` — `http://ns.adobe.com/exif/1.0/`
|
32
|
+
* `Iptc4xmpCore` — `http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/` ([IPTC](http://iptc.org/))
|
33
|
+
* `pdf` — `http://ns.adobe.com/pdf/1.3/`
|
34
|
+
* `photoshop` — `http://ns.adobe.com/photoshop/1.0/`
|
35
|
+
* `rdf` — `http://www.w3.org/1999/02/22-rdf-syntax-ns#`
|
36
|
+
* `tiff` — `http://ns.adobe.com/tiff/1.0/`
|
37
|
+
* `x` — `adobe:ns:meta/`
|
38
|
+
* `xap` — `http://ns.adobe.com/xap/1.0/`
|
39
|
+
* `xmp` — `http://ns.adobe.com/xap/1.0/` ([XMP](http://www.adobe.com/products/xmp.html))
|
40
|
+
* `xmpidq` — `http://ns.adobe.com/xmp/Identifier/qual/1.0/`
|
41
|
+
* `xmpBJ` — `http://ns.adobe.com/xap/1.0/bj/`
|
42
|
+
* `xmpRights` — `http://ns.adobe.com/xap/1.0/rights/`
|
43
|
+
* `xmpMM` — `http://ns.adobe.com/xap/1.0/mm/`
|
44
|
+
* `xmpTPg` — `http://ns.adobe.com/xap/1.0/t/pg/`
|
45
|
+
|
7
46
|
## Thanks
|
8
47
|
|
9
48
|
Refactored from [XMP][xmp-gem]. Inspired by [ExifTool][exiftool].
|
@@ -11,6 +50,10 @@ Refactored from [XMP][xmp-gem]. Inspired by [ExifTool][exiftool].
|
|
11
50
|
[xmp-gem]: https://github.com/amberbit/xmp
|
12
51
|
[exiftool]: http://www.sno.phy.queensu.ca/~phil/exiftool/
|
13
52
|
|
53
|
+
## References
|
54
|
+
|
55
|
+
* [XMP specification](https://www.adobe.com/devnet/xmp.html)
|
56
|
+
|
14
57
|
## License
|
15
58
|
|
16
59
|
MIT license, see [LICENSE](LICENSE).
|
data/lib/xmpr/version.rb
CHANGED
data/lib/xmpr.rb
CHANGED
@@ -20,7 +20,8 @@ module XMPR
|
|
20
20
|
# Namespace shortcuts, and fallbacks for undeclared namespaces.
|
21
21
|
NAMESPACES = {
|
22
22
|
"aux" => "http://ns.adobe.com/exif/1.0/aux/",
|
23
|
-
"
|
23
|
+
"cc" => "http://creativecommons.org/ns#",
|
24
|
+
"crs" => "http://ns.adobe.com/camera-raw-settings/1.0/",
|
24
25
|
"dc" => "http://purl.org/dc/elements/1.1/",
|
25
26
|
"exif" => "http://ns.adobe.com/exif/1.0/",
|
26
27
|
"Iptc4xmpCore" => "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/",
|
@@ -100,8 +101,6 @@ module XMPR
|
|
100
101
|
alt_value(alt_element, lang: lang)
|
101
102
|
elsif array_element = element.xpath("./rdf:Bag | ./rdf:Seq", NAMESPACES).first
|
102
103
|
array_value(array_element)
|
103
|
-
else
|
104
|
-
raise "Don't know how to handle:\n#{element}"
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
data/test/fixtures/xmp.xml
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
6
|
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"
|
7
7
|
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
|
8
|
+
xmlns:xmpMM ='http://ns.adobe.com/xap/1.0/mm/'
|
8
9
|
Iptc4xmpCore:Location="Miejsce"
|
9
10
|
photoshop:Category="Kategoria">
|
10
11
|
<dc:title>
|
@@ -27,6 +28,7 @@
|
|
27
28
|
</dc:creator>
|
28
29
|
</rdf:Description>
|
29
30
|
</rdf:RDF>
|
31
|
+
<xmpMM:DerivedFrom stRef:documentID ='1E779B3F7210FAE000FF94666EF3A444' stRef:originalDocumentID ='1E779B3F7210FAE000FF94666EF3A444'></xmpMM:DerivedFrom>
|
30
32
|
</x:xmpmeta>
|
31
33
|
|
32
34
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,34 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmpr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Cochran
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MIIDXDCCAkSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
|
14
|
+
MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0y
|
15
|
+
MjA3MDQwMDQwNDZaFw0yMzA3MDQwMDQwNDZaMDoxDTALBgNVBAMMBHNqMjYxFDAS
|
16
16
|
BgoJkiaJk/IsZAEZFgRzajI2MRMwEQYKCZImiZPyLGQBGRYDY29tMIIBIjANBgkq
|
17
17
|
hkiG9w0BAQEFAAOCAQ8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8SBBib84AuwhMHIlUv9FcHhh3dXsDDYkrVrpUAwCsG6yCm
|
30
31
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
32
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
32
33
|
dependencies:
|
33
34
|
- !ruby/object:Gem::Dependency
|
34
35
|
name: nokogiri
|
@@ -50,28 +51,28 @@ dependencies:
|
|
50
51
|
requirements:
|
51
52
|
- - "~>"
|
52
53
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
54
|
+
version: '2.0'
|
54
55
|
type: :development
|
55
56
|
prerelease: false
|
56
57
|
version_requirements: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - "~>"
|
59
60
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
+
version: '2.0'
|
61
62
|
- !ruby/object:Gem::Dependency
|
62
63
|
name: rake
|
63
64
|
requirement: !ruby/object:Gem::Requirement
|
64
65
|
requirements:
|
65
|
-
- - "
|
66
|
+
- - ">="
|
66
67
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
+
version: '0'
|
68
69
|
type: :development
|
69
70
|
prerelease: false
|
70
71
|
version_requirements: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
|
-
- - "
|
73
|
+
- - ">="
|
73
74
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
75
|
+
version: '0'
|
75
76
|
- !ruby/object:Gem::Dependency
|
76
77
|
name: minitest
|
77
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,14 +103,19 @@ files:
|
|
102
103
|
homepage: https://github.com/sj26/xmpr
|
103
104
|
licenses:
|
104
105
|
- MIT
|
105
|
-
metadata:
|
106
|
-
|
106
|
+
metadata:
|
107
|
+
bug_tracker_uri: https://github.com/sj26/xmpr/issues
|
108
|
+
changelog_uri: https://github.com/sj26/xmpr/releases
|
109
|
+
documentation_uri: https://www.rubydoc.info/gems/xmpr/0.2.1
|
110
|
+
homepage_uri: https://github.com/sj26/xmpr
|
111
|
+
source_code_uri: https://github.com/sj26/xmpr/tree/v0.2.1
|
112
|
+
post_install_message:
|
107
113
|
rdoc_options: []
|
108
114
|
require_paths:
|
109
115
|
- lib
|
110
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
117
|
requirements:
|
112
|
-
- - "
|
118
|
+
- - ">="
|
113
119
|
- !ruby/object:Gem::Version
|
114
120
|
version: '2.1'
|
115
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -118,13 +124,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
124
|
- !ruby/object:Gem::Version
|
119
125
|
version: '0'
|
120
126
|
requirements: []
|
121
|
-
|
122
|
-
|
123
|
-
signing_key:
|
127
|
+
rubygems_version: 3.3.7
|
128
|
+
signing_key:
|
124
129
|
specification_version: 4
|
125
130
|
summary: Parse XMP data
|
126
131
|
test_files:
|
127
132
|
- test/fixtures/xmp.xml
|
128
133
|
- test/test_helper.rb
|
129
134
|
- test/xmpr_test.rb
|
130
|
-
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|