Generate video thumbnails

This commit is contained in:
Christoph Hagen
2025-01-25 22:14:31 +01:00
parent 200fdc813d
commit 06b4c1ed76
10 changed files with 254 additions and 54 deletions

View File

@@ -165,6 +165,21 @@ final class Content: ObservableObject {
self.tagOverview = result.tagOverview
self.didLoadContent = true
callback([])
self.generateMissingVideoThumbnails()
}
}
}
func generateMissingVideoThumbnails() {
Task {
for file in self.files {
guard file.type.isVideo else { continue }
guard !file.isExternallyStored else { continue }
guard !storage.hasVideoThumbnail(for: file.id) else { continue }
if await imageGenerator.createVideoThumbnail(for: file.id) {
print("Generated thumbnail for \(file.id)")
file.didChange()
}
}
}
}