PM-Prefs (Tag/Farbe/Sterne) lesen+schreiben, Datum Capture Time, Zoom bis einstellbarem Maximum, Ingest im PM-Aufbau (gesperrt/RAW-Filter, Sequenz, inkrementell, Auswerfen), App-Icon
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
c0ee93995f
commit
8effd1af0c
25 files changed
+885
-131
No files matched your search
@@ -36,6 +36,26 @@ public struct MetadataWriter: Sendable {
|
||||
try await writeFlags(["-XMP-photomech:Tagged=\(tagged ? "Yes" : "No")"], item: item)
|
||||
}
|
||||
|
||||
/// Writes tag, color class and stars in one go – in every place PM and Lightroom look:
|
||||
/// xmp:Rating, xmp:Label, photomechanic:Tagged/ColorClass/Prefs and (JPEG/TIFF) IPTC 2:221 Prefs.
|
||||
public func writeState(of item: PhotoItem) async throws {
|
||||
let prefs = item.pmPrefsString
|
||||
for target in item.metadataTargets {
|
||||
var args = ["-overwrite_original", "-m",
|
||||
"-XMP-xmp:Rating=\(max(0, min(5, item.rating)))",
|
||||
"-XMP-photomech:Tagged=\(item.tagged ? "Yes" : "No")",
|
||||
"-XMP-photomech:Prefs=\(prefs)"]
|
||||
if let l = item.label {
|
||||
args += ["-XMP-xmp:Label=\(l.xmpValue)", "-XMP-photomech:ColorClass=\(l.pmColorClass)"]
|
||||
} else {
|
||||
args += ["-XMP-xmp:Label=", "-XMP-photomech:ColorClass=0"]
|
||||
}
|
||||
if target.kind.supportsIIM { args += ["-IPTC:Prefs=\(prefs)"] }
|
||||
let (_, err) = try await exiftool.execute(args + [target.url.path])
|
||||
if err.contains("Error:") { throw ExifToolError.failed(err) }
|
||||
}
|
||||
}
|
||||
|
||||
private func writeFlags(_ args: [String], item: PhotoItem) async throws {
|
||||
for target in item.metadataTargets {
|
||||
let (_, err) = try await exiftool.execute(["-overwrite_original", "-m"] + args + [target.url.path])
|
||||
|
||||
Reference in new issue
Block a user