Skip to content

Commit ff21256

Browse files
committed
Merge branch 'dev'
2 parents b4259c6 + 46d17fc commit ff21256

17 files changed

Lines changed: 1733 additions & 87 deletions

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ piwigoPublish.lrplugin/PiwigoHelper.lua
1717
cat layout.odt
1818
deploy.sh
1919
diagnostic.txt
20-
copilot-instructions.md
20+
copilot-instructions.md
21+
22+
# i18n
23+
localize_plugin.py
24+
extract_localizable_strings.py
25+
localization_report.txt

Auto_update_documentation.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Auto-Update System for PiwigoPublish Plugin
2+
3+
By Gotcha26 - contact@julien-moreau.fr
4+
5+
## Overview
6+
7+
The auto-update system allows the PiwigoPublish Lightroom plugin to check for new versions via the GitHub Releases API and notify users when updates are available.
8+
9+
## Features
10+
11+
- **Automatic check on startup**: Silent check when Lightroom loads (once per day)
12+
- **Manual check**: Button in Plugin Manager to check on demand
13+
- **Multi-format versioning**: Supports both date-based and SemVer formats
14+
- **Cross-format comparison**: Can compare versions even when switching versioning schemes
15+
- **User-friendly notifications**: Dialog with changelog and download link
16+
17+
## Version Format Support
18+
19+
| Format | Example | Use Case |
20+
|--------|---------|----------|
21+
| Date-based | `20260121.3` or `v20260121.3` | Current format, revision incremented daily |
22+
| SemVer | `1.2.3` or `v1.2.3` | Industry standard, for future migration |
23+
24+
The system automatically detects which format is used and applies the appropriate comparison logic.
25+
26+
### Cross-Format Comparison
27+
28+
When the local and remote versions use different formats, the system falls back to comparing the **GitHub release publish date** (`published_at` metadata) against the **build date** embedded in the local version.
29+
30+
This ensures seamless updates even if the versioning scheme changes in the future.
31+
32+
## Configuration
33+
34+
In `UpdateChecker.lua`, the following constants can be adjusted:
35+
36+
```lua
37+
UpdateChecker.GITHUB_OWNER = "Piwigo" -- GitHub organization/user
38+
UpdateChecker.GITHUB_REPO = "PiwigoPublish-lrc-plugin" -- Repository name
39+
UpdateChecker.CHECK_INTERVAL_DAYS = 1 -- Days between automatic checks
40+
```
41+
42+
## User Interface
43+
44+
### Plugin Manager Section
45+
46+
A new "Plugin Updates" section appears in **File > Plug-in Manager > Piwigo Publisher**:
47+
48+
- Current version display
49+
- Update status indicator
50+
- "Check for Updates" button
51+
- "Visit GitHub Repository" button
52+
53+
### Update Notification Dialog
54+
55+
When an update is available, users see:
56+
57+
- Current vs. new version comparison
58+
- Changelog excerpt (first 500 characters)
59+
- "Download" button → opens GitHub release page
60+
- "Later" button → dismisses until next check
61+
62+
## Creating a New Release
63+
64+
1. Update `VERSION` in `Info.lua`:
65+
```lua
66+
VERSION = { major=20260122, minor=1, revision=0 },
67+
```
68+
69+
2. Commit and push changes
70+
71+
3. Create a GitHub Release:
72+
- **Tag**: `v20260122.1` (or `v1.0.0` for SemVer)
73+
- **Title**: Version number or descriptive title
74+
- **Description**: Changelog in Markdown format
75+
76+
4. The plugin will automatically detect the new release
77+
78+
## Technical Details
79+
80+
### API Endpoint
81+
82+
```
83+
GET https://api.github.com/repos/{owner}/{repo}/releases/latest
84+
```
85+
86+
### Response Fields Used
87+
88+
| Field | Purpose |
89+
|-------|---------|
90+
| `tag_name` | Version identifier |
91+
| `published_at` | Release date (ISO 8601) for cross-format comparison |
92+
| `body` | Changelog content (Markdown) |
93+
| `html_url` | Download page URL |
94+
95+
### Storage (LrPrefs)
96+
97+
| Key | Purpose |
98+
|-----|---------|
99+
| `lastUpdateCheck` | Timestamp of last check |
100+
| `latestVersion` | Cached latest version string |
101+
| `latestVersionUrl` | Cached download URL |
102+
| `pluginBuildDate` | Build date for SemVer installations |
103+
104+
## Functions Reference
105+
106+
| Function | Description |
107+
|----------|-------------|
108+
| `parseVersion(versionStr)` | Converts version string to comparable number |
109+
| `parseGitHubDate(dateStr)` | Parses ISO 8601 date to timestamp |
110+
| `getInstalledVersionDate()` | Extracts build date from installed version |
111+
| `shouldCheckForUpdates()` | Checks if interval has elapsed |
112+
| `checkForUpdates(silent)` | Main update check logic |
113+
| `openDownloadPage(url)` | Opens browser to download page |
114+
| `getUpdateStatus()` | Returns status string for UI |
115+
116+
## Future Considerations
117+
118+
- **Migration to SemVer**: The system is ready for a versioning scheme change without breaking update detection
119+
- **Pre-release support**: Could be extended to check for beta/RC releases via `prerelease` flag
120+
- **Auto-download**: Could be enhanced to download and extract updates automatically (requires additional permissions)
121+
122+
## Files Modified
123+
124+
| File | Changes |
125+
|------|---------|
126+
| `UpdateChecker.lua` | New file - update checking logic |
127+
| `Init.lua` | Added require and startup check |
128+
| `PluginInfoDialogSections.lua` | Added "Plugin Updates" UI section |
129+
| `Info.lua` | VERSION table (existing, used as source of truth) |

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ You should have received a copy of the GNU General Public License along with thi
2222

