lightroom-cli 1.0.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.
- lightroom_cli-1.0.0/LICENSE +21 -0
- lightroom_cli-1.0.0/PKG-INFO +333 -0
- lightroom_cli-1.0.0/README.md +302 -0
- lightroom_cli-1.0.0/cli/__init__.py +0 -0
- lightroom_cli-1.0.0/cli/commands/__init__.py +0 -0
- lightroom_cli-1.0.0/cli/commands/ai_mask.py +228 -0
- lightroom_cli-1.0.0/cli/commands/catalog.py +378 -0
- lightroom_cli-1.0.0/cli/commands/develop.py +686 -0
- lightroom_cli-1.0.0/cli/commands/plugin.py +92 -0
- lightroom_cli-1.0.0/cli/commands/preview.py +48 -0
- lightroom_cli-1.0.0/cli/commands/selection.py +191 -0
- lightroom_cli-1.0.0/cli/commands/system.py +107 -0
- lightroom_cli-1.0.0/cli/completions.py +34 -0
- lightroom_cli-1.0.0/cli/decorators.py +92 -0
- lightroom_cli-1.0.0/cli/helpers.py +168 -0
- lightroom_cli-1.0.0/cli/main.py +60 -0
- lightroom_cli-1.0.0/cli/middleware.py +37 -0
- lightroom_cli-1.0.0/cli/output.py +135 -0
- lightroom_cli-1.0.0/cli/schema.py +92 -0
- lightroom_cli-1.0.0/cli/structured_group.py +83 -0
- lightroom_cli-1.0.0/cli/validation.py +204 -0
- lightroom_cli-1.0.0/lightroom_cli.egg-info/PKG-INFO +333 -0
- lightroom_cli-1.0.0/lightroom_cli.egg-info/SOURCES.txt +95 -0
- lightroom_cli-1.0.0/lightroom_cli.egg-info/dependency_links.txt +1 -0
- lightroom_cli-1.0.0/lightroom_cli.egg-info/entry_points.txt +2 -0
- lightroom_cli-1.0.0/lightroom_cli.egg-info/requires.txt +10 -0
- lightroom_cli-1.0.0/lightroom_cli.egg-info/top_level.txt +2 -0
- lightroom_cli-1.0.0/lightroom_sdk/__init__.py +24 -0
- lightroom_cli-1.0.0/lightroom_sdk/client.py +145 -0
- lightroom_cli-1.0.0/lightroom_sdk/exceptions.py +146 -0
- lightroom_cli-1.0.0/lightroom_sdk/paths.py +43 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/AppShutdown.lua +9 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/CatalogModule.lua +1534 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/CommandRouter.lua +488 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/Config.lua +60 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/DevelopModule.lua +3879 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/ErrorUtils.lua +225 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/Info.lua +35 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/Logger.lua +54 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/MenuActions.lua +77 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/MessageProtocol.lua +403 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/PlatformPaths.lua +11 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/PluginInit.lua +492 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/PluginShutdown.lua +9 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/PreviewModule.lua +521 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/SelectionModule.lua +329 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/SimpleSocketBridge.lua +403 -0
- lightroom_cli-1.0.0/lightroom_sdk/plugin/StopMenuAction.lua +53 -0
- lightroom_cli-1.0.0/lightroom_sdk/presets.py +24 -0
- lightroom_cli-1.0.0/lightroom_sdk/protocol.py +30 -0
- lightroom_cli-1.0.0/lightroom_sdk/resilient_bridge.py +157 -0
- lightroom_cli-1.0.0/lightroom_sdk/retry.py +39 -0
- lightroom_cli-1.0.0/lightroom_sdk/schema.py +1639 -0
- lightroom_cli-1.0.0/lightroom_sdk/socket_bridge.py +228 -0
- lightroom_cli-1.0.0/lightroom_sdk/types/__init__.py +22 -0
- lightroom_cli-1.0.0/lightroom_sdk/types/catalog.py +44 -0
- lightroom_cli-1.0.0/lightroom_sdk/types/develop.py +156 -0
- lightroom_cli-1.0.0/pyproject.toml +75 -0
- lightroom_cli-1.0.0/setup.cfg +4 -0
- lightroom_cli-1.0.0/tests/test_cli_catalog_rating_range.py +27 -0
- lightroom_cli-1.0.0/tests/test_cli_help_all_commands.py +52 -0
- lightroom_cli-1.0.0/tests/test_cli_json_log_suppression.py +30 -0
- lightroom_cli-1.0.0/tests/test_cli_main.py +35 -0
- lightroom_cli-1.0.0/tests/test_cli_plugin.py +101 -0
- lightroom_cli-1.0.0/tests/test_cli_schema.py +83 -0
- lightroom_cli-1.0.0/tests/test_cli_system.py +126 -0
- lightroom_cli-1.0.0/tests/test_client.py +155 -0
- lightroom_cli-1.0.0/tests/test_confirm_flag.py +74 -0
- lightroom_cli-1.0.0/tests/test_decorators.py +105 -0
- lightroom_cli-1.0.0/tests/test_dry_run_risk_level.py +29 -0
- lightroom_cli-1.0.0/tests/test_filter_fields_dot_notation.py +64 -0
- lightroom_cli-1.0.0/tests/test_helpers.py +216 -0
- lightroom_cli-1.0.0/tests/test_middleware.py +134 -0
- lightroom_cli-1.0.0/tests/test_mock_server.py +48 -0
- lightroom_cli-1.0.0/tests/test_output_formatter.py +149 -0
- lightroom_cli-1.0.0/tests/test_output_sanitize.py +50 -0
- lightroom_cli-1.0.0/tests/test_param_schema_min_max.py +27 -0
- lightroom_cli-1.0.0/tests/test_paths.py +109 -0
- lightroom_cli-1.0.0/tests/test_presets.py +53 -0
- lightroom_cli-1.0.0/tests/test_project_structure.py +34 -0
- lightroom_cli-1.0.0/tests/test_resilient_bridge.py +57 -0
- lightroom_cli-1.0.0/tests/test_response_fields.py +24 -0
- lightroom_cli-1.0.0/tests/test_retry.py +39 -0
- lightroom_cli-1.0.0/tests/test_review_fixes.py +92 -0
- lightroom_cli-1.0.0/tests/test_schema.py +173 -0
- lightroom_cli-1.0.0/tests/test_schema_cli_constraints.py +41 -0
- lightroom_cli-1.0.0/tests/test_schema_develop_ai.py +67 -0
- lightroom_cli-1.0.0/tests/test_schema_hash.py +19 -0
- lightroom_cli-1.0.0/tests/test_schema_introspection_constraints.py +40 -0
- lightroom_cli-1.0.0/tests/test_schema_plugin.py +32 -0
- lightroom_cli-1.0.0/tests/test_schema_system_completeness.py +30 -0
- lightroom_cli-1.0.0/tests/test_socket_bridge_events.py +39 -0
- lightroom_cli-1.0.0/tests/test_structured_error_group.py +55 -0
- lightroom_cli-1.0.0/tests/test_system_status_metadata.py +45 -0
- lightroom_cli-1.0.0/tests/test_validation.py +163 -0
- lightroom_cli-1.0.0/tests/test_validation_range.py +33 -0
- lightroom_cli-1.0.0/tests/test_validation_sanitize.py +41 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 motokiendo
|
|
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,333 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lightroom-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: CLI tool for Adobe Lightroom Classic — 107 commands for full Lightroom control
|
|
5
|
+
Author-email: "M.Endo" <motoki@clockwork-sound.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/znznzna/lightroom-cli
|
|
8
|
+
Project-URL: Repository, https://github.com/znznzna/lightroom-cli
|
|
9
|
+
Project-URL: Issues, https://github.com/znznzna/lightroom-cli/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: click>=8.1
|
|
22
|
+
Requires-Dist: rich>=13.0
|
|
23
|
+
Requires-Dist: pydantic>=2.0
|
|
24
|
+
Requires-Dist: platformdirs>=3.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# Lightroom CLI
|
|
33
|
+
|
|
34
|
+
[](https://github.com/znznzna/lightroom-cli/actions/workflows/test.yml)
|
|
35
|
+
[](https://www.python.org/downloads/)
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
|
|
38
|
+
[Japanese / 日本語](README.ja.md)
|
|
39
|
+
|
|
40
|
+
**Full command-line control for Adobe Lightroom Classic — 107 commands.**
|
|
41
|
+
|
|
42
|
+
Develop parameter adjustment, masking, tone curves, catalog management, selection operations, and more. Ideal for batch processing and scripted automation.
|
|
43
|
+
|
|
44
|
+
## Architecture
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
+---------------------+ TCP Socket (JSON-RPC) +--------------+
|
|
48
|
+
| Lightroom Classic |<----------------------------->| Python SDK |
|
|
49
|
+
| (Lua Plugin) | Dual socket: send/receive | |
|
|
50
|
+
+---------------------+ +------+-------+
|
|
51
|
+
|
|
|
52
|
+
+------+-------+
|
|
53
|
+
| CLI (lr) |
|
|
54
|
+
| Click app |
|
|
55
|
+
+--------------+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
A Lua plugin runs inside Lightroom Classic and communicates with the Python SDK via dual TCP sockets (one for sending, one for receiving) using JSON-RPC. The CLI operates as the `lr` command and controls Lightroom through the SDK.
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
### Prerequisites
|
|
63
|
+
|
|
64
|
+
- **Python 3.10+**
|
|
65
|
+
- **Adobe Lightroom Classic** (desktop version)
|
|
66
|
+
- macOS (Windows untested)
|
|
67
|
+
|
|
68
|
+
### Installation
|
|
69
|
+
|
|
70
|
+
#### From Source (Development)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/znznzna/lightroom-cli.git
|
|
74
|
+
cd lightroom-cli
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
lr plugin install --dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Via pip
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install lightroom-cli
|
|
83
|
+
lr plugin install
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Verify Connection
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# With Lightroom Classic running
|
|
90
|
+
lr system ping
|
|
91
|
+
# -> pong
|
|
92
|
+
|
|
93
|
+
lr system status
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Usage Examples
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Get currently selected photo
|
|
100
|
+
lr catalog get-selected
|
|
101
|
+
|
|
102
|
+
# Set develop parameters
|
|
103
|
+
lr develop set Exposure 1.5 Contrast 25 Clarity 30
|
|
104
|
+
|
|
105
|
+
# Apply AutoTone
|
|
106
|
+
lr develop auto-tone
|
|
107
|
+
|
|
108
|
+
# Apply S-curve to tone curve
|
|
109
|
+
lr develop curve s-curve
|
|
110
|
+
|
|
111
|
+
# Create a mask and add a brush
|
|
112
|
+
lr develop mask create
|
|
113
|
+
lr develop mask add brush
|
|
114
|
+
|
|
115
|
+
# Apply a preset
|
|
116
|
+
lr develop preset "Vivid Landscape"
|
|
117
|
+
|
|
118
|
+
# Rating and flag operations
|
|
119
|
+
lr selection set-rating 5
|
|
120
|
+
lr selection flag
|
|
121
|
+
|
|
122
|
+
# Search the catalog
|
|
123
|
+
lr catalog search "landscape" --limit 20
|
|
124
|
+
|
|
125
|
+
# JSON output
|
|
126
|
+
lr -o json develop get-settings
|
|
127
|
+
|
|
128
|
+
# Table output
|
|
129
|
+
lr -o table catalog list --limit 10
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Command Groups
|
|
133
|
+
|
|
134
|
+
| Group | Commands | Description |
|
|
135
|
+
|-------|----------|-------------|
|
|
136
|
+
| [`lr system`](#lr-system) | 4 | Connection management and status |
|
|
137
|
+
| [`lr catalog`](#lr-catalog) | 27 | Catalog operations, photo search, metadata |
|
|
138
|
+
| [`lr develop`](#lr-develop) | 55 | Develop settings, masks, curves, filters |
|
|
139
|
+
| [`lr preview`](#lr-preview) | 4 | Preview generation and info |
|
|
140
|
+
| [`lr selection`](#lr-selection) | 17 | Selection, flags, ratings, labels |
|
|
141
|
+
| [`lr plugin`](#lr-plugin) | 3 | Plugin installation and management |
|
|
142
|
+
|
|
143
|
+
**For all 107 commands, see the [CLI Reference](docs/CLI_REFERENCE.md).**
|
|
144
|
+
|
|
145
|
+
### lr system
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
lr system ping # Connection test
|
|
149
|
+
lr system status # Bridge status
|
|
150
|
+
lr system reconnect # Force reconnect
|
|
151
|
+
lr system check-connection # Detailed connection check
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### lr catalog
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
lr catalog get-selected # Get currently selected photo
|
|
158
|
+
lr catalog list --limit 10 # List photos
|
|
159
|
+
lr catalog search "keyword" # Search
|
|
160
|
+
lr catalog get-info <photo_id> # Detailed metadata
|
|
161
|
+
lr catalog set-rating <id> 5 # Set rating
|
|
162
|
+
lr catalog add-keywords <id> kw1 kw2 # Add keywords
|
|
163
|
+
lr catalog set-title <id> "Title" # Set title
|
|
164
|
+
lr catalog collections # List collections
|
|
165
|
+
lr catalog create-collection "name" # Create collection
|
|
166
|
+
lr catalog keywords # List keywords
|
|
167
|
+
lr catalog set-view-filter <json> # Set view filter
|
|
168
|
+
lr catalog rotate-left # Rotate left
|
|
169
|
+
lr catalog create-virtual-copy # Create virtual copy
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### lr develop
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Basic operations
|
|
176
|
+
lr develop get-settings # Get all develop settings
|
|
177
|
+
lr develop set Exposure 1.5 # Set parameter
|
|
178
|
+
lr develop get Exposure # Get single parameter
|
|
179
|
+
lr develop auto-tone # AutoTone
|
|
180
|
+
lr develop auto-wb # Auto White Balance
|
|
181
|
+
lr develop reset # Reset settings
|
|
182
|
+
lr develop apply '{"Exposure": 1.0}' # Apply settings from JSON
|
|
183
|
+
|
|
184
|
+
# Tone curve
|
|
185
|
+
lr develop curve get # Get curve
|
|
186
|
+
lr develop curve set '[[0,0],[128,140],[255,255]]'
|
|
187
|
+
lr develop curve s-curve # S-curve preset
|
|
188
|
+
lr develop curve linear # Linear reset
|
|
189
|
+
lr develop curve add-point 128 140 # Add point
|
|
190
|
+
|
|
191
|
+
# Masking
|
|
192
|
+
lr develop mask list # List all masks
|
|
193
|
+
lr develop mask create # Create new mask
|
|
194
|
+
lr develop mask add brush # Add brush component
|
|
195
|
+
lr develop mask intersect luminance # Intersect with luminance
|
|
196
|
+
lr develop mask subtract color # Subtract with color
|
|
197
|
+
lr develop mask invert mask-1 # Invert mask
|
|
198
|
+
|
|
199
|
+
# Filters
|
|
200
|
+
lr develop filter graduated # Graduated filter
|
|
201
|
+
lr develop filter radial # Radial filter
|
|
202
|
+
lr develop filter brush # Brush filter
|
|
203
|
+
lr develop filter ai-select # AI select
|
|
204
|
+
|
|
205
|
+
# Local adjustments
|
|
206
|
+
lr develop local set Exposure 0.5 # Set local parameter
|
|
207
|
+
lr develop local get Exposure # Get local parameter
|
|
208
|
+
|
|
209
|
+
# Tools, presets, and snapshots
|
|
210
|
+
lr develop tool crop # Select tool
|
|
211
|
+
lr develop preset "Preset Name" # Apply preset
|
|
212
|
+
lr develop snapshot "Snapshot Name" # Create snapshot
|
|
213
|
+
lr develop copy-settings # Copy settings
|
|
214
|
+
lr develop paste-settings # Paste settings
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### lr preview
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
lr preview generate-current # Generate preview for selected photo
|
|
221
|
+
lr preview generate --size 2048 # Generate with specified size
|
|
222
|
+
lr preview generate-batch # Batch generation
|
|
223
|
+
lr preview info # Preview info
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### lr selection
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
lr selection flag # Pick flag
|
|
230
|
+
lr selection reject # Reject flag
|
|
231
|
+
lr selection unflag # Remove flag
|
|
232
|
+
lr selection get-flag # Get flag state
|
|
233
|
+
lr selection set-rating 5 # Set rating (0-5)
|
|
234
|
+
lr selection get-rating # Get rating
|
|
235
|
+
lr selection color-label red # Set color label
|
|
236
|
+
lr selection get-color-label # Get color label
|
|
237
|
+
lr selection toggle-label red # Toggle label
|
|
238
|
+
lr selection next # Next photo
|
|
239
|
+
lr selection previous # Previous photo
|
|
240
|
+
lr selection select-all # Select all
|
|
241
|
+
lr selection select-none # Deselect all
|
|
242
|
+
lr selection select-inverse # Invert selection
|
|
243
|
+
lr selection extend --direction right # Extend selection
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Global Options
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
lr --output json ... # JSON output (-o json)
|
|
250
|
+
lr --output table ... # Table output (-o table)
|
|
251
|
+
lr --verbose ... # Debug logging (-v)
|
|
252
|
+
lr --timeout 60 ... # Timeout in seconds (-t 60)
|
|
253
|
+
lr --version # Show version
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Configuration
|
|
257
|
+
|
|
258
|
+
| Environment Variable | Description |
|
|
259
|
+
|---------------------|-------------|
|
|
260
|
+
| `LR_PORT_FILE` | Path to the port file used for socket communication |
|
|
261
|
+
| `LR_PLUGIN_DIR` | Path to the Lightroom plugin directory |
|
|
262
|
+
|
|
263
|
+
## Features
|
|
264
|
+
|
|
265
|
+
- **Auto-reconnect**: Automatically retries when the Lightroom connection drops (exponential backoff)
|
|
266
|
+
- **Heartbeat**: Connection monitoring at 30-second intervals
|
|
267
|
+
- **Shutdown detection**: Graceful handling when Lightroom exits
|
|
268
|
+
- **3 output formats**: `text` / `json` / `table`
|
|
269
|
+
- **Tab completion**: Completion support for develop parameter names
|
|
270
|
+
- **Per-command timeout**: Long-running operations like preview generation are automatically extended
|
|
271
|
+
|
|
272
|
+
## Development
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Install for development
|
|
276
|
+
pip install -e ".[dev]"
|
|
277
|
+
|
|
278
|
+
# Run tests
|
|
279
|
+
python -m pytest tests/ -v
|
|
280
|
+
|
|
281
|
+
# With coverage
|
|
282
|
+
python -m pytest tests/ -v --cov=lightroom_sdk --cov=cli
|
|
283
|
+
|
|
284
|
+
# Single test file
|
|
285
|
+
python -m pytest tests/integration/test_cli_develop.py -v
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Project Structure
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
lightroom-cli/
|
|
292
|
+
+-- cli/ # Click CLI application
|
|
293
|
+
| +-- main.py # Entry point (lr command)
|
|
294
|
+
| +-- output.py # OutputFormatter (json/text/table)
|
|
295
|
+
| +-- helpers.py # bridge_command decorator
|
|
296
|
+
| +-- completions.py # Tab completion
|
|
297
|
+
| +-- commands/ # Command groups
|
|
298
|
+
| +-- system.py # lr system
|
|
299
|
+
| +-- catalog.py # lr catalog
|
|
300
|
+
| +-- develop.py # lr develop (+ curve/mask/local/filter/debug/color)
|
|
301
|
+
| +-- preview.py # lr preview
|
|
302
|
+
| +-- selection.py # lr selection
|
|
303
|
+
| +-- plugin.py # lr plugin
|
|
304
|
+
+-- lightroom_sdk/ # Python SDK
|
|
305
|
+
| +-- client.py # LightroomClient
|
|
306
|
+
| +-- socket_bridge.py # Dual TCP socket
|
|
307
|
+
| +-- resilient_bridge.py # Auto-reconnect + heartbeat
|
|
308
|
+
| +-- retry.py # Per-command timeout
|
|
309
|
+
| +-- protocol.py # JSON-RPC protocol
|
|
310
|
+
| +-- paths.py # Path resolution utilities
|
|
311
|
+
| +-- plugin/ # Lua plugin (bundled)
|
|
312
|
+
| +-- PluginInit.lua # Command router (107 commands)
|
|
313
|
+
| +-- DevelopModule.lua # Develop operations
|
|
314
|
+
| +-- CatalogModule.lua # Catalog operations
|
|
315
|
+
+-- tests/ # pytest test suite (680+ tests)
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Requirements
|
|
319
|
+
|
|
320
|
+
- Python >= 3.10
|
|
321
|
+
- Adobe Lightroom Classic
|
|
322
|
+
- macOS (Windows untested)
|
|
323
|
+
|
|
324
|
+
### Python Dependencies
|
|
325
|
+
|
|
326
|
+
- [click](https://click.palletsprojects.com/) >= 8.1 — CLI framework
|
|
327
|
+
- [rich](https://rich.readthedocs.io/) >= 13.0 — Table output
|
|
328
|
+
- [pydantic](https://docs.pydantic.dev/) >= 2.0 — Data validation
|
|
329
|
+
- [platformdirs](https://platformdirs.readthedocs.io/) >= 3.0 — Platform-specific directory paths
|
|
330
|
+
|
|
331
|
+
## License
|
|
332
|
+
|
|
333
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# Lightroom CLI
|
|
2
|
+
|
|
3
|
+
[](https://github.com/znznzna/lightroom-cli/actions/workflows/test.yml)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
[Japanese / 日本語](README.ja.md)
|
|
8
|
+
|
|
9
|
+
**Full command-line control for Adobe Lightroom Classic — 107 commands.**
|
|
10
|
+
|
|
11
|
+
Develop parameter adjustment, masking, tone curves, catalog management, selection operations, and more. Ideal for batch processing and scripted automation.
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
+---------------------+ TCP Socket (JSON-RPC) +--------------+
|
|
17
|
+
| Lightroom Classic |<----------------------------->| Python SDK |
|
|
18
|
+
| (Lua Plugin) | Dual socket: send/receive | |
|
|
19
|
+
+---------------------+ +------+-------+
|
|
20
|
+
|
|
|
21
|
+
+------+-------+
|
|
22
|
+
| CLI (lr) |
|
|
23
|
+
| Click app |
|
|
24
|
+
+--------------+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
A Lua plugin runs inside Lightroom Classic and communicates with the Python SDK via dual TCP sockets (one for sending, one for receiving) using JSON-RPC. The CLI operates as the `lr` command and controls Lightroom through the SDK.
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### Prerequisites
|
|
32
|
+
|
|
33
|
+
- **Python 3.10+**
|
|
34
|
+
- **Adobe Lightroom Classic** (desktop version)
|
|
35
|
+
- macOS (Windows untested)
|
|
36
|
+
|
|
37
|
+
### Installation
|
|
38
|
+
|
|
39
|
+
#### From Source (Development)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/znznzna/lightroom-cli.git
|
|
43
|
+
cd lightroom-cli
|
|
44
|
+
pip install -e ".[dev]"
|
|
45
|
+
lr plugin install --dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Via pip
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install lightroom-cli
|
|
52
|
+
lr plugin install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Verify Connection
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# With Lightroom Classic running
|
|
59
|
+
lr system ping
|
|
60
|
+
# -> pong
|
|
61
|
+
|
|
62
|
+
lr system status
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage Examples
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Get currently selected photo
|
|
69
|
+
lr catalog get-selected
|
|
70
|
+
|
|
71
|
+
# Set develop parameters
|
|
72
|
+
lr develop set Exposure 1.5 Contrast 25 Clarity 30
|
|
73
|
+
|
|
74
|
+
# Apply AutoTone
|
|
75
|
+
lr develop auto-tone
|
|
76
|
+
|
|
77
|
+
# Apply S-curve to tone curve
|
|
78
|
+
lr develop curve s-curve
|
|
79
|
+
|
|
80
|
+
# Create a mask and add a brush
|
|
81
|
+
lr develop mask create
|
|
82
|
+
lr develop mask add brush
|
|
83
|
+
|
|
84
|
+
# Apply a preset
|
|
85
|
+
lr develop preset "Vivid Landscape"
|
|
86
|
+
|
|
87
|
+
# Rating and flag operations
|
|
88
|
+
lr selection set-rating 5
|
|
89
|
+
lr selection flag
|
|
90
|
+
|
|
91
|
+
# Search the catalog
|
|
92
|
+
lr catalog search "landscape" --limit 20
|
|
93
|
+
|
|
94
|
+
# JSON output
|
|
95
|
+
lr -o json develop get-settings
|
|
96
|
+
|
|
97
|
+
# Table output
|
|
98
|
+
lr -o table catalog list --limit 10
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Command Groups
|
|
102
|
+
|
|
103
|
+
| Group | Commands | Description |
|
|
104
|
+
|-------|----------|-------------|
|
|
105
|
+
| [`lr system`](#lr-system) | 4 | Connection management and status |
|
|
106
|
+
| [`lr catalog`](#lr-catalog) | 27 | Catalog operations, photo search, metadata |
|
|
107
|
+
| [`lr develop`](#lr-develop) | 55 | Develop settings, masks, curves, filters |
|
|
108
|
+
| [`lr preview`](#lr-preview) | 4 | Preview generation and info |
|
|
109
|
+
| [`lr selection`](#lr-selection) | 17 | Selection, flags, ratings, labels |
|
|
110
|
+
| [`lr plugin`](#lr-plugin) | 3 | Plugin installation and management |
|
|
111
|
+
|
|
112
|
+
**For all 107 commands, see the [CLI Reference](docs/CLI_REFERENCE.md).**
|
|
113
|
+
|
|
114
|
+
### lr system
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
lr system ping # Connection test
|
|
118
|
+
lr system status # Bridge status
|
|
119
|
+
lr system reconnect # Force reconnect
|
|
120
|
+
lr system check-connection # Detailed connection check
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### lr catalog
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
lr catalog get-selected # Get currently selected photo
|
|
127
|
+
lr catalog list --limit 10 # List photos
|
|
128
|
+
lr catalog search "keyword" # Search
|
|
129
|
+
lr catalog get-info <photo_id> # Detailed metadata
|
|
130
|
+
lr catalog set-rating <id> 5 # Set rating
|
|
131
|
+
lr catalog add-keywords <id> kw1 kw2 # Add keywords
|
|
132
|
+
lr catalog set-title <id> "Title" # Set title
|
|
133
|
+
lr catalog collections # List collections
|
|
134
|
+
lr catalog create-collection "name" # Create collection
|
|
135
|
+
lr catalog keywords # List keywords
|
|
136
|
+
lr catalog set-view-filter <json> # Set view filter
|
|
137
|
+
lr catalog rotate-left # Rotate left
|
|
138
|
+
lr catalog create-virtual-copy # Create virtual copy
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### lr develop
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Basic operations
|
|
145
|
+
lr develop get-settings # Get all develop settings
|
|
146
|
+
lr develop set Exposure 1.5 # Set parameter
|
|
147
|
+
lr develop get Exposure # Get single parameter
|
|
148
|
+
lr develop auto-tone # AutoTone
|
|
149
|
+
lr develop auto-wb # Auto White Balance
|
|
150
|
+
lr develop reset # Reset settings
|
|
151
|
+
lr develop apply '{"Exposure": 1.0}' # Apply settings from JSON
|
|
152
|
+
|
|
153
|
+
# Tone curve
|
|
154
|
+
lr develop curve get # Get curve
|
|
155
|
+
lr develop curve set '[[0,0],[128,140],[255,255]]'
|
|
156
|
+
lr develop curve s-curve # S-curve preset
|
|
157
|
+
lr develop curve linear # Linear reset
|
|
158
|
+
lr develop curve add-point 128 140 # Add point
|
|
159
|
+
|
|
160
|
+
# Masking
|
|
161
|
+
lr develop mask list # List all masks
|
|
162
|
+
lr develop mask create # Create new mask
|
|
163
|
+
lr develop mask add brush # Add brush component
|
|
164
|
+
lr develop mask intersect luminance # Intersect with luminance
|
|
165
|
+
lr develop mask subtract color # Subtract with color
|
|
166
|
+
lr develop mask invert mask-1 # Invert mask
|
|
167
|
+
|
|
168
|
+
# Filters
|
|
169
|
+
lr develop filter graduated # Graduated filter
|
|
170
|
+
lr develop filter radial # Radial filter
|
|
171
|
+
lr develop filter brush # Brush filter
|
|
172
|
+
lr develop filter ai-select # AI select
|
|
173
|
+
|
|
174
|
+
# Local adjustments
|
|
175
|
+
lr develop local set Exposure 0.5 # Set local parameter
|
|
176
|
+
lr develop local get Exposure # Get local parameter
|
|
177
|
+
|
|
178
|
+
# Tools, presets, and snapshots
|
|
179
|
+
lr develop tool crop # Select tool
|
|
180
|
+
lr develop preset "Preset Name" # Apply preset
|
|
181
|
+
lr develop snapshot "Snapshot Name" # Create snapshot
|
|
182
|
+
lr develop copy-settings # Copy settings
|
|
183
|
+
lr develop paste-settings # Paste settings
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### lr preview
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
lr preview generate-current # Generate preview for selected photo
|
|
190
|
+
lr preview generate --size 2048 # Generate with specified size
|
|
191
|
+
lr preview generate-batch # Batch generation
|
|
192
|
+
lr preview info # Preview info
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### lr selection
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
lr selection flag # Pick flag
|
|
199
|
+
lr selection reject # Reject flag
|
|
200
|
+
lr selection unflag # Remove flag
|
|
201
|
+
lr selection get-flag # Get flag state
|
|
202
|
+
lr selection set-rating 5 # Set rating (0-5)
|
|
203
|
+
lr selection get-rating # Get rating
|
|
204
|
+
lr selection color-label red # Set color label
|
|
205
|
+
lr selection get-color-label # Get color label
|
|
206
|
+
lr selection toggle-label red # Toggle label
|
|
207
|
+
lr selection next # Next photo
|
|
208
|
+
lr selection previous # Previous photo
|
|
209
|
+
lr selection select-all # Select all
|
|
210
|
+
lr selection select-none # Deselect all
|
|
211
|
+
lr selection select-inverse # Invert selection
|
|
212
|
+
lr selection extend --direction right # Extend selection
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Global Options
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
lr --output json ... # JSON output (-o json)
|
|
219
|
+
lr --output table ... # Table output (-o table)
|
|
220
|
+
lr --verbose ... # Debug logging (-v)
|
|
221
|
+
lr --timeout 60 ... # Timeout in seconds (-t 60)
|
|
222
|
+
lr --version # Show version
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Configuration
|
|
226
|
+
|
|
227
|
+
| Environment Variable | Description |
|
|
228
|
+
|---------------------|-------------|
|
|
229
|
+
| `LR_PORT_FILE` | Path to the port file used for socket communication |
|
|
230
|
+
| `LR_PLUGIN_DIR` | Path to the Lightroom plugin directory |
|
|
231
|
+
|
|
232
|
+
## Features
|
|
233
|
+
|
|
234
|
+
- **Auto-reconnect**: Automatically retries when the Lightroom connection drops (exponential backoff)
|
|
235
|
+
- **Heartbeat**: Connection monitoring at 30-second intervals
|
|
236
|
+
- **Shutdown detection**: Graceful handling when Lightroom exits
|
|
237
|
+
- **3 output formats**: `text` / `json` / `table`
|
|
238
|
+
- **Tab completion**: Completion support for develop parameter names
|
|
239
|
+
- **Per-command timeout**: Long-running operations like preview generation are automatically extended
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Install for development
|
|
245
|
+
pip install -e ".[dev]"
|
|
246
|
+
|
|
247
|
+
# Run tests
|
|
248
|
+
python -m pytest tests/ -v
|
|
249
|
+
|
|
250
|
+
# With coverage
|
|
251
|
+
python -m pytest tests/ -v --cov=lightroom_sdk --cov=cli
|
|
252
|
+
|
|
253
|
+
# Single test file
|
|
254
|
+
python -m pytest tests/integration/test_cli_develop.py -v
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Project Structure
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
lightroom-cli/
|
|
261
|
+
+-- cli/ # Click CLI application
|
|
262
|
+
| +-- main.py # Entry point (lr command)
|
|
263
|
+
| +-- output.py # OutputFormatter (json/text/table)
|
|
264
|
+
| +-- helpers.py # bridge_command decorator
|
|
265
|
+
| +-- completions.py # Tab completion
|
|
266
|
+
| +-- commands/ # Command groups
|
|
267
|
+
| +-- system.py # lr system
|
|
268
|
+
| +-- catalog.py # lr catalog
|
|
269
|
+
| +-- develop.py # lr develop (+ curve/mask/local/filter/debug/color)
|
|
270
|
+
| +-- preview.py # lr preview
|
|
271
|
+
| +-- selection.py # lr selection
|
|
272
|
+
| +-- plugin.py # lr plugin
|
|
273
|
+
+-- lightroom_sdk/ # Python SDK
|
|
274
|
+
| +-- client.py # LightroomClient
|
|
275
|
+
| +-- socket_bridge.py # Dual TCP socket
|
|
276
|
+
| +-- resilient_bridge.py # Auto-reconnect + heartbeat
|
|
277
|
+
| +-- retry.py # Per-command timeout
|
|
278
|
+
| +-- protocol.py # JSON-RPC protocol
|
|
279
|
+
| +-- paths.py # Path resolution utilities
|
|
280
|
+
| +-- plugin/ # Lua plugin (bundled)
|
|
281
|
+
| +-- PluginInit.lua # Command router (107 commands)
|
|
282
|
+
| +-- DevelopModule.lua # Develop operations
|
|
283
|
+
| +-- CatalogModule.lua # Catalog operations
|
|
284
|
+
+-- tests/ # pytest test suite (680+ tests)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Requirements
|
|
288
|
+
|
|
289
|
+
- Python >= 3.10
|
|
290
|
+
- Adobe Lightroom Classic
|
|
291
|
+
- macOS (Windows untested)
|
|
292
|
+
|
|
293
|
+
### Python Dependencies
|
|
294
|
+
|
|
295
|
+
- [click](https://click.palletsprojects.com/) >= 8.1 — CLI framework
|
|
296
|
+
- [rich](https://rich.readthedocs.io/) >= 13.0 — Table output
|
|
297
|
+
- [pydantic](https://docs.pydantic.dev/) >= 2.0 — Data validation
|
|
298
|
+
- [platformdirs](https://platformdirs.readthedocs.io/) >= 3.0 — Platform-specific directory paths
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
[MIT](LICENSE)
|
|
File without changes
|
|
File without changes
|