-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from martinhoefling/digikam
Add digikam model, closes #3
- Loading branch information
Showing
3 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// from http://www.exiv2.org/tags-xmp-digiKam.html | ||
|
||
package digikam | ||
|
||
type ColorLabel string | ||
|
||
const ( | ||
NoColorLabel ColorLabel = "0" | ||
LabelRed ColorLabel = "1" | ||
LabelOrange ColorLabel = "2" | ||
LabelYellow ColorLabel = "3" | ||
LabelGreen ColorLabel = "4" | ||
LabelBlue ColorLabel = "5" | ||
LabelMagenta ColorLabel = "6" | ||
LabelGray ColorLabel = "7" | ||
LabelBlack ColorLabel = "8" | ||
LabelWhite ColorLabel = "9" | ||
) | ||
|
||
type PickLabel string | ||
|
||
const ( | ||
NoPickLabel PickLabel = "0" | ||
ItemRejected PickLabel = "1" | ||
ItemPendingValidation = "2" | ||
ItemAccepted = "3" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// from http://www.exiv2.org/tags-xmp-digiKam.html | ||
|
||
package digikam | ||
|
||
import ( | ||
"fmt" | ||
"trimmer.io/go-xmp/xmp" | ||
) | ||
|
||
var ( | ||
NsDk = xmp.NewNamespace("digiKam", "http://www.digikam.org/ns/1.0/", NewModel) | ||
) | ||
|
||
func init() { | ||
xmp.Register(NsDk, xmp.XmpMetadata) | ||
} | ||
|
||
func NewModel(name string) xmp.Model { | ||
return &Digikam{} | ||
} | ||
|
||
func MakeModel(d *xmp.Document) (*Digikam, error) { | ||
m, err := d.MakeModel(NsDk) | ||
if err != nil { | ||
return nil, err | ||
} | ||
x, _ := m.(*Digikam) | ||
return x, nil | ||
} | ||
|
||
func FindModel(d *xmp.Document) *Digikam { | ||
if m := d.FindModel(NsDk); m != nil { | ||
return m.(*Digikam) | ||
} | ||
return nil | ||
} | ||
|
||
type Digikam struct { | ||
TagsList xmp.StringList `xmp:"digiKam:TagsList"` | ||
CaptionsAutorNames xmp.AltString `xmp:"digiKam:CaptionsAutorNames"` | ||
CaptionsDateTimeStamps xmp.AltString `xmp:"digiKam:CaptionsDateTimeStamps"` | ||
ImageHistory string `xmp:"digiKam:ImageHistory"` | ||
ImageUniqueID string `xmp:"digiKam:ImageUniqueID"` | ||
LensCorrectionSettings string `xmp:"digiKam:LensCorrectionSettings"` | ||
ColorLabel ColorLabel `xmp:"digiKam:ColorLabel"` | ||
PickLabel PickLabel `xmp:"digiKam:PickLabel"` | ||
} | ||
|
||
func (x Digikam) Can(nsName string) bool { | ||
return NsDk.GetName() == nsName | ||
} | ||
|
||
func (x Digikam) Namespaces() xmp.NamespaceList { | ||
return xmp.NamespaceList{NsDk} | ||
} | ||
|
||
func (x *Digikam) SyncModel(d *xmp.Document) error { | ||
return nil | ||
} | ||
|
||
func (x *Digikam) SyncFromXMP(d *xmp.Document) error { | ||
return nil | ||
} | ||
|
||
func (x Digikam) SyncToXMP(d *xmp.Document) error { | ||
return nil | ||
} | ||
|
||
func (x *Digikam) CanTag(tag string) bool { | ||
_, err := xmp.GetNativeField(x, tag) | ||
return err == nil | ||
} | ||
|
||
func (x *Digikam) GetTag(tag string) (string, error) { | ||
if v, err := xmp.GetNativeField(x, tag); err != nil { | ||
return "", fmt.Errorf("%s: %v", NsDk.GetName(), err) | ||
} else { | ||
return v, nil | ||
} | ||
} | ||
|
||
func (x *Digikam) SetTag(tag, value string) error { | ||
if err := xmp.SetNativeField(x, tag, value); err != nil { | ||
return fmt.Errorf("%s: %v", NsDk.GetName(), err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> | ||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2"> | ||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> | ||
<rdf:Description rdf:about="" | ||
xmlns:digiKam="http://www.digikam.org/ns/1.0/" | ||
digiKam:PickLabel="2" | ||
digiKam:ColorLabel="4" | ||
digiKam:ImageHistory="<?xml version="1.0"?>
<history version="1">
 <file uuid="287a11cb7f4ce35445751bdc4399d95a6407997b46dde6a24c2669ee49bd5e29" type="original">
 <fileParams fileName="18-12-07 14-32-27 3223.jpg" filePath="/Users/martin/Documents/Bilder/Linked/000-toimport/" fileHash="6407997b46dde6a24c2669ee49bd5e29" fileSize="2094669" creationDate="2018-12-07T14:32:28"/>
 </file>
 <filter filterName="digikam:ColorFXFilter" filterDisplayName="Color FX Filter" filterVersion="1" filterCategory="reproducible" branch="true">
 <params>
 <param name="intensity" value="100"/>
 <param name="iteration" value="2"/>
 <param name="level" value="29"/>
 <param name="path" value="/opt/digikam/Applications/KF5/digikam.app/Contents/Resources//digikam/data/lut3d/bleach.png"/>
 <param name="type" value="0"/>
 </params>
 </filter>
</history>
" | ||
digiKam:ImageUniqueID="3f6857dc97b8f8ba06cee65532b532576407997b46dde6a24c2669ee49bd5e29"> | ||
<digiKam:TagsList> | ||
<rdf:Seq> | ||
<rdf:li>Steine</rdf:li> | ||
<rdf:li>Leuchtturm</rdf:li> | ||
</rdf:Seq> | ||
</digiKam:TagsList> | ||
</rdf:Description> | ||
</rdf:RDF> | ||
</x:xmpmeta> | ||
<?xpacket end="w"?> |