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

+16 -2
View File
@@ -66,9 +66,23 @@ final class AppState: ObservableObject {
templates = Storage.load([IPTCTemplate].self, from: Storage.templatesURL) ?? []
codes = Storage.load(CodeReplacements.self, from: Storage.codesURL) ?? CodeReplacements()
uploads.state = self
seedDefaultsIfNeeded()
startLightroomPolling()
}
/// First launch: agency FTP profiles (host/user are placeholders – adjust in Settings → FTP).
private func seedDefaultsIfNeeded() {
guard settings.ftpDestinations.isEmpty, !UserDefaults.standard.bool(forKey: "seededFTP") else { return }
UserDefaults.standard.set(true, forKey: "seededFTP")
let host = "beautifulsports.ftp.xxx.com"
settings.ftpDestinations = [
FTPDestination(name: "Beautiful Sports – Sport", proto: .ftp, host: host, port: 21,
remoteDirectory: "/Tonhäuser_Sport", passive: true, variant: .jpeg),
FTPDestination(name: "Beautiful Sports – Stock", proto: .ftp, host: host, port: 21,
remoteDirectory: "/Tonhäuser_Stock", passive: true, variant: .jpeg),
]
}
// MARK: exiftool
var exiftool: ExifTool? {
@@ -329,11 +343,11 @@ final class AppState: ObservableObject {
panel.allowedContentTypes = []
panel.allowsOtherFileTypes = true
panel.allowsMultipleSelection = true
panel.message = "Photo Mechanic Vorlage(n) (.xmp) oder Bilder mit IPTC wählen"
panel.message = "Photo-Mechanic-Vorlage(n) (.snap / .xmp) oder Bilder mit IPTC wählen"
guard panel.runModal() == .OK else { return }
for url in panel.urls {
do {
if url.pathExtension.lowercased() == "xmp" || url.pathExtension.lowercased() == "xml" {
if ["xmp", "xml", "snap"].contains(url.pathExtension.lowercased()) {
templates.append(try XMPTemplateIO.importTemplate(from: url))
} else {
try templateFromImage(url)
+17 -2
View File
@@ -23,6 +23,8 @@ struct IPTCFieldsForm: View {
var mixed: Set<String> = []
var dirty: Set<String> = []
var onEdit: (String) -> Void = { _ in }
/// PM-style "apply" checkboxes (template editor only).
var applied: Binding<Set<String>>? = nil
@AppStorage("collapsedIPTCSections") private var collapsedRaw = ""
var body: some View {
@@ -32,8 +34,21 @@ struct IPTCFieldsForm: View {
DisclosureGroup(isExpanded: expandedBinding(section)) {
VStack(alignment: .leading, spacing: 6) {
ForEach(fields) { field in
FieldRow(field: field, text: binding(field), isMixed: mixed.contains(field.id) && !dirty.contains(field.id),
isDirty: dirty.contains(field.id))
HStack(alignment: .top, spacing: 6) {
if let applied {
Toggle("", isOn: Binding(
get: { applied.wrappedValue.contains(field.id) },
set: { on in
if on { applied.wrappedValue.insert(field.id) } else { applied.wrappedValue.remove(field.id) }
}))
.toggleStyle(.checkbox)
.labelsHidden()
.padding(.top, 16)
.help("Feld beim Anwenden schreiben (wie das Häkchen in Photo Mechanic)")
}
FieldRow(field: field, text: binding(field), isMixed: mixed.contains(field.id) && !dirty.contains(field.id),
isDirty: dirty.contains(field.id))
}
}
}
.padding(.top, 4)
+20 -2
View File
@@ -103,16 +103,34 @@ struct TemplateManagerView: View {
ForEach(ListMergeMode.allCases, id: \.self) { Text($0.rawValue).tag($0) }
}
.fixedSize()
Toggle("Leere Felder löschen beim Anwenden", isOn: $state.templates[i].clearEmptyFields)
Toggle("Nur angehakte Felder (wie PM)", isOn: Binding(
get: { state.templates[i].appliedFields != nil },
set: { on in
let t = state.templates[i]
state.templates[i].appliedFields = on
? Set(IPTCField.all.filter { !t.values.isEmpty($0) }.map(\.id)) : nil
}))
if state.templates[i].appliedFields == nil {
Toggle("Leere Felder löschen", isOn: $state.templates[i].clearEmptyFields)
}
Toggle("Datum = Aufnahmezeit", isOn: $state.templates[i].dateFromCapture)
.help("Erstellungsdatum/-zeit aus der EXIF-Aufnahmezeit jedes Bildes (PM: Apply Date → Capture Date)")
}
.font(.callout)
if !state.templates[i].unmappedPMCodes.isEmpty {
Text("Unbekannte PM-Feldcodes: \(state.templates[i].unmappedPMCodes.joined(separator: ", ")) – bitte Häkchen prüfen.")
.font(.caption).foregroundStyle(.orange)
}
if !state.templates[i].extras.isEmpty {
Text("\(state.templates[i].extras.count) zusätzliche XMP-Felder aus PM werden beim Export beibehalten.")
.font(.caption).foregroundStyle(.secondary)
}
Divider()
ScrollView {
IPTCFieldsForm(texts: $texts) { _ in save() }
IPTCFieldsForm(texts: $texts, onEdit: { _ in save() },
applied: state.templates[i].appliedFields == nil ? nil : Binding(
get: { state.templates[i].appliedFields ?? [] },
set: { state.templates[i].appliedFields = $0 }))
.padding(.trailing, 8)
}
}