Skip to content

Commit 6bd86e3

Browse files
committed
Merge branch 'feature-tf'
2 parents 5046dc8 + e92841c commit 6bd86e3

12 files changed

Lines changed: 2527 additions & 1129 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ cat layout.odt
2424
deploy.sh
2525
diagnostic.txt
2626
copilot-instructions.md
27+
DEBUG-TODO.md
2728

2829
# Temporary folder for localisation tools
2930
piwigoPublish.lrplugin/__i18n_tmp__/

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Changelog
22
## [20269999.99]
3+
### Fixed
4+
Fix #45 Unable to remove photos from Piwigo
5+
Associating an existing image with a new album should force re-upload of image if it had been changed in LrC since first upload to Piwigo
36
### Added
4-
Updated Plugin-Manager screen
5-
7+
Fix #12 Feature request: Keyword removal by filtering when publising images to Piwigo
8+
Image assoication behaviour made optional to allow per-album custom export settings
69

710
## [20260221.33] - 2026-02-21
811
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please see the [Wiki](https://github.com/Piwigo/PiwigoPublish-lrc-plugin/wiki) f
88

99
## Disclaimer
1010

11-
With the exception of JSON.lua, Copyright 2010-2017 Jeffrey Friedl, which is released under a Creative Commons CC-BY "Attribution" License: http://creativecommons.org/licenses/by/3.0/deed.en_US, this software is released under the GNU General Public License version 3 as published by the Free Software Foundation.
11+
With the exception of JSON.lua, Copyright 2010-2017 Jeffrey Friedl, which is released under a Creative Commons CC-BY "Attribution" License: http://creativecommons.org/licenses/by/3.0/deed.en_US, and md5.lua, Copyright (c) 2013 Enrique García Cota + Adam Baldwin + hanzao + Equi 4 Software which is released under an MIT license, this software is released under the GNU General Public License version 3 as published by the Free Software Foundation.
1212

1313
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
1414

piwigoPublish.lrplugin/PWSendMetadata.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,14 @@ local function SendMetadata()
102102
end
103103
callStatus = {}
104104
local metaData = {}
105-
105+
local collectionSettings = {}
106+
-- todo - get collections for collection this photo is in so collection level overrides can be applied when building metadata structure
106107
-- build metadata structure
107-
metaData = utils.getPhotoMetadata(publishSettings, lrPhoto)
108+
metaData = utils.getPhotoMetadata(publishSettings, lrPhoto, collectionSettings)
108109
metaData.Remoteid = remoteId
109110

111+
-- get keyword filters from publishSettings and build include / exclude patterns
112+
110113
callStatus = PiwigoAPI.updateMetadata(publishSettings, lrPhoto, metaData)
111114
if not callStatus.status then
112115
LrDialogs.message("Unable to set metadata for uploaded photo - " .. callStatus.statusMsg)

piwigoPublish.lrplugin/PiwigoAPI.lua

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ function PiwigoAPI.getInfos(propertyTable)
14351435
log:info("PiwigoAPI.getInfos - headers\n" .. utils.serialiseVar(headers))
14361436
log:info("PiwigoAPI.getInfos - getResponse\n" .. utils.serialiseVar(getResponse))
14371437
LrDialogs.message("PiwigoAPI.getInfos - Cannot get host information from Piwigo - " ..
1438-
(getResponse.errorMessage or "Unknown error"))
1438+
(getResponse.errorMessage or "Unknown error"))
14391439
return false
14401440
end
14411441