2323
As a user of both Lightroom Classic and Piwigo, the ability use the powerful Publishing Service in LrC to keep my Piwigo galleries up to date is very appealing. I've been a long time user of a popular plugin that has been providing this functionality, but unfortunately since the version 15 release of LrC that has not been available.
2424

25-
This plugin is my attempt to allow me to continue publishing to Piwigo from LrC, and I have looked at the work of others for help and ideas in developing this plugin. In particular, the following should be credited:
25+
This plugin was developed to allow me to continue publishing to Piwigo from LrC, and I have looked at the work of others for help and ideas in developing this plugin. In particular, the following should be credited:
2626

2727
[All the contributers to Piwigo](https://piwigo.org/)
2828

29+
[Julien Moreau for contributing various improvements](https://julien-moreau.fr/)
30+
2931
[Jeffrey Friedl for JSON.lua](http://regex.info/blog/lua/json)
3032

3133
[Bastian Machek with his Immich Plugin](https://github.com/bmachek/lrc-immich-plugin)

piwigoPublish.lrplugin/Info.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ return {
2525
LrPluginName = "Piwigo Publisher",
2626
-- typo in PwigoPublish is noted but can't be changed without forcing all services using this plugin to be re-initialised.
2727
LrToolkitIdentifier = "fiona.boston.PwigoPublish",
28-
-- LrToolkitIdentifier = "fiona.boston.PiwigoPublish",
2928
LrMetadataProvider = 'CustomMetadata.lua',
3029
LrMetadataTagsetFactory = 'Tagset.lua',
3130
LrInitPlugin = "Init.lua",
@@ -67,5 +66,5 @@ return {
6766

6867
LrPluginInfoProvider = 'PluginInfo.lua',
6968

70-
VERSION = { major=20260122, minor=27, revision=0 },
69+
VERSION = { major=20260124, minor=28, revision=0 },
7170
}

piwigoPublish.lrplugin/Init.lua

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,28 @@ else
7373
end
7474

7575
_G.iconPath = _PLUGIN:resourceId("icons/icon_med.png")
76-
_G.pluginVersion = "20260122.27"
77-
--_G.LocStrings = utils.loadStrings()
76+
77+
-- Build version string from Info.lua VERSION table
78+
--local versionInfo = _PLUGIN.VERSION or { major = 0, minor = 0, revision = 0 }
79+
-- _PLUGIN.VERSION is nil here for some reason, so hardcoding for now
80+
-- just need to ensure both places are updated together
81+
82+
_G.versionInfo = { major=20260122, minor=27, revision=0 }
83+
84+
_G.pluginVersion = string.format("%d.%d", versionInfo.major, versionInfo.minor)
85+
-- Auto-update checker
86+
_G.UpdateChecker = require "UpdateChecker"
87+
88+
-- Check for updates on plugin load (silent check)
89+
LrTasks.startAsyncTask(function()
90+
-- Wait for Lightroom to fully load
91+
LrTasks.sleep(5)
92+
93+
-- Only check if interval has passed
94+
if UpdateChecker.shouldCheckForUpdates() then
95+
log:info("Init - performing automatic update check")
96+
UpdateChecker.checkForUpdates(true) -- silent = true
97+
end
98+
end)
99+
78100

0 commit comments

Comments
 (0)