Ingest: Laufnummer auch bei Abbruch oder Fehler speichern
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
1f63714b73
commit
be6bd49da5
2 files changed
+11
-2
No files matched your search
@@ -515,13 +515,17 @@ final class AppState: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onSequence: { [weak self] next in
|
||||||
|
// runs on success, cancel and error – the numbering never starts over
|
||||||
|
Task { @MainActor [weak self] in self?.settings.ingest.startSequence = next }
|
||||||
|
},
|
||||||
progress: { [weak self] p in
|
progress: { [weak self] p in
|
||||||
Task { @MainActor [weak self] in
|
Task { @MainActor [weak self] in
|
||||||
self?.tasks.update(taskID, done: p.done, total: p.total, detail: p.currentFile)
|
self?.tasks.update(taskID, done: p.done, total: p.total, detail: p.currentFile)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// PM: the sequence continues with the next number next time.
|
// PM: the sequence continues with the next number next time.
|
||||||
if settings.sequenceEnabled { self.settings.ingest.startSequence = result.nextSequence }
|
if settings.sequenceEnabled { self.settings.ingest.startSequence = max(self.settings.ingest.startSequence, result.nextSequence) }
|
||||||
|
|
||||||
// Eject right after copying – everything after this works on the copies only.
|
// Eject right after copying – everything after this works on the copies only.
|
||||||
var ejectNote = ""
|
var ejectNote = ""
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ public enum IngestService {
|
|||||||
/// Copies the photos (and their XMP sidecars) from `sources` like PM's Ingest.
|
/// Copies the photos (and their XMP sidecars) from `sources` like PM's Ingest.
|
||||||
public static func run(sources: [URL], settings: IngestSettings, exiftool: ExifTool,
|
public static func run(sources: [URL], settings: IngestSettings, exiftool: ExifTool,
|
||||||
onFolder: (@Sendable (URL) -> Void)? = nil,
|
onFolder: (@Sendable (URL) -> Void)? = nil,
|
||||||
|
onSequence: (@Sendable (Int) -> Void)? = nil,
|
||||||
progress: @escaping @Sendable (IngestProgress) -> Void) async throws -> IngestResult {
|
progress: @escaping @Sendable (IngestProgress) -> Void) async throws -> IngestResult {
|
||||||
let fm = FileManager.default
|
let fm = FileManager.default
|
||||||
guard !settings.primaryDestination.isEmpty else { throw UploadError.failed("Kein Ziel für den Ingest gewählt.") }
|
guard !settings.primaryDestination.isEmpty else { throw UploadError.failed("Kein Ziel für den Ingest gewählt.") }
|
||||||
@@ -194,7 +195,11 @@ public enum IngestService {
|
|||||||
|
|
||||||
progress(IngestProgress(done: 0, total: total, currentFile: "Starte …"))
|
progress(IngestProgress(done: 0, total: total, currentFile: "Starte …"))
|
||||||
// also after a cancel/error: what was copied is not copied again next time
|
// also after a cancel/error: what was copied is not copied again next time
|
||||||
defer { if settings.incremental { saveHistory(history) } }
|
// also after a cancel/error the next number is handed back, so the next ingest continues there
|
||||||
|
defer {
|
||||||
|
if settings.incremental { saveHistory(history) }
|
||||||
|
if settings.sequenceEnabled { onSequence?(seq) }
|
||||||
|
}
|
||||||
for e in entries {
|
for e in entries {
|
||||||
try Task.checkCancellation()
|
try Task.checkCancellation()
|
||||||
let item = e.item
|
let item = e.item
|
||||||
|
|||||||
Reference in new issue
Block a user