@@ -2142,36 +2142,43 @@ function PiwigoAPI.dissociateImageFromCategory(propertyTable, imageId, categoryI
21422142
end
21432143

21442144
log:info("PiwigoAPI.dissociateImageFromCategory - remaining categories: " .. #newCategoryIds)
2145-
2145+
callStatus.deletedImage = false
21462146
-- If image would be orphaned (no remaining categories), delete it entirely
21472147
if #newCategoryIds == 0 then
21482148
log:info("PiwigoAPI.dissociateImageFromCategory - image would be orphaned, deleting entirely")
2149-
return PiwigoAPI.deletePhoto(propertyTable, categoryId, imageId, callStatus)
2150-
end
2151-
2152-
-- Update image with new categories list (replaces all associations)
2153-
local categoriesStr = table.concat(newCategoryIds, ";")
2149+
local delcallStatus = PiwigoAPI.deletePhoto(propertyTable, categoryId, imageId, callStatus)
2150+
if delcallStatus.status then
2151+
callStatus.status = true
2152+
callStatus.statusMsg = "Image removed from category and deleted (was orphaned)"
2153+
else
2154+
callStatus.statusMsg = delcallStatus.statusMsg or "Failed to delete orphaned image"
2155+
end
21542156

2155-
local params = {
2156-
{ name = "method", value = "pwg.images.setInfo" },
2157-
{ name = "image_id", value = tostring(imageId) },
2158-
{ name = "categories", value = categoriesStr },
2159-
{ name = "multiple_value_mode", value = "replace" },
2160-
{ name = "pwg_token", value = propertyTable.token }
2161-
}
2157+
callStatus.deletedImage = true
2158+
else
2159+
-- Update image with new categories list (replaces all associations)
2160+
local categoriesStr = table.concat(newCategoryIds, ";")
2161+
2162+
local params = {
2163+
{ name = "method", value = "pwg.images.setInfo" },
2164+
{ name = "image_id", value = tostring(imageId) },
2165+
{ name = "categories", value = categoriesStr },
2166+
{ name = "multiple_value_mode", value = "replace" },
2167+
{ name = "pwg_token", value = propertyTable.token }
2168+
}
21622169

2163-
log:info("PiwigoAPI.dissociateImageFromCategory - new categories string: " .. categoriesStr)
2170+
log:info("PiwigoAPI.dissociateImageFromCategory - new categories string: " .. categoriesStr)
21642171

2165-
local postResponse = PiwigoAPI.httpPostMultiPart(propertyTable, params)
2172+
local postResponse = PiwigoAPI.httpPostMultiPart(propertyTable, params)
21662173

2167-
if postResponse.status then
2168-
callStatus.status = true
2169-
log:info("PiwigoAPI.dissociateImageFromCategory - success")
2170-
else
2171-
callStatus.statusMsg = postResponse.statusMsg or "Dissociation failed"
2172-
log:info("PiwigoAPI.dissociateImageFromCategory - failed: " .. callStatus.statusMsg)
2174+
if postResponse.status then
2175+
callStatus.status = true
2176+
log:info("PiwigoAPI.dissociateImageFromCategory - success")
2177+
else
2178+
callStatus.statusMsg = postResponse.statusMsg or "Dissociation failed"
2179+
log:info("PiwigoAPI.dissociateImageFromCategory - failed: " .. callStatus.statusMsg)
2180+
end
21732181
end
2174-
21752182
return callStatus
21762183
end
21772184

@@ -2326,10 +2333,10 @@ function PiwigoAPI.updateGallery(propertyTable, exportFilename, metaData)
23262333
end
23272334
if not (uploadSuccess) then
23282335
if httpHeaders.error then
2329-
statusDes = httpHeaders.error.name
2336+
statusDes = httpHeaders.error.name or ""
23302337
status = httpHeaders.error.errorCode
23312338
else
2332-
statusDes = httpHeaders.statusDes
2339+
statusDes = httpHeaders.statusDes or ""
23332340
status = httpHeaders.status
23342341
end
23352342
LrDialogs.message("Cannot upload - " .. metaData.fileName .. " to Piwigo - " .. status, statusDes)
@@ -2523,15 +2530,17 @@ function PiwigoAPI.deletePhoto(propertyTable, pwCatID, pwImageID, callStatus)
25232530
callStatus.status = true
25242531
callStatus.statusMsg = ""
25252532
else
2526-
log:info("PiwigoAPI.deletePhoto - propertyTable \n " .. utils.serialiseVar(utils.anonymisePropertyTable(propertyTable)))
2533+
log:info("PiwigoAPI.deletePhoto - propertyTable \n " ..
2534+
utils.serialiseVar(utils.anonymisePropertyTable(propertyTable)))
25272535
log:info("PiwigoAPI.deletePhoto - params \n" .. utils.serialiseVar(params))
25282536
log:info("PiwigoAPI.deletePhoto - httpResponse \n" .. utils.serialiseVar(httpResponse))
25292537
log:info("PiwigoAPI.deletePhoto - httpHeaders \n" .. utils.serialiseVar(httpHeaders))
25302538
callStatus.status = false
25312539
callStatus.statusMsg = body.message or ""
25322540
end
25332541
else
2534-
log:info("PiwigoAPI.deletePhoto - propertyTable \n " .. utils.serialiseVar(utils.anonymisePropertyTable(propertyTable)))
2542+
log:info("PiwigoAPI.deletePhoto - propertyTable \n " ..
2543+
utils.serialiseVar(utils.anonymisePropertyTable(propertyTable)))
25352544
log:info("PiwigoAPI.deletePhoto - params \n" .. utils.serialiseVar(params))
25362545
log:info("PiwigoAPI.deletePhoto - httpResponse \n" .. utils.serialiseVar(httpResponse))
25372546
log:info("PiwigoAPI.deletePhoto - httpHeaders \n" .. utils.serialiseVar(httpHeaders))
@@ -2635,7 +2644,8 @@ function PiwigoAPI.addComment(publishSettings, metaData)
26352644
-- get antispam token from image details (unique for each image)
26362645
local rtnStatus = PiwigoAPI.checkPhoto(publishSettings, metaData.remoteId)
26372646
if not rtnStatus.status then
2638-
log:info("PiwigoAPI.addComment - unanble to retrieve token\n" .. utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
2647+
log:info("PiwigoAPI.addComment - unanble to retrieve token\n" ..
2648+
utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
26392649
return false
26402650
end
26412651
local imageDets = rtnStatus.imageDets
@@ -2658,11 +2668,13 @@ function PiwigoAPI.addComment(publishSettings, metaData)
26582668
return false
26592669
end
26602670
if utils.nilOrEmpty(author) then
2661-
log:info("PiwigoAPI.addComment - missing author\n" .. utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
2671+
log:info("PiwigoAPI.addComment - missing author\n" ..
2672+
utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
26622673
return false
26632674
end
26642675
if utils.nilOrEmpty(key) then
2665-
log:info("PiwigoAPI.addComment - missing key\n" .. utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
2676+
log:info("PiwigoAPI.addComment - missing key\n" ..
2677+
utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
26662678
return false
26672679
end
26682680
-- Piwigo antispam forces a delay between the key being created and used
@@ -2759,7 +2771,7 @@ function PiwigoAPI.setAlbumCover(publishService)
27592771
log:info("publishservice" .. publishService:getName())
27602772
local catalog = LrApplication.activeCatalog()
27612773
local publishSettings = publishService:getPublishSettings()
2762-
log:info("publishSettings\n" .. utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
2774+
log:info("publishSettings\n" .. utils.serialiseVar(utils.anonymisePropertyTable(publishSettings)))
27632775

27642776
if not publishSettings then
27652777
LrDialogs.message("PiwigoAPI.setAlbumCover - Can't find PublishSettings for this publish collection", "",

piwigoPublish.lrplugin/PluginInfoDialogSections.lua

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ function PluginInfoDialogSections.startDialog(propertyTable)
6464
if prefs.debugToFile == nil then
6565
prefs.debugToFile = false
6666
end
67-
67+
if prefs.debugFailedUpload == nil then
68+
prefs.debugFailedUpload = false
69+
end
6870
-- Initialize update check preference
6971
if prefs.checkUpdatesOnStartup == nil then
7072
prefs.checkUpdatesOnStartup = true
@@ -84,6 +86,8 @@ function PluginInfoDialogSections.startDialog(propertyTable)
8486
propertyTable.debugEnabled = prefs.debugEnabled
8587
propertyTable.debugToFile = prefs.debugToFile
8688
propertyTable.checkUpdatesOnStartup = prefs.checkUpdatesOnStartup
89+
propertyTable.debugFailedUpload = prefs.debugFailedUpload
90+
8791
end
8892

8993
-- *************************************************
@@ -125,7 +129,7 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
125129
title = "Piwigo Publisher",
126130
font = "<system/bold>",
127131
alignment = 'left',
128-
width = 250,
132+
width = 250,
129133
},
130134

131135
-- Version @ UpdateStatus on one line, red if not up to date
@@ -166,7 +170,7 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
166170
f:row {
167171
f:static_text {
168172
title = "Made in England with cider and cheddar cheese in Somerset,\n" ..
169-
"the Land of the Summer People.",
173+
"the Land of the Summer People.",
170174
font = "<system/small>",
171175
text_color = LrColor(0.5, 0.5, 0.5),
172176
alignment = 'center',
@@ -289,7 +293,7 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
289293
fill_horizontal = 1,
290294
f:static_text {
291295
title = "If you experience a problem, enable logging below and reproduce the issue.\n" ..
292-
"You can then share the log with support.",
296+
"You can then share the log with support.",
293297
fill_horizontal = 1,
294298
height_in_lines = 2,
295299
alignment = 'left',
@@ -334,6 +338,21 @@ function PluginInfoDialogSections.sectionsForTopOfDialog(f, propertyTable)
334338
width_in_chars = 40,
335339
},
336340
},
341+
342+
f:row {
343+
f:checkbox {
344+
value = bind 'debugFailedUpload',
345+
enabled = bind 'debugEnabled',
346+
},
347+
f:static_text {
348+
title = "Log extra information for failed uploads (creates PiwigoPublishDebug folder on your desktop)",
349+
alignment = 'left',
350+
fill_horizontal = 1,
351+
width_in_chars = 40,
352+
},
353+
},
354+
355+
337356
},
338357

339358
-- Unsafe / developer group box

0 commit comments

Comments
 (0)