Skip to content

Commit 753b3c8

Browse files
committed
Fix #23 Check / link Piwigo Structure: mistake of using albums from other publishing setup fro same site
1 parent aea24db commit 753b3c8

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

piwigoPublish.lrplugin/Info.lua

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

6060
LrPluginInfoProvider = 'PluginInfo.lua',
6161

62-
VERSION = { major=20260101, minor=20, revision=0 },
62+
VERSION = { major=20260102, minor=21, revision=0 },
6363
}

piwigoPublish.lrplugin/Init.lua

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

7373
_G.PiwigoBusy = false
7474
_G.iconPath = _PLUGIN:resourceId("icons/icon_med.png")
75-
_G.pluginVersion = "20260101.20"
75+
_G.pluginVersion = "20260102.21"
7676
--_G.LocStrings = utils.loadStrings()
7777

piwigoPublish.lrplugin/PiwigoAPI.lua

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ local function normalisePublishService(publishService)
352352
local visit
353353
local visitSet
354354
local visitCollection
355-
log:info("normalisePublishService - processing\n" .. utils.serialiseVar(publishService))
355+
--log:info("normalisePublishService - processing\n" .. utils.serialiseVar(publishService))
356356
-- *************************************************
357357
visit = function (container, parentPath, parentId)
358358
local children = container:getChildCollectionSets()
@@ -542,9 +542,9 @@ local function vps_createMissingPiwigoAlbumsFromIssues(catalog, propertyTable, p
542542
table.sort(missing, function(a, b)
543543
return #a.path < #b.path
544544
end)
545-
log:info("createMissingPiwigoAlbumsFromIssues - missing\n",utils.serialiseVar(missing))
546-
log:info("createMissingPiwigoAlbumsFromIssues - lrIndexByPath\n",utils.serialiseVar(lrIndexByPath))
547-
log:info("createMissingPiwigoAlbumsFromIssues - lrIndexById\n",utils.serialiseVar(lrIndexById))
545+
--log:info("createMissingPiwigoAlbumsFromIssues - missing\n",utils.serialiseVar(missing))
546+
--log:info("createMissingPiwigoAlbumsFromIssues - lrIndexByPath\n",utils.serialiseVar(lrIndexByPath))
547+
--log:info("createMissingPiwigoAlbumsFromIssues - lrIndexById\n",utils.serialiseVar(lrIndexById))
548548
local numCreated = 0
549549
local numFailed = 0
550550
for _, miss in ipairs(missing) do
@@ -886,7 +886,7 @@ function PiwigoAPI.validatePiwigoStructure(propertyTable)
886886

887887
-- compare tables of album paths and ceate table of issues e.g.
888888
local issues = validatePublishAgainstPiwigo(lrIndexByPath, pwIndexByPath)
889-
log:info("PiwigoAPI.validatePiwigoStructure - issues\n" .. utils.serialiseVar(issues))
889+
--log:info("PiwigoAPI.validatePiwigoStructure - issues\n" .. utils.serialiseVar(issues))
890890

891891
-- now process any issues
892892

@@ -950,19 +950,26 @@ end
950950

951951
-- *************************************************
952952
function PiwigoAPI.getPublishService(propertyTable)
953-
-- get reference to publish service matching host and userName in propertyTable
953+
-- get reference to publish service matching name, host and userName in propertyTable
954954
local catalog = LrApplication.activeCatalog()
955955
local services = catalog:getPublishServices()
956-
local thisService
956+
local thisService = nil
957957
local foundService = false
958-
958+
local thisName = propertyTable.LR_publish_connectionName
959+
local thisHost = propertyTable.host
960+
local thisUser = propertyTable.userName
961+
log:info("PiwigoAPI.getPublishService - looking for publish service " .. thisName .. ", thisHost " .. thisHost .. ", user " .. thisUser)
959962
for _, s in ipairs(services) do
960963
local pluginSettings = s:getPublishSettings()
961964
local pluginID = s:getPluginId()
962965
local pluginName = s:getName()
966+
local pluginHost = pluginSettings.host or ""
967+
local pluginUser = pluginSettings.userName or ""
968+
log:info("PiwigoAPI.getPublishService - checking service " .. pluginName .. ", Host " .. pluginHost .. ", user " .. pluginUser)
969+
if (pluginName == thisName) and
970+
(pluginHost == thisHost) and
971+
(pluginUser == thisUser) then
963972

964-
if pluginSettings.host == propertyTable.host and
965-
pluginSettings.userName == propertyTable.userName then
966973
thisService = s
967974
foundService = true
968975
break
@@ -1145,7 +1152,7 @@ function PiwigoAPI.importAlbums(propertyTable)
11451152
local rv
11461153
log:info("PiwigoAPI:importAlbums")
11471154
-- getPublishService to get reference to this publish service - returned in propertyTable._service
1148-
rv = PiwigoAPI.getPublishService(propertyTable, false)
1155+
rv = PiwigoAPI.getPublishService(propertyTable)
11491156
if not rv then
11501157
utils.handleError('PiwigoAPI:importAlbums - cannot find publish service - has it been saved?',
11511158
"Error: Cannot find Piwigo publish service - has it been saved?")
@@ -1855,14 +1862,7 @@ function PiwigoAPI.specialCollections(propertyTable)
18551862
caption = "Starting...",
18561863
functionContext = context,
18571864
}
1858-
--[[
1859-
-- check if scNameFix has been run and run it if not
1860-
if not(propertyTable.scNameFix) then
1861-
log:info("PiwigoAPI.specialCollections - running scNameFix")
1862-
rv = PiwigoAPI.fixSpecialCollectionNames(catalog, publishService, propertyTable)
1863-
propertyTable.scNameFix = true
1864-
end
1865-
]]
1865+
18661866
for s, thisSet in pairs(allSets) do
18671867
progressScope:setPortionComplete(s, #allSets)
18681868
progressScope:setCaption("Processing " .. s .. " of " .. #allSets .. " collction sets")

0 commit comments

Comments
 (0)