Kartenimport, Metadaten und Versand absichern
This commit is contained in:
1 parent
be6bd49da5
commit
427b6fa7b0
18 files changed
+643
-193
No files matched your search
@@ -49,9 +49,11 @@ public struct LightroomJobResult: Sendable {
|
||||
public var imported: Int
|
||||
public var exported: [URL]
|
||||
public var errors: [String]
|
||||
public private(set) var exportSources: [URL: URL] = [:]
|
||||
|
||||
public static func parse(_ text: String) -> LightroomJobResult {
|
||||
var r = LightroomJobResult(id: "", ok: false, imported: 0, exported: [], errors: [])
|
||||
var lastExport: URL?
|
||||
for line in text.components(separatedBy: .newlines) {
|
||||
guard let eq = line.firstIndex(of: "=") else { continue }
|
||||
let k = String(line[..<eq]), v = String(line[line.index(after: eq)...])
|
||||
@@ -59,7 +61,13 @@ public struct LightroomJobResult: Sendable {
|
||||
case "id": r.id = v
|
||||
case "status": r.ok = v == "done"
|
||||
case "imported": r.imported = Int(v) ?? 0
|
||||
case "exported": r.exported.append(URL(fileURLWithPath: v))
|
||||
case "exported":
|
||||
let file = URL(fileURLWithPath: v)
|
||||
r.exported.append(file)
|
||||
lastExport = file
|
||||
case "source":
|
||||
if let file = lastExport, v.hasPrefix("/") { r.exportSources[file] = URL(fileURLWithPath: v) }
|
||||
lastExport = nil
|
||||
case "error": r.errors.append(v)
|
||||
default: break
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user