Immich: Albumname aus IPTC-Variablen pro Bild ({event}), Fallback-Muster, Vorschau im Upload-Fenster

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-04 00:27:45 +00:00
1 parent 1e72b97164
commit 12f61b5d66
5 files changed
+73 -15

No files matched your search

@@ -6,8 +6,10 @@ import FoundationNetworking
public struct ImmichSettings: Codable, Hashable, Sendable {
/// e.g. https://photos.example.com (without /api)
public var serverURL: String
/// Album to add uploads to (created if missing). Empty = no album.
/// Album pattern with variables, e.g. "{event}" or "{isodate} {event}" (created if missing). Empty = no album.
public var albumName: String
/// Used when the pattern resolves to nothing (image without event), e.g. "{isodate} {city}". Empty = no album.
public var albumFallback: String = "{isodate} {city}"
public var variant: UploadVariant
public var enabled: Bool
@@ -16,6 +18,17 @@ public struct ImmichSettings: Codable, Hashable, Sendable {
}
public static let keychainAccount = "immich-api-key"
enum CodingKeys: String, CodingKey { case serverURL, albumName, albumFallback, variant, enabled }
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
serverURL = (try? c.decode(String.self, forKey: .serverURL)) ?? ""
albumName = (try? c.decode(String.self, forKey: .albumName)) ?? ""
albumFallback = (try? c.decode(String.self, forKey: .albumFallback)) ?? "{isodate} {city}"
variant = (try? c.decode(UploadVariant.self, forKey: .variant)) ?? .jpeg
enabled = (try? c.decode(Bool.self, forKey: .enabled)) ?? false
}
}
public enum ImmichError: LocalizedError {