Don’t retrieve the asset unless we’re going to use it
- ID
6ae8736- date
2023-05-14 17:44:45+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
1563ac9- message
Don't retrieve the asset unless we're going to use it- changed files
1 file, 2 additions, 2 deletions
Changed files
actions/get_asset_jpeg.swift (4722) → actions/get_asset_jpeg.swift (4724)
diff --git a/actions/get_asset_jpeg.swift b/actions/get_asset_jpeg.swift
index 2cad6f7..7cd7f08 100644
--- a/actions/get_asset_jpeg.swift
+++ b/actions/get_asset_jpeg.swift
@@ -131,14 +131,14 @@ let args = parseArgs()
let localIdentifier = args.localIdentifier
let size = args.size
-let asset = getPhoto(withLocalIdentifier: localIdentifier)
-
let thumbnailPath =
"/tmp/photos-reviewer/\(localIdentifier.prefix(1))/\(localIdentifier)_\(size).jpg"
if !FileManager.default.fileExists(atPath: thumbnailPath) {
makeParentDirectory(forPath: thumbnailPath)
+ let asset = getPhoto(withLocalIdentifier: localIdentifier)
+
try! asset
.getImage(atSize: Double(size))
.jpegData()