PM-.snap-Import (FieldsToApply, Merge, Aufnahmedatum), Aufnahmeort/Copyright-Status/DataMining, FTP-Profile Beautiful Sports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
Lichtkasten DevandClaude Opus 5.5 committed 2026-11-03 22:57:14 +00:00
1 parent 0b41f09206
commit 42ab9c9361
13 files changed
+472 -39

No files matched your search

@@ -122,7 +122,7 @@ public final class ExifTool: @unchecked Sendable {
var args = ["-json", "-G1", "-fast", "-a",
"-XMP-xmp:Rating#", "-XMP-xmp:Label", "-XMP-photomech:Tagged#", "-XMP-photomech:ColorClass#",
"-Make", "-Model", "-LensModel", "-LensID", "-SerialNumber", "-ISO", "-ExposureTime", "-FNumber",
"-FocalLength", "-DateTimeOriginal", "-CreateDate", "-SubSecTimeOriginal", "-ImageWidth", "-ImageHeight",
"-FocalLength", "-DateTimeOriginal", "-CreateDate", "-SubSecTimeOriginal", "-OffsetTimeOriginal", "-ImageWidth", "-ImageHeight",
"-Orientation#", "-Artist", "-GPSLatitude#", "-GPSLongitude#"]
for f in IPTCField.all {
if let iim = f.iimTag { args.append("-" + iim) }
@@ -9,12 +9,13 @@ public enum XMPNamespace {
public static let xmpRights = "http://ns.adobe.com/xap/1.0/rights/"
public static let xmp = "http://ns.adobe.com/xap/1.0/"
public static let photomechanic = "http://ns.camerabits.com/photomechanic/1.0/"
public static let plus = "http://ns.useplus.org/ldf/xmp/1.0/"
public static let rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
/// Prefix normally used when we write a template file back out.
public static let preferredPrefix: [String: String] = [
dc: "dc", photoshop: "photoshop", iptcCore: "Iptc4xmpCore", iptcExt: "Iptc4xmpExt",
xmpRights: "xmpRights", xmp: "xmp", photomechanic: "photomechanic",
xmpRights: "xmpRights", xmp: "xmp", photomechanic: "photomechanic", plus: "plus",
]
}
@@ -27,6 +28,7 @@ public enum IPTCFieldKind: String, Codable, Sendable {
public enum IPTCSection: String, CaseIterable, Codable, Sendable {
case description = "Beschreibung"
case location = "Ort"
case locationCreated = "Aufnahmeort (IPTC Ext)"
case creator = "Urheber & Rechte"
case contact = "Kontakt des Urhebers"
case extended = "Erweitert (IPTC Core/Ext)"
@@ -108,6 +110,20 @@ public extension IPTCField {
f("countryCode", "Ländercode (ISO)", pm: "Country Code", .location,
iim: "IPTC:Country-PrimaryLocationCode", xmp: "XMP-iptcCore:CountryCode", ns: XMPNamespace.iptcCore, local: "CountryCode", max: 3),
// --- Aufnahmeort (Iptc4xmpExt:LocationCreated, Struktur in einer Bag) ---
f("lcSublocation", "Ortsdetail", pm: "Location Created: Sublocation", .locationCreated,
iim: nil, xmp: "XMP-iptcExt:LocationCreatedSublocation", ns: XMPNamespace.iptcExt, local: "Sublocation"),
f("lcCity", "Stadt", pm: "Location Created: City", .locationCreated,
iim: nil, xmp: "XMP-iptcExt:LocationCreatedCity", ns: XMPNamespace.iptcExt, local: "City"),
f("lcState", "Bundesland", pm: "Location Created: State/Province", .locationCreated,
iim: nil, xmp: "XMP-iptcExt:LocationCreatedProvinceState", ns: XMPNamespace.iptcExt, local: "ProvinceState"),
f("lcCountry", "Land", pm: "Location Created: Country", .locationCreated,
iim: nil, xmp: "XMP-iptcExt:LocationCreatedCountryName", ns: XMPNamespace.iptcExt, local: "CountryName"),
f("lcCountryCode", "Ländercode", pm: "Location Created: Country Code", .locationCreated,
iim: nil, xmp: "XMP-iptcExt:LocationCreatedCountryCode", ns: XMPNamespace.iptcExt, local: "CountryCode"),
f("lcWorldRegion", "Weltregion", pm: "Location Created: World Region", .locationCreated,
iim: nil, xmp: "XMP-iptcExt:LocationCreatedWorldRegion", ns: XMPNamespace.iptcExt, local: "WorldRegion"),
// --- Urheber & Rechte ---
f("creator", "Fotograf", pm: "Photographer / Creator", .creator,
iim: "IPTC:By-line", xmp: "XMP-dc:Creator", ns: XMPNamespace.dc, local: "creator", container: .seq, max: 32),
@@ -119,6 +135,10 @@ public extension IPTCField {
iim: "IPTC:Source", xmp: "XMP-photoshop:Source", ns: XMPNamespace.photoshop, local: "Source", max: 32),
f("copyright", "Copyright-Vermerk", pm: "Copyright Notice", .creator,
iim: "IPTC:CopyrightNotice", xmp: "XMP-dc:Rights", ns: XMPNamespace.dc, local: "rights", container: .alt, max: 128),
f("copyrightMarked", "Copyright-Status (True = geschützt)", pm: "Copyright Status", .creator,
iim: nil, xmp: "XMP-xmpRights:Marked", ns: XMPNamespace.xmpRights, local: "Marked"),
f("dataMining", "Data Mining (PLUS)", pm: "Data Mining", .creator,
iim: nil, xmp: "XMP-plus:DataMining#", ns: XMPNamespace.plus, local: "DataMining"),
f("usageTerms", "Nutzungsbedingungen", pm: "Rights Usage Terms", .creator, .multiline,
iim: nil, xmp: "XMP-xmpRights:UsageTerms", ns: XMPNamespace.xmpRights, local: "UsageTerms", container: .alt),
f("webStatement", "Copyright-URL", pm: "Copyright Info URL", .creator,
@@ -153,6 +173,19 @@ public extension IPTCField {
iim: nil, xmp: "XMP-iptcExt:PersonInImage", ns: XMPNamespace.iptcExt, local: "PersonInImage", container: .bag),
]
/// Key in exiftool's JSON output (a trailing "#" only disables print conversion).
var xmpReadKey: String { xmpTag.hasSuffix("#") ? String(xmpTag.dropLast()) : xmpTag }
/// IIM dataset (record 2) per field. Photo Mechanic's .snap lists applied fields as
/// 0x200 + dataset (e.g. 0x25a = 2:90 City).
static let iimDataset: [String: Int] = [
"objectName": 5, "urgency": 10, "category": 15, "supplementalCategories": 20, "keywords": 25,
"instructions": 40, "dateCreated": 55, "creator": 80, "creatorJobTitle": 85, "city": 90,
"sublocation": 92, "state": 95, "countryCode": 100, "country": 101, "transmissionReference": 103,
"headline": 105, "credit": 110, "source": 115, "copyright": 116, "caption": 120, "captionWriter": 122,
"intellectualGenre": 4, "subjectCode": 12,
]
static let byID: [String: IPTCField] = Dictionary(uniqueKeysWithValues: all.map { ($0.id, $0) })
/// Lookup by XMP namespace + local name (used by the PM template importer).
@@ -47,41 +47,75 @@ public enum ListMergeMode: String, Codable, CaseIterable, Sendable {
case replace = "Ersetzen"
}
/// A metadata template (PM: "IPTC Stationery Pad" / "IPTC Template").
/// A metadata template (PM: "IPTC Stationery Pad" / "IPTC Template", .snap).
public struct IPTCTemplate: Codable, Identifiable, Hashable, Sendable {
public var id: UUID
public var name: String
public var values: IPTCValues
public var listMergeMode: ListMergeMode
/// If true, empty template fields clear the target field (PM: "Replace all").
/// If true, empty template fields clear the target field (only used when `appliedFields` is nil).
public var clearEmptyFields: Bool
/// XMP properties from an imported PM template we do not model; written back on export.
/// PM-style checkboxes: only these fields are applied (an empty checked field clears the target).
/// nil = apply every non-empty field.
public var appliedFields: Set<String>?
/// PM "Apply date: photo capture date" – Date Created comes from EXIF instead of the template value.
public var dateFromCapture: Bool
/// XMP properties from an imported PM template we do not model; written back on export only.
public var extras: [String: String]
public var modified: Date
/// PM field codes from an imported .snap that Lichtkasten could not map (shown as hint in the editor).
public var unmappedPMCodes: [String] = []
public init(id: UUID = UUID(), name: String, values: IPTCValues = IPTCValues(),
listMergeMode: ListMergeMode = .append, clearEmptyFields: Bool = false,
appliedFields: Set<String>? = nil, dateFromCapture: Bool = false,
extras: [String: String] = [:], modified: Date = Date()) {
self.id = id
self.name = name
self.values = values
self.listMergeMode = listMergeMode
self.clearEmptyFields = clearEmptyFields
self.appliedFields = appliedFields
self.dateFromCapture = dateFromCapture
self.extras = extras
self.modified = modified
}
enum CodingKeys: String, CodingKey {
case id, name, values, listMergeMode, clearEmptyFields, appliedFields, dateFromCapture, extras, modified, unmappedPMCodes
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
id = try c.decodeIfPresent(UUID.self, forKey: .id) ?? UUID()
name = try c.decodeIfPresent(String.self, forKey: .name) ?? "Vorlage"
values = try c.decodeIfPresent(IPTCValues.self, forKey: .values) ?? IPTCValues()
listMergeMode = try c.decodeIfPresent(ListMergeMode.self, forKey: .listMergeMode) ?? .append
clearEmptyFields = try c.decodeIfPresent(Bool.self, forKey: .clearEmptyFields) ?? false
appliedFields = try c.decodeIfPresent(Set<String>.self, forKey: .appliedFields)
dateFromCapture = try c.decodeIfPresent(Bool.self, forKey: .dateFromCapture) ?? false
extras = try c.decodeIfPresent([String: String].self, forKey: .extras) ?? [:]
modified = try c.decodeIfPresent(Date.self, forKey: .modified) ?? Date()
unmappedPMCodes = try c.decodeIfPresent([String].self, forKey: .unmappedPMCodes) ?? []
}
/// Fields this template writes.
public var fieldsToWrite: [IPTCField] {
IPTCField.all.filter { f in
if let applied = appliedFields { return applied.contains(f.id) }
if f.id == "dateCreated" && dateFromCapture { return true }
return clearEmptyFields || !values.isEmpty(f)
}
}
/// Merges the template into existing image values. Variables / codes are NOT expanded here,
/// that happens per image in `MetadataWriter`.
public func apply(to existing: IPTCValues) -> IPTCValues {
var result = existing
for field in IPTCField.all {
for field in fieldsToWrite {
if field.kind == .list {
let tpl = values.list(field)
if tpl.isEmpty {
if clearEmptyFields { result.lists[field.id] = nil }
continue
}
if tpl.isEmpty { result.lists[field.id] = nil; continue }
switch listMergeMode {
case .replace:
result.lists[field.id] = tpl
@@ -92,11 +126,7 @@ public struct IPTCTemplate: Codable, Identifiable, Hashable, Sendable {
}
} else {
let tpl = values.text[field.id] ?? ""
if tpl.isEmpty {
if clearEmptyFields { result.text[field.id] = nil }
continue
}
result.text[field.id] = tpl
result.text[field.id] = tpl.isEmpty ? nil : tpl
}
}
return result
@@ -57,12 +57,10 @@ public struct MetadataWriter: Sendable {
if list.isEmpty { args.append("-\(tag)=") }
for item in list { args.append("-\(tag)=\(item)") }
}
} else if field.id == "dateCreated" {
args += Self.dateArguments(values.text[field.id] ?? "", writeIIM: writeIIM)
} else {
var value = values.text[field.id] ?? ""
if field.id == "dateCreated" {
value = value.replacingOccurrences(of: "-", with: ":")
if !value.isEmpty, value.count != 10 { continue } // ignore incomplete dates
}
let value = values.text[field.id] ?? ""
for tag in tags {
if value.isEmpty {
args.append("-\(tag)=")
@@ -79,6 +77,38 @@ public struct MetadataWriter: Sendable {
return args
}
/// "2026-11-02" or "2026-11-02 14:22:01[+01:00]" → XMP DateCreated (full) + IIM DateCreated/TimeCreated.
static func dateArguments(_ raw: String, writeIIM: Bool) -> [String] {
let v = raw.trimmingCharacters(in: .whitespaces)
if v.isEmpty {
return ["-XMP-photoshop:DateCreated="] + (writeIIM ? ["-IPTC:DateCreated=", "-IPTC:TimeCreated="] : [])
}
let normalized = v.replacingOccurrences(of: "T", with: " ")
let datePart = String(normalized.prefix(10)).replacingOccurrences(of: "-", with: ":")
guard datePart.count == 10, datePart.filter({ $0 == ":" }).count == 2 else { return [] } // invalid → skip
let timePart = normalized.count > 11 ? String(normalized.dropFirst(11)) : ""
var args = ["-XMP-photoshop:DateCreated=\(datePart)\(timePart.isEmpty ? "" : " " + timePart)"]
if writeIIM {
args.append("-IPTC:DateCreated=\(datePart)")
if !timePart.isEmpty { args.append("-IPTC:TimeCreated=\(timePart)") }
}
return args
}
/// Capture time from EXIF as "yyyy-MM-dd HH:mm:ss+hh:mm" (camera offset, else the Mac's offset at that date).
public static func captureDateValue(exif: [String: String]) -> String? {
guard let raw = exif["DateTimeOriginal"] ?? exif["CreateDate"], raw.count >= 19 else { return nil }
let clock = String(raw.prefix(19))
let datePart = String(clock.prefix(10)).replacingOccurrences(of: ":", with: "-")
let timePart = String(clock.suffix(8))
var offset = exif["OffsetTimeOriginal"] ?? ""
if offset.count != 6, let d = ExifDate.parse(clock) {
let secs = TimeZone.current.secondsFromGMT(for: d)
offset = String(format: "%@%02d:%02d", secs < 0 ? "-" : "+", abs(secs) / 3600, (abs(secs) % 3600) / 60)
}
return "\(datePart) \(timePart)\(offset)"
}
static func relevantMessages(_ stderr: String, file: URL) -> [String] {
stderr.components(separatedBy: .newlines)
.filter { !$0.isEmpty && !$0.contains("image files updated") }
@@ -93,9 +123,12 @@ public extension MetadataWriter {
dateFormat: String, progress: (@Sendable (Int) -> Void)? = nil) async throws -> [String: IPTCValues] {
var result: [String: IPTCValues] = [:]
// Fields touched by the template (non-empty, or all if clearEmptyFields).
let fields = IPTCField.all.filter { template.clearEmptyFields || !template.values.isEmpty($0) }
let fields = template.fieldsToWrite
for (i, item) in items.enumerated() {
let merged = template.apply(to: item.iptc)
var merged = template.apply(to: item.iptc)
if template.dateFromCapture, fields.contains(where: { $0.id == "dateCreated" }) {
merged.text["dateCreated"] = Self.captureDateValue(exif: item.exif) ?? merged.text["dateCreated"]
}
let ctx = VariableContext.make(fileURL: item.primary, exif: item.exif, iptc: merged, dateFormat: dateFormat)
let expanded = VariableExpander.expand(merged, context: ctx, codes: codes)
try await write(values: expanded, fields: fields, to: item)
@@ -23,36 +23,90 @@ public enum XMPTemplateIO {
public static func importTemplate(from url: URL) throws -> IPTCTemplate {
let data = try Data(contentsOf: url)
var t = try parse(data: data)
t.name = url.deletingPathExtension().lastPathComponent
var t = try parseAny(data: data)
// PM saves "<id>-<Name>.snap" – drop the numeric prefix for display.
var name = url.deletingPathExtension().lastPathComponent
if let dash = name.firstIndex(of: "-"), name[..<dash].allSatisfy(\.isNumber), name.distance(from: name.startIndex, to: dash) >= 4 {
name = String(name[name.index(after: dash)...])
}
t.name = name.replacingOccurrences(of: "_", with: " ")
return t
}
/// Accepts both a Photo Mechanic `.snap` (IPTCSettings wrapper) and plain XMP.
public static func parseAny(data: Data) throws -> IPTCTemplate {
if let snap = try? PMSnapFile.parse(data: data), let xmp = snap.xmpRecord {
var t = try parse(data: Data(xmp.utf8))
applySnapSettings(snap, to: &t)
return t
}
return try parse(data: data)
}
/// PM bookkeeping properties inside the XMP record (not image metadata).
static let pmControlProperties: Set<String> = [
"FieldsToApply", "FieldsToMerge", "ColorClass", "Tagged", "PMVersion", "ColorClassEval", "ColorClassApply",
"RatingEval", "RatingApply", "TagEval", "TagApply", "CaptionMergeStyle", "ApplyDateType", "Prefs",
]
public static func parse(data: Data) throws -> IPTCTemplate {
let props = try XMPPropertyCollector.collect(data: data)
var values = IPTCValues()
var extras: [String: String] = [:]
var pm: [String: [String]] = [:]
var found = 0
for p in props {
if p.namespace == XMPNamespace.photomechanic && pmControlProperties.contains(p.localName) {
pm[p.localName] = p.values
continue
}
if let field = IPTCField.forXMP(namespace: p.namespace, localName: p.localName) {
found += 1
if field.kind == .list {
var list = values.lists[field.id] ?? []
list.append(contentsOf: p.values.filter { !$0.isEmpty })
list.append(contentsOf: p.values.filter { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty })
values.lists[field.id] = list.isEmpty ? nil : list
} else {
let v = p.values.joined(separator: field.xmpContainer == .seq ? "; " : "\n")
if !v.isEmpty { values.text[field.id] = v }
if !v.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { values.text[field.id] = v }
}
} else if p.namespace != XMPNamespace.rdf, !p.values.isEmpty,
} else if p.namespace != XMPNamespace.rdf,
p.values.contains(where: { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }),
!(p.namespace == XMPNamespace.iptcCore && p.localName == "CreatorContactInfo") {
extras["\(p.namespace)|\(p.localName)"] = p.values.joined(separator: "\u{1F}")
}
}
// PM stores IIM date as yyyy-mm-dd in photoshop:DateCreated – keep only the date part.
// Keep only the date part of a fixed Date Created ("2026-02-15T00:00:00+01:00").
if let d = values.text["dateCreated"], d.count > 10 { values.text["dateCreated"] = String(d.prefix(10)) }
guard found > 0 || !extras.isEmpty else { throw TemplateImportError.noFieldsFound }
return IPTCTemplate(name: "Importiert", values: values, extras: extras)
var t = IPTCTemplate(name: "Importiert", values: values, extras: extras)
// PM checkboxes: FieldsToApply holds 0x200 + IIM dataset (0x8000+ = PM extended fields).
if let apply = pm["FieldsToApply"] {
let codes = Set(apply.compactMap { Int($0.replacingOccurrences(of: "0x", with: ""), radix: 16) })
var applied = Set<String>()
for (fieldID, ds) in IPTCField.iimDataset where codes.contains(0x200 + ds) { applied.insert(fieldID) }
// Extended (XMP-only) fields use PM-internal codes ≥ 0x8000.
for c in codes where c >= 0x8000 {
if let id = pmExtendedCodes[c] { applied.insert(id) } else { t.unmappedPMCodes.append("0x" + String(c, radix: 16)) }
}
t.appliedFields = applied
}
// FieldsToMerge: keywords (0x219) listed → append, else replace (PM default for a template).
if let merge = pm["FieldsToMerge"] {
t.listMergeMode = merge.contains(where: { $0.lowercased() == "0x219" }) ? .append : .replace
}
if let dt = pm["ApplyDateType"]?.first { t.dateFromCapture = (dt == "2") }
return t
}
/// Known PM extended field codes (derived from real .snap files; extend when new ones show up).
static let pmExtendedCodes: [Int: String] = [
0x8013: "event",
]
static func applySnapSettings(_ snap: PMSnapFile, to t: inout IPTCTemplate) {
if let style = snap.applyDateStyle { t.dateFromCapture = (style == "2") }
}
// MARK: Export
@@ -61,6 +115,7 @@ public enum XMPTemplateIO {
var simpleAttrs: [String] = []
var elements: [String] = []
var contact: [String] = []
var locationCreated: [String] = []
func esc(_ s: String) -> String {
s.replacingOccurrences(of: "&", with: "&amp;").replacingOccurrences(of: "<", with: "&lt;")
@@ -77,6 +132,10 @@ public enum XMPTemplateIO {
contact.append(" <\(q)>\(esc(vals[0]))</\(q)>")
continue
}
if field.section == .locationCreated {
locationCreated.append(" <\(q)>\(esc(vals[0]))</\(q)>")
continue
}
switch field.xmpContainer {
case .simple:
simpleAttrs.append(" \(q)=\"\(esc(vals[0]))\"")
@@ -88,6 +147,9 @@ public enum XMPTemplateIO {
elements.append(" <\(q)>\n <\(tag)>\n\(lis)\n </\(tag)>\n </\(q)>")
}
}
if !locationCreated.isEmpty {
elements.append(" <Iptc4xmpExt:LocationCreated>\n <rdf:Bag>\n <rdf:li rdf:parseType=\"Resource\">\n\(locationCreated.joined(separator: "\n"))\n </rdf:li>\n </rdf:Bag>\n </Iptc4xmpExt:LocationCreated>")
}
if !contact.isEmpty {
elements.append(" <Iptc4xmpCore:CreatorContactInfo rdf:parseType=\"Resource\">\n\(contact.joined(separator: "\n"))\n </Iptc4xmpCore:CreatorContactInfo>")
}
@@ -184,7 +246,8 @@ final class XMPPropertyCollector: NSObject, XMLParserDelegate {
func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
guard let frame = stack.popLast() else { return }
let text = frame.text.trimmingCharacters(in: .whitespacesAndNewlines)
// Keep text exactly (captions may start with blank lines), but treat pure formatting whitespace as empty.
let text = frame.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ? "" : frame.text
if frame.ns == XMPNamespace.rdf && frame.local == "li" {
// Hand the li value up to the nearest real property.
if let idx = stack.lastIndex(where: { !isContainer($0.ns, $0.local) }) {
@@ -193,6 +256,7 @@ final class XMPPropertyCollector: NSObject, XMLParserDelegate {
return
}
if isContainer(frame.ns, frame.local) { return }
if frame.ns == XMPNamespace.photomechanic && frame.liValues.isEmpty && frame.hasChildElements { return }
if !frame.liValues.isEmpty {
props.append(Property(namespace: frame.ns, localName: frame.local, values: frame.liValues))
} else if !frame.hasChildElements {
@@ -200,3 +264,42 @@ final class XMPPropertyCollector: NSObject, XMLParserDelegate {
}
}
}
/// Photo Mechanic `.snap` file: `<IPTCSettings><XMPRecord>…escaped XMP…</XMPRecord><ApplyFlags/>…`
struct PMSnapFile {
var xmpRecord: String?
var applyFlags: String?
var mergeFlags: String?
var applyDateStyle: String?
static func parse(data: Data) throws -> PMSnapFile {
final class Delegate: NSObject, XMLParserDelegate {
var root: String?
var current: String?
var buffer = ""
var result = PMSnapFile()
func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?,
qualifiedName qName: String?, attributes attributeDict: [String: String] = [:]) {
if root == nil { root = elementName }
current = elementName
buffer = ""
}
func parser(_ parser: XMLParser, foundCharacters string: String) { buffer += string }
func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
switch elementName {
case "XMPRecord": result.xmpRecord = buffer
case "ApplyFlags": result.applyFlags = buffer
case "MergeFlags": result.mergeFlags = buffer
case "ApplyDateStyle": result.applyDateStyle = buffer.trimmingCharacters(in: .whitespacesAndNewlines)
default: break
}
buffer = ""
}
}
let d = Delegate()
let p = XMLParser(data: data)
p.delegate = d
guard p.parse(), d.root == "IPTCSettings" else { throw TemplateImportError.unreadable("keine .snap-Datei") }
return d.result
}
}