@partoska/p6a 1.10.0

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.
Files changed (3) hide show
  1. package/README.md +330 -0
  2. package/bin/p6a.js +81 -0
  3. package/package.json +37 -0
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # @partoska/p6a
2
+
3
+ Manage and sync your event photos from [Partoska](https://www.partoska.com) —
4
+ right from your terminal.
5
+
6
+ [![npm version](https://img.shields.io/npm/v/@partoska/p6a.svg)](https://www.npmjs.com/package/@partoska/p6a)
7
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/partoska/p6a-cmd/blob/main/LICENSE.txt)
8
+
9
+ ## What is this?
10
+
11
+ `p6a` is a lightweight command-line tool that helps you download and organize
12
+ your event photos from Partoska. It's perfect for backing up your memories or
13
+ working with your photos offline.
14
+
15
+ **Key features:**
16
+
17
+ - Simple authentication via OAuth.
18
+ - Smart sync that doesn't re-download existing files.
19
+ - Automatic folder organization by event and date.
20
+ - Filter by events you own or have favorited.
21
+ - Create and update events, moderate uploads, and manage media.
22
+ - Get or download invite links, QR codes, and printable share cards.
23
+ - Works on macOS, Linux, and Windows.
24
+ - [Agent skills available](https://github.com/partoska/p6a-skills) for use with
25
+ AI assistants.
26
+
27
+ ## Install
28
+
29
+ ```bash
30
+ npm install -g @partoska/p6a
31
+ ```
32
+
33
+ This installs a small launcher plus the prebuilt native binary for your
34
+ platform, selected automatically. No compiler or build tools are required — see
35
+ [How this package works](#how-this-package-works) for the details.
36
+
37
+ You can also run it without a global install using `npx`:
38
+
39
+ ```bash
40
+ npx @partoska/p6a login
41
+ ```
42
+
43
+ ### Supported platforms
44
+
45
+ | OS | Architectures |
46
+ | ------- | ----------------------- |
47
+ | macOS | Intel & Apple Silicon |
48
+ | Linux | x64, arm64 |
49
+ | Windows | x64, arm64 |
50
+
51
+ ## Quick Start
52
+
53
+ ### 1. Login
54
+
55
+ ```bash
56
+ p6a login
57
+ ```
58
+
59
+ You'll see a device code and URL. Open the URL in your browser, enter the code,
60
+ and authorize the app.
61
+
62
+ ### 2. Sync your photos
63
+
64
+ ```bash
65
+ p6a sync -t ~/my-photos
66
+ ```
67
+
68
+ That's it! Your photos will be organized into folders like:
69
+
70
+ ```
71
+ my-photos/
72
+ ├── 2025-01-05 Birthday Party/
73
+ │ ├── IMG_0001.jpg
74
+ │ ├── IMG_0002.jpg
75
+ │ └── MOV_0001.mp4
76
+ └── 2025-02-14 Wedding/
77
+ ├── IMG_0001.jpg
78
+ └── IMG_0002.jpg
79
+ ```
80
+
81
+ Run it again anytime — already-downloaded files are skipped, and folders are
82
+ renamed automatically if an event's name changes.
83
+
84
+ ## Commands
85
+
86
+ | Command | Description |
87
+ | ---------- | ---------------------------------- |
88
+ | `login` | Authenticate with Partoska |
89
+ | `logout` | Remove saved credentials |
90
+ | `sync` | Download and organize event photos |
91
+ | `list` | List events |
92
+ | `create` | Create a new event |
93
+ | `update` | Update an existing event |
94
+ | `edit` | Update a media item |
95
+ | `approve` | Approve a media item |
96
+ | `qr` | Download QR code for an event |
97
+ | `card` | Download share card for an event |
98
+ | `link` | Get invite link for an event |
99
+ | `media` | List media items for an event |
100
+ | `download` | Download media for an event |
101
+ | `help` | Show usage information |
102
+ | `version` | Print version information |
103
+
104
+ Run `p6a help` or `p6a <command> --help` at any time for full usage.
105
+
106
+ ### `login` — Authenticate with Partoska
107
+
108
+ ```bash
109
+ p6a login # Standard device-flow login.
110
+ p6a login --dir /data/p6a-config # Use a custom config location.
111
+ p6a login --import /path/config.ini # Import config from an INI file.
112
+ ```
113
+
114
+ ### `sync` — Download your photos
115
+
116
+ Sync events and photos from Partoska to your computer.
117
+
118
+ ```bash
119
+ p6a sync -t ~/photos # Sync all events.
120
+ p6a sync -t ~/my-events --owner-only # Only events you created.
121
+ p6a sync -t ~/favorites --favorite-only # Only your favorites.
122
+ p6a sync -t ~/my-favorites -o -f # Combine filters (own AND favorite).
123
+ ```
124
+
125
+ **What happens when you sync:**
126
+
127
+ - Events are organized into folders named `YYYY-MM-DD Event Name`.
128
+ - Photos are named sequentially (`IMG_0001.jpg`, `IMG_0002.jpg`, …).
129
+ - Videos are named with a `MOV_` prefix (`MOV_0001.mp4`).
130
+ - Already-downloaded files are automatically skipped.
131
+ - If event names change, folders are renamed automatically.
132
+
133
+ ### `list` — List events
134
+
135
+ ```bash
136
+ p6a list # List all events.
137
+ p6a list -q "Birthday" # Search by name.
138
+ p6a list --owner-only # Only your own events.
139
+ p6a list -1 # Print event IDs only, one per line.
140
+ p6a list -F json | jq '.[].name' # Machine-readable output.
141
+ ```
142
+
143
+ Output formats (`-F`): `plain` (default), `json`, `csv`, `one`.
144
+
145
+ ### `create` / `update` — Manage events
146
+
147
+ ```bash
148
+ # Create a new event (name must be 3–48 characters).
149
+ p6a create -n "Birthday Party"
150
+
151
+ # Rename an event.
152
+ p6a update -e <event-id> -n "New Name"
153
+
154
+ # Change the event dates (ISO 8601).
155
+ p6a update -e <event-id> -S 2026-06-01T10:00:00Z -E 2026-06-01T22:00:00Z
156
+
157
+ # Make an event public, or private.
158
+ p6a update -e <event-id> --public
159
+ p6a update -e <event-id> --private
160
+
161
+ # Enable upload moderation (new uploads require approval before they appear).
162
+ p6a update -e <event-id> --moderated
163
+ ```
164
+
165
+ ### `media`, `edit` & `approve` — Manage media
166
+
167
+ ```bash
168
+ # List media for an event.
169
+ p6a media -e <event-id>
170
+ p6a media -e <event-id> --owner-only # Only media you uploaded.
171
+ p6a media -e <event-id> -F json # Machine-readable output.
172
+
173
+ # Mark / unmark a media item as a favorite.
174
+ p6a edit -e <event-id> -m <media-id> -f
175
+ p6a edit -e <event-id> -m <media-id> -F
176
+
177
+ # Approve a pending item in a moderated event (requires moderator permission).
178
+ p6a approve -e <event-id> -m <media-id>
179
+ ```
180
+
181
+ ### `download` — Download media
182
+
183
+ ```bash
184
+ # Download all media for an event into a directory.
185
+ p6a download -e <event-id> -t ./photos
186
+ p6a download -e <event-id> -t ./photos --owner-only
187
+ p6a download -e <event-id> -t ./favorites --favorite-only
188
+
189
+ # Download a single media item to a file.
190
+ p6a download -e <event-id> -m <media-id> -t photo.jpg
191
+ ```
192
+
193
+ ### `link`, `qr` & `card` — Share events
194
+
195
+ ```bash
196
+ # Print the primary invite link to stdout.
197
+ p6a link -e <event-id>
198
+ p6a link -e <event-id> | pbcopy # Copy to clipboard (macOS).
199
+
200
+ # Download the event QR code (PNG by default, or SVG).
201
+ p6a qr -e <event-id>
202
+ p6a qr -e <event-id> -F svg
203
+
204
+ # Download a printable share card (PDF by default, or JPEG).
205
+ # Designs: bday, tech, match, forest, gold, romantic, neon.
206
+ p6a card -e <event-id> -d bday
207
+ p6a card -e <event-id> -d forest -L business -p letter -l cs
208
+ ```
209
+
210
+ ### `logout`, `help` & `version`
211
+
212
+ ```bash
213
+ p6a logout # Clear saved credentials.
214
+ p6a help # Show usage information (also: p6a --help).
215
+ p6a version # Print the installed version (also: p6a --version).
216
+ ```
217
+
218
+ ## Common Workflows
219
+
220
+ ### First-time setup
221
+
222
+ ```bash
223
+ npm install -g @partoska/p6a
224
+ p6a login
225
+ p6a sync -t ~/partoska-backup
226
+ ```
227
+
228
+ ### Daily backup
229
+
230
+ ```bash
231
+ # Run anytime to grab new photos — existing files are not re-downloaded.
232
+ p6a sync -t ~/partoska-backup
233
+ ```
234
+
235
+ ### Multiple sync targets
236
+
237
+ ```bash
238
+ p6a sync -t ~/all-events # Everything.
239
+ p6a sync -t ~/my-events --owner-only # Just yours.
240
+ p6a sync -t ~/favorites --favorite-only # Just favorites.
241
+ ```
242
+
243
+ ### Scripting with IDs
244
+
245
+ ```bash
246
+ # Download QR codes for all the events you own.
247
+ p6a list -o -1 | xargs -I{} p6a qr -e {}
248
+
249
+ # Get invite links for all your events.
250
+ p6a list -o -1 | xargs -I{} p6a link -e {}
251
+
252
+ # Approve all pending media in a moderated event.
253
+ EID=<event-id>
254
+ p6a media -e "$EID" -F json \
255
+ | jq -r '.[] | select(.approved == false) | .id' \
256
+ | xargs -I{} p6a approve -e "$EID" -m {}
257
+ ```
258
+
259
+ ## Configuration
260
+
261
+ The tool stores configuration in `~/.p6a/p6a.ini` by default (OAuth tokens, API
262
+ endpoints, and OAuth settings). You can customize the location with either an
263
+ environment variable or a flag:
264
+
265
+ ```bash
266
+ export P6A_HOME=/custom/path
267
+ p6a login
268
+
269
+ # Or per-command (use the same --dir for every command):
270
+ p6a login --dir /custom/path
271
+ p6a sync --dir /custom/path -t ~/photos
272
+ ```
273
+
274
+ ## How this package works
275
+
276
+ `@partoska/p6a` follows the per-platform `optionalDependencies` model. The
277
+ package you install ships only a tiny Node launcher; the actual native binary
278
+ comes from one of these platform packages, and npm installs only the one
279
+ matching your OS and CPU:
280
+
281
+ - `@partoska/p6a-darwin` — macOS universal (Intel + Apple Silicon)
282
+ - `@partoska/p6a-linux-x64`
283
+ - `@partoska/p6a-linux-arm64`
284
+ - `@partoska/p6a-win32-x64`
285
+ - `@partoska/p6a-win32-arm64`
286
+
287
+ When you run `p6a`, the launcher detects your platform, resolves the matching
288
+ binary, and executes it — forwarding all arguments and its exit status. There is
289
+ no build step and no runtime dependency on Node beyond launching.
290
+
291
+ ## Troubleshooting
292
+
293
+ ### "Unsupported platform" or "could not find the native binary"
294
+
295
+ This usually means optional dependencies were skipped during install (for
296
+ example with `npm install --no-optional`, or behind a strict CI mirror).
297
+ Reinstall with optional dependencies enabled:
298
+
299
+ ```bash
300
+ npm install -g @partoska/p6a
301
+ ```
302
+
303
+ ### "Failed to login"
304
+
305
+ - Make sure you entered the device code correctly and authorized the app in
306
+ your browser.
307
+ - Check that you have an active internet connection.
308
+
309
+ ### "Network error" during sync
310
+
311
+ - Verify your internet connection.
312
+ - Refresh your session: `p6a logout` then `p6a login`.
313
+
314
+ ### Files aren't downloading
315
+
316
+ - Make sure the target directory exists and is writable, and that you have
317
+ enough disk space.
318
+ - Try a fresh login: `p6a logout && p6a login`.
319
+
320
+ ## License
321
+
322
+ MIT. Copyright (C) 2026 Fabrika Charvat s.r.o. Developed by the
323
+ [Partoska Laboratory](https://lab.partoska.com) team.
324
+
325
+ ## Links
326
+
327
+ - **Project website:** <https://www.partoska.com/p6a>
328
+ - **Partoska website:** <https://www.partoska.com>
329
+ - **Source & issues:** <https://github.com/partoska/p6a-cmd>
330
+ - **Agent skills:** <https://github.com/partoska/p6a-skills>
package/bin/p6a.js ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ /*
4
+ * Command Line Interface for Partoska.com media sharing service.
5
+ * Copyright (C) 2026 Fabrika Charvat s.r.o. All rights reserved.
6
+ * Developed by Partoska Laboratory team, <https://lab.partoska.com>
7
+ *
8
+ * MIT License
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to
12
+ * deal in the Software without restriction, including without limitation the
13
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14
+ * sell copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26
+ * IN THE SOFTWARE.
27
+ *
28
+ * You can contact the author(s) via email at ask <at> partoska.com.
29
+ */
30
+
31
+ "use strict";
32
+
33
+ const { spawnSync } = require("child_process");
34
+
35
+ // Map `${process.platform}-${process.arch}` to the package + relative binary.
36
+ const TARGETS = {
37
+ "darwin-x64": ["@partoska/p6a-darwin", "bin/p6a"],
38
+ "darwin-arm64": ["@partoska/p6a-darwin", "bin/p6a"],
39
+ "linux-x64": ["@partoska/p6a-linux-x64", "bin/p6a"],
40
+ "linux-arm64": ["@partoska/p6a-linux-arm64", "bin/p6a"],
41
+ "win32-x64": ["@partoska/p6a-win32-x64", "bin/p6a.exe"],
42
+ "win32-arm64": ["@partoska/p6a-win32-arm64", "bin/p6a.exe"],
43
+ };
44
+
45
+ const key = `${process.platform}-${process.arch}`;
46
+ const target = TARGETS[key];
47
+ if (!target) {
48
+ console.error(
49
+ `p6a: unsupported platform/architecture "${key}".\n` +
50
+ `Supported: ${Object.keys(TARGETS).join(", ")}.\n` +
51
+ `Please file an issue at https://github.com/partoska/p6a-cmd/issues`,
52
+ );
53
+ process.exit(1);
54
+ }
55
+
56
+ const [pkg, relPath] = target;
57
+ let binary;
58
+ try {
59
+ binary = require.resolve(`${pkg}/${relPath}`);
60
+ } catch {
61
+ console.error(
62
+ `p6a: could not find the native binary for "${key}".\n` +
63
+ `The optional dependency "${pkg}" does not seem to be installed.\n` +
64
+ `Try reinstalling p6a (e.g. "npm install -g @partoska/p6a"), and make\n` +
65
+ `sure optional dependencies are not disabled.`,
66
+ );
67
+ process.exit(1);
68
+ }
69
+
70
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
71
+ if (result.error) {
72
+ console.error(`p6a: failed to launch native binary: ${result.error.message}`);
73
+ process.exit(1);
74
+ }
75
+
76
+ // Mirror the child's exit.
77
+ if (result.signal) {
78
+ process.kill(process.pid, result.signal);
79
+ } else {
80
+ process.exit(result.status === null ? 1 : result.status);
81
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@partoska/p6a",
3
+ "version": "1.10.0",
4
+ "description": "Command-line tool to manage and sync your event photos from Partoska.",
5
+ "bin": {
6
+ "p6a": "bin/p6a.js"
7
+ },
8
+ "files": [
9
+ "bin/"
10
+ ],
11
+ "optionalDependencies": {
12
+ "@partoska/p6a-darwin": "1.10.0",
13
+ "@partoska/p6a-linux-x64": "1.10.0",
14
+ "@partoska/p6a-linux-arm64": "1.10.0",
15
+ "@partoska/p6a-win32-x64": "1.10.0",
16
+ "@partoska/p6a-win32-arm64": "1.10.0"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/partoska/p6a-cmd.git"
24
+ },
25
+ "homepage": "https://www.partoska.com/p6a",
26
+ "bugs": {
27
+ "url": "https://github.com/partoska/p6a-cmd/issues"
28
+ },
29
+ "license": "MIT",
30
+ "keywords": [
31
+ "partoska",
32
+ "photos",
33
+ "cli",
34
+ "sync",
35
+ "events"
36
+ ]
37
+ }