Immich: Upload ohne Album möglich
Schalter „In Album einsortieren / Ohne Album“ im Upload-Fenster (⌘U, Ziel Immich) und in den Einstellungen. Ohne Album landen die Bilder nur in der Bibliothek; die Album-Muster bleiben gespeichert. 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
223d8b0610
commit
50d03fc4d7
4 files changed
+19
-3
No files matched your search
@@ -1384,6 +1384,7 @@ final class AppState: ObservableObject {
|
|||||||
/// e.g. "{event}" → "DFB-Pokal Frauen: VfL Wolfsburg - TSG 1899 Hoffenheim".
|
/// e.g. "{event}" → "DFB-Pokal Frauen: VfL Wolfsburg - TSG 1899 Hoffenheim".
|
||||||
/// Unresolved variables are dropped; if nothing is left the fallback pattern is used.
|
/// Unresolved variables are dropped; if nothing is left the fallback pattern is used.
|
||||||
func immichAlbum(for item: PhotoItem) -> String {
|
func immichAlbum(for item: PhotoItem) -> String {
|
||||||
|
guard settings.immich.useAlbum else { return "" } // "ohne Album": library only
|
||||||
func resolve(_ pattern: String) -> String {
|
func resolve(_ pattern: String) -> String {
|
||||||
guard !pattern.isEmpty else { return "" }
|
guard !pattern.isEmpty else { return "" }
|
||||||
var ctx = VariableContext.make(fileURL: item.primary, exif: item.exif, iptc: item.iptc, dateFormat: settings.dateFormat)
|
var ctx = VariableContext.make(fileURL: item.primary, exif: item.exif, iptc: item.iptc, dateFormat: settings.dateFormat)
|
||||||
|
|||||||
@@ -225,8 +225,12 @@ struct ImmichSettingsView: View {
|
|||||||
TextField("Server-URL", text: $state.settings.immich.serverURL, prompt: Text("https://immich.example.de"))
|
TextField("Server-URL", text: $state.settings.immich.serverURL, prompt: Text("https://immich.example.de"))
|
||||||
SecureField("API-Schlüssel (Schlüsselbund)", text: $apiKey)
|
SecureField("API-Schlüssel (Schlüsselbund)", text: $apiKey)
|
||||||
.onChange(of: apiKey) { _, k in Keychain.set(k, account: ImmichSettings.keychainAccount); state.uploads.resetImmich() }
|
.onChange(of: apiKey) { _, k in Keychain.set(k, account: ImmichSettings.keychainAccount); state.uploads.resetImmich() }
|
||||||
|
Toggle("Bilder in ein Album einsortieren", isOn: $state.settings.immich.useAlbum)
|
||||||
|
.help("Aus: Bilder landen nur in der Immich-Bibliothek, ohne Album")
|
||||||
TextField("Album", text: $state.settings.immich.albumName, prompt: Text("{event}"))
|
TextField("Album", text: $state.settings.immich.albumName, prompt: Text("{event}"))
|
||||||
|
.disabled(!state.settings.immich.useAlbum)
|
||||||
TextField("Album, wenn kein Ereignis im IPTC", text: $state.settings.immich.albumFallback, prompt: Text("{isodate} {city}"))
|
TextField("Album, wenn kein Ereignis im IPTC", text: $state.settings.immich.albumFallback, prompt: Text("{isodate} {city}"))
|
||||||
|
.disabled(!state.settings.immich.useAlbum)
|
||||||
Text("Variablen aus IPTC/EXIF pro Bild, z. B. {event}, {headline}, {city}, {sublocation}, {isodate}, {date}, {year4}, {creator}. Vereine: {vereina} - {vereinb} (= {home}/{away}, kurz {homeshort}/{awayshort}), dazu {competition}, {round}, {season} – aus dem Spieltag oder dem Ereignis. Beispiel: {vereina} - {vereinb} | {date}. Fehlende Alben werden angelegt, leer = kein Album.")
|
Text("Variablen aus IPTC/EXIF pro Bild, z. B. {event}, {headline}, {city}, {sublocation}, {isodate}, {date}, {year4}, {creator}. Vereine: {vereina} - {vereinb} (= {home}/{away}, kurz {homeshort}/{awayshort}), dazu {competition}, {round}, {season} – aus dem Spieltag oder dem Ereignis. Beispiel: {vereina} - {vereinb} | {date}. Fehlende Alben werden angelegt, leer = kein Album.")
|
||||||
.font(.caption).foregroundStyle(.secondary)
|
.font(.caption).foregroundStyle(.secondary)
|
||||||
if let first = state.selectedItems.first {
|
if let first = state.selectedItems.first {
|
||||||
|
|||||||
@@ -96,8 +96,15 @@ struct UploadWindow: View {
|
|||||||
} else if target == "immich" {
|
} else if target == "immich" {
|
||||||
LKSectionLabel(title: "Optionen").padding(.top, 4)
|
LKSectionLabel(title: "Optionen").padding(.top, 4)
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
optionRow("Album-Muster") {
|
optionRow("Album") {
|
||||||
TextField("{event}", text: $state.settings.immich.albumName).textFieldStyle(.plain).lkField()
|
LKSegmented(options: [(true, "In Album einsortieren"), (false, "Ohne Album")],
|
||||||
|
selection: $state.settings.immich.useAlbum)
|
||||||
|
}
|
||||||
|
if state.settings.immich.useAlbum {
|
||||||
|
divider
|
||||||
|
optionRow("Album-Muster") {
|
||||||
|
TextField("{event}", text: $state.settings.immich.albumName).textFieldStyle(.plain).lkField()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
divider
|
divider
|
||||||
optionRow("Dateien") {
|
optionRow("Dateien") {
|
||||||
@@ -163,6 +170,7 @@ struct UploadWindow: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var albumPreview: String {
|
private var albumPreview: String {
|
||||||
|
guard state.settings.immich.useAlbum else { return "ohne Album" }
|
||||||
let albums = Set(state.selectedItems.map { state.immichAlbum(for: $0) }.filter { !$0.isEmpty })
|
let albums = Set(state.selectedItems.map { state.immichAlbum(for: $0) }.filter { !$0.isEmpty })
|
||||||
return albums.isEmpty ? "kein Album" : "Album: " + albums.sorted().joined(separator: ", ")
|
return albums.isEmpty ? "kein Album" : "Album: " + albums.sorted().joined(separator: ", ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public struct ImmichSettings: Codable, Hashable, Sendable {
|
|||||||
public var albumFallback: String = "{isodate} {city}"
|
public var albumFallback: String = "{isodate} {city}"
|
||||||
public var variant: UploadVariant
|
public var variant: UploadVariant
|
||||||
public var enabled: Bool
|
public var enabled: Bool
|
||||||
|
/// Off = photos are uploaded into the library only, without any album (patterns stay saved).
|
||||||
|
public var useAlbum: Bool = true
|
||||||
|
|
||||||
public init(serverURL: String = "", albumName: String = "", variant: UploadVariant = .jpeg, enabled: Bool = false) {
|
public init(serverURL: String = "", albumName: String = "", variant: UploadVariant = .jpeg, enabled: Bool = false) {
|
||||||
self.serverURL = serverURL; self.albumName = albumName; self.variant = variant; self.enabled = enabled
|
self.serverURL = serverURL; self.albumName = albumName; self.variant = variant; self.enabled = enabled
|
||||||
@@ -19,7 +21,7 @@ public struct ImmichSettings: Codable, Hashable, Sendable {
|
|||||||
|
|
||||||
public static let keychainAccount = "immich-api-key"
|
public static let keychainAccount = "immich-api-key"
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey { case serverURL, albumName, albumFallback, variant, enabled }
|
enum CodingKeys: String, CodingKey { case serverURL, albumName, albumFallback, variant, enabled, useAlbum }
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
@@ -28,6 +30,7 @@ public struct ImmichSettings: Codable, Hashable, Sendable {
|
|||||||
albumFallback = (try? c.decode(String.self, forKey: .albumFallback)) ?? "{isodate} {city}"
|
albumFallback = (try? c.decode(String.self, forKey: .albumFallback)) ?? "{isodate} {city}"
|
||||||
variant = (try? c.decode(UploadVariant.self, forKey: .variant)) ?? .jpeg
|
variant = (try? c.decode(UploadVariant.self, forKey: .variant)) ?? .jpeg
|
||||||
enabled = (try? c.decode(Bool.self, forKey: .enabled)) ?? false
|
enabled = (try? c.decode(Bool.self, forKey: .enabled)) ?? false
|
||||||
|
useAlbum = (try? c.decode(Bool.self, forKey: .useAlbum)) ?? true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user