Skip to content

Commit

Permalink
Reduced temp file size and added error feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
joincodeconda committed Nov 6, 2024
1 parent 8715932 commit c6f2b4d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions MetadataGenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ local function exportJPEG(photo)
LR_export_useSubfolder = false,
LR_export_format = 'JPEG',
LR_export_colorSpace = 'sRGB',
LR_jpeg_quality = 80,
LR_jpeg_limitSize = 0,
LR_export_resolution = 240,
LR_minimizeEmbeddedMetadata = true,
LR_removeLocationMetadata = true,
}
Expand Down Expand Up @@ -149,13 +146,17 @@ function generateMetadata(progress, photo, callback)
if response then
local jsonResponse, _, err = json.decode(response)

if err then
if err or not jsonResponse then
LrDialogs.message("Error", "Failed to parse response from the PhotoTag.ai API. Please try again or contact support.")
progress:done()
return
end

if jsonResponse and jsonResponse.data then
if jsonResponse.error then
LrDialogs.message("Error", jsonResponse.error .. ".")
progress:done()
return
elseif jsonResponse.data then
local title = jsonResponse.data.title
local description = jsonResponse.data.description
local keywords = jsonResponse.data.keywords
Expand Down

0 comments on commit c6f2b4d

Please sign in to comment.