Skip to content

Commit d1778cf

Browse files
committed
Fix - Set Piwigo Album Cover from Selected Photo would only allow setting the cover for the selected photo's album or immediate parent.
1 parent 7ae11bc commit d1778cf

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## [20251223.15] - 2025-12-23
3+
### Fixed
4+
- Set Piwigo Album Cover from Selected Photo would only allow setting the cover for the selected photo's album or immediate parent. This fix allow any album cover in the selected photo's album hierarchy to be set to the selected photo
5+
26
## [20251219.14] - 2025-12-19
37
### Added
48
- A new menu item has been added Library->Plug-in Extras->Piwigo Publisher->Convert selected Published Collection to Published Collection Set. This option enables a Publish Collection to be converted to a Publish Collection Set, enabling sub albums to be created under this album.

piwigoPublish.lrplugin/Info.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ return {
5757

5858
LrPluginInfoProvider = 'PluginInfo.lua',
5959

60-
VERSION = { major=20251219, minor=14, revision=0 },
60+
VERSION = { major=20251223, minor=15, revision=0 },
6161
}

piwigoPublish.lrplugin/Init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ end
7272

7373
_G.PiwigoBusy = false
7474
_G.iconPath = _PLUGIN:resourceId("icons/icon_med.png")
75-
_G.pluginVersion = "20251219.14"
75+
_G.pluginVersion = "20251223.15"
7676

piwigoPublish.lrplugin/utils.lua

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,10 @@ end
406406
-- *************************************************
407407
function utils.findPhotoInCollectionSet(pubCollOrSet, selPhoto)
408408
-- recursivly search published collection set hierarchy for a photo and return publishedphoto object
409-
log:info("utils.findPhotoInCollectionSet - pubCollOrSet " .. pubCollOrSet:getName() .. ", selPhoto " .. selPhoto.localIdentifier)
409+
--log:info("utils.findPhotoInCollectionSet - pubCollOrSet " .. pubCollOrSet:getName() .. ", selPhoto " .. selPhoto.localIdentifier)
410410

411411
if pubCollOrSet:type() == "LrPublishedCollection" then
412+
log:info("utils.findPhotoInCollectionSet - searching in LrPublishedCollection " .. pubCollOrSet:getName())
412413
-- publishedcollection - look for photo
413414
local publishedPhotos = pubCollOrSet:getPublishedPhotos()
414415
local thisPubPhoto = nil
@@ -422,12 +423,26 @@ function utils.findPhotoInCollectionSet(pubCollOrSet, selPhoto)
422423
end
423424

424425
if pubCollOrSet:type() == "LrPublishedCollectionSet" then
425-
-- publishedcollectionset - Search child sets recursively
426+
-- publishedcollectionset - Search child collections recursively
426427
if pubCollOrSet:getChildCollections() then
427-
local collSets = pubCollOrSet:getChildCollections()
428-
if collSets then
429-
for _, set in ipairs(collSets) do
430-
local thisPubPhoto = utils.findPhotoInCollectionSet(set, selPhoto)
428+
--log:info("utils.findPhotoInCollectionSet - searching in child collections of " .. pubCollOrSet:getName())
429+
local childColls = pubCollOrSet:getChildCollections()
430+
if childColls then
431+
for _, childCol in ipairs(childColls) do
432+
local thisPubPhoto = utils.findPhotoInCollectionSet(childCol, selPhoto)
433+
if thisPubPhoto then
434+
return thisPubPhoto
435+
end
436+
end
437+
end
438+
end
439+
-- search child collection sets
440+
if pubCollOrSet:getChildCollectionSets() then
441+
--log:info("utils.findPhotoInCollectionSet - searching in child collection sets of " .. pubCollOrSet:getName())
442+
local childSets = pubCollOrSet:getChildCollectionSets()
443+
if childSets then
444+
for _,childSet in pairs(childSets) do
445+
local thisPubPhoto = utils.findPhotoInCollectionSet(childSet, selPhoto)
431446
if thisPubPhoto then
432447
return thisPubPhoto
433448
end

0 commit comments

Comments
 (0)