pibooth-gallery 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 peteoheat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include LICENSE README.md
2
+ include plain_gallery_template.html
3
+ include seasonal_snowflake_gallery_auto_update_template.html
4
+ include candy_cane_lane_gallery.html
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: pibooth-gallery
3
+ Version: 1.3.0
4
+ Summary: pibooth plugin: thumbnails, thumbs.json manifest and static web gallery for event photobooths
5
+ Author: peteoheat
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/peteoheat/pibooth-gallery
8
+ Project-URL: Issues, https://github.com/peteoheat/pibooth-gallery/issues
9
+ Keywords: pibooth,photobooth,raspberrypi,gallery,thumbnails,plugin
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Other Environment
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Multimedia :: Graphics
16
+ Requires-Python: >=3.7
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: pibooth>=2.0.0
20
+ Requires-Dist: Pillow
21
+ Dynamic: license-file
22
+
23
+ # pibooth-gallery
24
+
25
+ A plugin for [pibooth](https://github.com/pibooth/pibooth) that, after each final picture is saved:
26
+
27
+ 1. creates a thumbnail,
28
+ 2. creates/updates a `thumbs.json` manifest next to the pictures (newest first, with an optional QR code entry),
29
+ 3. optionally copies a static gallery HTML template beside the pictures as `gallery.html`.
30
+
31
+ It is designed to work with [pibooth-rclone-upload](https://github.com/peteoheat/pibooth-rclone-upload) (uploads the picture folder to a web host or S3) and my fork of [pibooth-qrcode](https://github.com/peteoheat/pibooth-qrcode).
32
+
33
+ Together they give you a workflow where:
34
+
35
+ 1. Final images are uploaded to a website or S3 bucket and are viewable in a browser.
36
+ 2. QR codes are created and uploaded with each image, enabling direct download.
37
+ 3. A web gallery lets guests scroll through all uploaded images for an event.
38
+
39
+ Optionally, [gallery-protect](https://github.com/peteoheat/gallery-protect) is a Cloudflare worker that password-protects the gallery so only people with the password can view/download images.
40
+
41
+ ## Installation
42
+
43
+ Requires Python 3.7+, `pibooth` and `Pillow` (both installed automatically by pip).
44
+
45
+ The plugin must be installed **into the same Python environment that pibooth runs from**. pibooth discovers it automatically through its `pibooth` entry point, so no extra configuration is needed to load it.
46
+
47
+ ### Raspberry Pi OS Bookworm / Trixie (virtual environment)
48
+
49
+ Since Bookworm, Raspberry Pi OS marks the system Python as "externally managed" (PEP 668), so `pip install` outside a virtual environment fails with `error: externally-managed-environment`. Do **not** work around this with `--break-system-packages`; install into the virtual environment that pibooth uses instead.
50
+
51
+ 1. Activate the virtual environment pibooth is installed in. Use whatever path you created it at; `~/venv` is used here as an example:
52
+
53
+ ```bash
54
+ source ~/venv/bin/activate
55
+ ```
56
+
57
+ Your prompt should now start with `(venv)`. To check that this is the right environment, `pip show pibooth` should print pibooth's details.
58
+
59
+ If you have not set up pibooth yet, create the environment first. `--system-site-packages` lets it use the Raspberry Pi camera libraries (`picamera2`) installed by apt:
60
+
61
+ ```bash
62
+ python3 -m venv --system-site-packages ~/venv
63
+ source ~/venv/bin/activate
64
+ pip install pibooth
65
+ ```
66
+
67
+ 2. Install the plugin from PyPI:
68
+
69
+ ```bash
70
+ pip install pibooth-gallery
71
+ ```
72
+
73
+ 3. Check that pibooth sees it:
74
+
75
+ ```bash
76
+ pibooth --diagnostic
77
+ ```
78
+
79
+ or start pibooth and look for `pibooth_gallery` in the loaded plugins list in the log.
80
+
81
+ To upgrade later (with the environment activated):
82
+
83
+ ```bash
84
+ pip install --upgrade pibooth-gallery
85
+ ```
86
+
87
+ If pibooth is launched automatically (autostart, systemd, cron), make sure the launcher uses the venv's interpreter, e.g. `~/venv/bin/pibooth`, otherwise the plugin will not be found.
88
+
89
+ ### Other systems
90
+
91
+ ```bash
92
+ pip install pibooth-gallery
93
+ ```
94
+
95
+ (inside a virtual environment, or on a system where pip is not externally managed).
96
+
97
+ ### From source
98
+
99
+ ```bash
100
+ git clone https://github.com/peteoheat/pibooth-gallery.git
101
+ pip install ./pibooth-gallery
102
+ ```
103
+
104
+ ### Gallery HTML templates
105
+
106
+ The HTML templates (`plain_gallery_template.html`, `seasonal_snowflake_gallery_auto_update_template.html`, `candy_cane_lane_gallery.html`) are not installed into Python's site-packages. Download the one you want from the [GitHub repository](https://github.com/peteoheat/pibooth-gallery), edit the event-specific values in it (e.g. `IMAGE_HOST_BASE`, titles), and point `template` at it in `pibooth.cfg`.
107
+
108
+ ## Configuration
109
+
110
+ After the first run, pibooth adds a `[GALLERY]` section to `~/.config/pibooth/pibooth.cfg` (you can also edit it with `pibooth --config`). Option names are lower case; there is no "enable" option. To disable the plugin, list `pibooth_gallery` in `[GENERAL]` `plugins_disabled`.
111
+
112
+ ```ini
113
+ [GALLERY]
114
+ size = 300x300
115
+ suffix = _thumb
116
+ quality = 85
117
+ output_folder =
118
+ keep_aspect = True
119
+
120
+ update_manifest = True
121
+ manifest_name = thumbs.json
122
+ manifest_include_base_url = True
123
+
124
+ template = /home/pi/gallery_template.html
125
+ output = gallery.html
126
+
127
+ base_url = https://example.com/event123/
128
+ ```
129
+
130
+ | Option | Default | Description |
131
+ |---|---|---|
132
+ | `size` | `300x300` | Thumbnail size as `WxH`. |
133
+ | `suffix` | `_thumb` | Suffix appended to the thumbnail filename. |
134
+ | `quality` | `85` | JPEG quality for thumbnails. |
135
+ | `output_folder` | *(empty)* | Optional subfolder for thumbnails. Leave empty when using pibooth-rclone-upload, which does not upload subfolders. |
136
+ | `keep_aspect` | `True` | Keep the aspect ratio when resizing. |
137
+ | `update_manifest` | `True` | Create/update the manifest after each picture. |
138
+ | `manifest_name` | `thumbs.json` | Manifest filename, written next to the pictures. |
139
+ | `manifest_include_base_url` | `True` | Prefix manifest entries with `base_url`. |
140
+ | `template` | *(empty)* | Optional path to a gallery HTML template to copy beside the pictures. |
141
+ | `output` | `gallery.html` | Filename for the copied template. |
142
+ | `base_url` | *(empty)* | Base URL for manifest entries. Falls back to `[DOWNLOADER]` `base_url`. |
143
+
144
+ ### QR code integration
145
+
146
+ This plugin never adds or modifies `[QRCODE]` settings. To find a picture's QR code it uses, in order:
147
+
148
+ 1. the `qrcode_path` recorded in pibooth's picture metadata, then
149
+ 2. `<picture name><suffix>.<ext>` (from `[QRCODE]` `suffix`/`ext`, default `_qrcode` / `png`), searched in `[QRCODE]` `save_path`, the `[GENERAL]` `directory` entries, then the picture's own folder.
150
+
151
+ The QR image is already on disk when this plugin runs, so no waiting is needed.
152
+
153
+ ## How it works
154
+
155
+ 1. pibooth saves the final picture.
156
+ 2. On leaving the processing state, pibooth-gallery (running before other plugins, so uploaders see its output):
157
+ * creates the thumbnail,
158
+ * sets `previous_thumbnail_file` on the pibooth app for other plugins,
159
+ * updates or creates `thumbs.json`,
160
+ * optionally writes `gallery.html` from the template.
161
+ 3. All files are written atomically, so an uploader never sees a partial file. A corrupt manifest is moved to `thumbs.json.bak` rather than overwritten. Errors are logged and never interrupt pibooth.
162
+
163
+ ## Manifest format
164
+
165
+ `thumbs.json` is a list, newest first:
166
+
167
+ ```json
168
+ [
169
+ {
170
+ "thumb": "IMG_001_thumb.jpg",
171
+ "full": "IMG_001.jpg",
172
+ "filename": "IMG_001.jpg",
173
+ "qrcode": "IMG_001_qrcode.png"
174
+ }
175
+ ]
176
+ ```
177
+
178
+ With `manifest_include_base_url = True` and a `base_url`, `thumb`, `full` and `qrcode` become absolute URLs such as `https://example.com/event123/IMG_001.jpg`.
179
+
180
+ ## Publishing to PyPI (maintainers)
181
+
182
+ The package version comes from `__version__` in `pibooth_gallery.py`.
183
+
184
+ ```bash
185
+ # 1. bump __version__ in pibooth_gallery.py, commit and tag
186
+ python -m pip install --upgrade build twine
187
+ python -m build # creates dist/*.tar.gz and dist/*.whl
188
+ python -m twine check dist/*
189
+
190
+ # 2. optional dry run on TestPyPI
191
+ python -m twine upload --repository testpypi dist/*
192
+
193
+ # 3. publish (use a PyPI API token: username __token__)
194
+ python -m twine upload dist/*
195
+ ```
196
+
197
+ PyPI never allows a version to be re-uploaded, so bump the version for every release.
198
+
199
+ ## Contributing
200
+
201
+ Pull requests are welcome. Please open an issue for feature requests or bug reports.
202
+
203
+ ## License
204
+
205
+ MIT, see [LICENSE](LICENSE).
@@ -0,0 +1,183 @@
1
+ # pibooth-gallery
2
+
3
+ A plugin for [pibooth](https://github.com/pibooth/pibooth) that, after each final picture is saved:
4
+
5
+ 1. creates a thumbnail,
6
+ 2. creates/updates a `thumbs.json` manifest next to the pictures (newest first, with an optional QR code entry),
7
+ 3. optionally copies a static gallery HTML template beside the pictures as `gallery.html`.
8
+
9
+ It is designed to work with [pibooth-rclone-upload](https://github.com/peteoheat/pibooth-rclone-upload) (uploads the picture folder to a web host or S3) and my fork of [pibooth-qrcode](https://github.com/peteoheat/pibooth-qrcode).
10
+
11
+ Together they give you a workflow where:
12
+
13
+ 1. Final images are uploaded to a website or S3 bucket and are viewable in a browser.
14
+ 2. QR codes are created and uploaded with each image, enabling direct download.
15
+ 3. A web gallery lets guests scroll through all uploaded images for an event.
16
+
17
+ Optionally, [gallery-protect](https://github.com/peteoheat/gallery-protect) is a Cloudflare worker that password-protects the gallery so only people with the password can view/download images.
18
+
19
+ ## Installation
20
+
21
+ Requires Python 3.7+, `pibooth` and `Pillow` (both installed automatically by pip).
22
+
23
+ The plugin must be installed **into the same Python environment that pibooth runs from**. pibooth discovers it automatically through its `pibooth` entry point, so no extra configuration is needed to load it.
24
+
25
+ ### Raspberry Pi OS Bookworm / Trixie (virtual environment)
26
+
27
+ Since Bookworm, Raspberry Pi OS marks the system Python as "externally managed" (PEP 668), so `pip install` outside a virtual environment fails with `error: externally-managed-environment`. Do **not** work around this with `--break-system-packages`; install into the virtual environment that pibooth uses instead.
28
+
29
+ 1. Activate the virtual environment pibooth is installed in. Use whatever path you created it at; `~/venv` is used here as an example:
30
+
31
+ ```bash
32
+ source ~/venv/bin/activate
33
+ ```
34
+
35
+ Your prompt should now start with `(venv)`. To check that this is the right environment, `pip show pibooth` should print pibooth's details.
36
+
37
+ If you have not set up pibooth yet, create the environment first. `--system-site-packages` lets it use the Raspberry Pi camera libraries (`picamera2`) installed by apt:
38
+
39
+ ```bash
40
+ python3 -m venv --system-site-packages ~/venv
41
+ source ~/venv/bin/activate
42
+ pip install pibooth
43
+ ```
44
+
45
+ 2. Install the plugin from PyPI:
46
+
47
+ ```bash
48
+ pip install pibooth-gallery
49
+ ```
50
+
51
+ 3. Check that pibooth sees it:
52
+
53
+ ```bash
54
+ pibooth --diagnostic
55
+ ```
56
+
57
+ or start pibooth and look for `pibooth_gallery` in the loaded plugins list in the log.
58
+
59
+ To upgrade later (with the environment activated):
60
+
61
+ ```bash
62
+ pip install --upgrade pibooth-gallery
63
+ ```
64
+
65
+ If pibooth is launched automatically (autostart, systemd, cron), make sure the launcher uses the venv's interpreter, e.g. `~/venv/bin/pibooth`, otherwise the plugin will not be found.
66
+
67
+ ### Other systems
68
+
69
+ ```bash
70
+ pip install pibooth-gallery
71
+ ```
72
+
73
+ (inside a virtual environment, or on a system where pip is not externally managed).
74
+
75
+ ### From source
76
+
77
+ ```bash
78
+ git clone https://github.com/peteoheat/pibooth-gallery.git
79
+ pip install ./pibooth-gallery
80
+ ```
81
+
82
+ ### Gallery HTML templates
83
+
84
+ The HTML templates (`plain_gallery_template.html`, `seasonal_snowflake_gallery_auto_update_template.html`, `candy_cane_lane_gallery.html`) are not installed into Python's site-packages. Download the one you want from the [GitHub repository](https://github.com/peteoheat/pibooth-gallery), edit the event-specific values in it (e.g. `IMAGE_HOST_BASE`, titles), and point `template` at it in `pibooth.cfg`.
85
+
86
+ ## Configuration
87
+
88
+ After the first run, pibooth adds a `[GALLERY]` section to `~/.config/pibooth/pibooth.cfg` (you can also edit it with `pibooth --config`). Option names are lower case; there is no "enable" option. To disable the plugin, list `pibooth_gallery` in `[GENERAL]` `plugins_disabled`.
89
+
90
+ ```ini
91
+ [GALLERY]
92
+ size = 300x300
93
+ suffix = _thumb
94
+ quality = 85
95
+ output_folder =
96
+ keep_aspect = True
97
+
98
+ update_manifest = True
99
+ manifest_name = thumbs.json
100
+ manifest_include_base_url = True
101
+
102
+ template = /home/pi/gallery_template.html
103
+ output = gallery.html
104
+
105
+ base_url = https://example.com/event123/
106
+ ```
107
+
108
+ | Option | Default | Description |
109
+ |---|---|---|
110
+ | `size` | `300x300` | Thumbnail size as `WxH`. |
111
+ | `suffix` | `_thumb` | Suffix appended to the thumbnail filename. |
112
+ | `quality` | `85` | JPEG quality for thumbnails. |
113
+ | `output_folder` | *(empty)* | Optional subfolder for thumbnails. Leave empty when using pibooth-rclone-upload, which does not upload subfolders. |
114
+ | `keep_aspect` | `True` | Keep the aspect ratio when resizing. |
115
+ | `update_manifest` | `True` | Create/update the manifest after each picture. |
116
+ | `manifest_name` | `thumbs.json` | Manifest filename, written next to the pictures. |
117
+ | `manifest_include_base_url` | `True` | Prefix manifest entries with `base_url`. |
118
+ | `template` | *(empty)* | Optional path to a gallery HTML template to copy beside the pictures. |
119
+ | `output` | `gallery.html` | Filename for the copied template. |
120
+ | `base_url` | *(empty)* | Base URL for manifest entries. Falls back to `[DOWNLOADER]` `base_url`. |
121
+
122
+ ### QR code integration
123
+
124
+ This plugin never adds or modifies `[QRCODE]` settings. To find a picture's QR code it uses, in order:
125
+
126
+ 1. the `qrcode_path` recorded in pibooth's picture metadata, then
127
+ 2. `<picture name><suffix>.<ext>` (from `[QRCODE]` `suffix`/`ext`, default `_qrcode` / `png`), searched in `[QRCODE]` `save_path`, the `[GENERAL]` `directory` entries, then the picture's own folder.
128
+
129
+ The QR image is already on disk when this plugin runs, so no waiting is needed.
130
+
131
+ ## How it works
132
+
133
+ 1. pibooth saves the final picture.
134
+ 2. On leaving the processing state, pibooth-gallery (running before other plugins, so uploaders see its output):
135
+ * creates the thumbnail,
136
+ * sets `previous_thumbnail_file` on the pibooth app for other plugins,
137
+ * updates or creates `thumbs.json`,
138
+ * optionally writes `gallery.html` from the template.
139
+ 3. All files are written atomically, so an uploader never sees a partial file. A corrupt manifest is moved to `thumbs.json.bak` rather than overwritten. Errors are logged and never interrupt pibooth.
140
+
141
+ ## Manifest format
142
+
143
+ `thumbs.json` is a list, newest first:
144
+
145
+ ```json
146
+ [
147
+ {
148
+ "thumb": "IMG_001_thumb.jpg",
149
+ "full": "IMG_001.jpg",
150
+ "filename": "IMG_001.jpg",
151
+ "qrcode": "IMG_001_qrcode.png"
152
+ }
153
+ ]
154
+ ```
155
+
156
+ With `manifest_include_base_url = True` and a `base_url`, `thumb`, `full` and `qrcode` become absolute URLs such as `https://example.com/event123/IMG_001.jpg`.
157
+
158
+ ## Publishing to PyPI (maintainers)
159
+
160
+ The package version comes from `__version__` in `pibooth_gallery.py`.
161
+
162
+ ```bash
163
+ # 1. bump __version__ in pibooth_gallery.py, commit and tag
164
+ python -m pip install --upgrade build twine
165
+ python -m build # creates dist/*.tar.gz and dist/*.whl
166
+ python -m twine check dist/*
167
+
168
+ # 2. optional dry run on TestPyPI
169
+ python -m twine upload --repository testpypi dist/*
170
+
171
+ # 3. publish (use a PyPI API token: username __token__)
172
+ python -m twine upload dist/*
173
+ ```
174
+
175
+ PyPI never allows a version to be re-uploaded, so bump the version for every release.
176
+
177
+ ## Contributing
178
+
179
+ Pull requests are welcome. Please open an issue for feature requests or bug reports.
180
+
181
+ ## License
182
+
183
+ MIT, see [LICENSE](LICENSE).