stashapp-cli 0.1.0__py3-none-any.whl

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 (41) hide show
  1. stashapp_cli/__init__.py +2 -0
  2. stashapp_cli/cli.py +149 -0
  3. stashapp_cli/commands/__init__.py +39 -0
  4. stashapp_cli/commands/_common.py +440 -0
  5. stashapp_cli/commands/backup.py +70 -0
  6. stashapp_cli/commands/generate.py +88 -0
  7. stashapp_cli/commands/graphql.py +212 -0
  8. stashapp_cli/commands/group.py +137 -0
  9. stashapp_cli/commands/introspect.py +35 -0
  10. stashapp_cli/commands/job.py +122 -0
  11. stashapp_cli/commands/performer.py +368 -0
  12. stashapp_cli/commands/scan.py +92 -0
  13. stashapp_cli/commands/scene.py +405 -0
  14. stashapp_cli/commands/scrape.py +133 -0
  15. stashapp_cli/commands/stashbox.py +173 -0
  16. stashapp_cli/commands/studio.py +227 -0
  17. stashapp_cli/commands/tag.py +694 -0
  18. stashapp_cli/core.py +165 -0
  19. stashapp_cli/images.py +72 -0
  20. stashapp_cli/introspect.py +343 -0
  21. stashapp_cli/py.typed +0 -0
  22. stashapp_cli/queries/__init__.py +40 -0
  23. stashapp_cli/queries/_get.py +27 -0
  24. stashapp_cli/queries/_image_flags.py +30 -0
  25. stashapp_cli/queries/backup.py +20 -0
  26. stashapp_cli/queries/group.py +117 -0
  27. stashapp_cli/queries/job.py +29 -0
  28. stashapp_cli/queries/metadata.py +42 -0
  29. stashapp_cli/queries/performer.py +179 -0
  30. stashapp_cli/queries/scene.py +139 -0
  31. stashapp_cli/queries/scrape.py +183 -0
  32. stashapp_cli/queries/sources.py +76 -0
  33. stashapp_cli/queries/stashbox.py +67 -0
  34. stashapp_cli/queries/studio.py +145 -0
  35. stashapp_cli/queries/tag.py +244 -0
  36. stashapp_cli/sources.py +116 -0
  37. stashapp_cli-0.1.0.dist-info/METADATA +208 -0
  38. stashapp_cli-0.1.0.dist-info/RECORD +41 -0
  39. stashapp_cli-0.1.0.dist-info/WHEEL +4 -0
  40. stashapp_cli-0.1.0.dist-info/entry_points.txt +3 -0
  41. stashapp_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: stashapp-cli
3
+ Version: 0.1.0
4
+ Summary: Command-line client for the Stash GraphQL API
5
+ Keywords: stash,graphql,cli
6
+ Author: razputingh
7
+ Author-email: razputingh <331436478+razputingh@users.noreply.github.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.13
19
+ Project-URL: Homepage, https://github.com/razputingh/stashapp-cli
20
+ Project-URL: Documentation, https://github.com/razputingh/stashapp-cli/tree/main/docs
21
+ Project-URL: Repository, https://github.com/razputingh/stashapp-cli
22
+ Project-URL: Issues, https://github.com/razputingh/stashapp-cli/issues
23
+ Description-Content-Type: text/markdown
24
+
25
+ # stashapp-cli
26
+
27
+ stashapp-cli is a command-line tool for [Stash](https://github.com/stashapp/stash),
28
+ the self-hosted organizer for your media library. It reads and changes your
29
+ Stash library through the GraphQL API of Stash. Each command prints JSON, so
30
+ you can use stashapp-cli in shell scripts and with tools such as `jq`.
31
+
32
+ stashapp-cli is not part of the Stash project. The Stash developers do not make
33
+ or support it.
34
+
35
+ ## What it does
36
+
37
+ - Find, create, and update studios, tags, groups, scenes, and performers.
38
+ - Merge duplicate tags and performers, and delete tags. A dry run first
39
+ reports what the change will remove.
40
+ - Scrape metadata from stash-boxes and installed scrapers.
41
+ - Start scan, generate, and identify jobs, and wait for them to end.
42
+ - Back up the Stash database, and submit scene fingerprints to a stash-box.
43
+ - Send a GraphQL query or mutation that you write.
44
+
45
+ A stash-box is a shared database of scene and performer metadata, such as
46
+ StashDB.
47
+
48
+ ## Requirements
49
+
50
+ - Python `3.13` or later.
51
+ - A Stash server and an API key for it. stashapp-cli is tested with Stash `v0.31.1`.
52
+ - Optional: [jq](https://jqlang.org/), to read the JSON output in scripts. The
53
+ examples in the guides use it.
54
+
55
+ ## Install
56
+
57
+ Install stashapp-cli from PyPI with [uv](https://docs.astral.sh/uv/) or
58
+ [pipx](https://pipx.pypa.io/). The package is named `stashapp-cli`. The
59
+ command it installs is `stashapp-cli`:
60
+
61
+ ```bash
62
+ uv tool install stashapp-cli
63
+ pipx install stashapp-cli
64
+ ```
65
+
66
+ To install the latest code from GitHub, run:
67
+
68
+ ```bash
69
+ uv tool install git+https://github.com/razputingh/stashapp-cli
70
+ ```
71
+
72
+ ## Connect to Stash
73
+
74
+ stashapp-cli reads two environment variables. It has no credential flags or
75
+ credential files.
76
+
77
+ ```bash
78
+ export STASH_URL=http://localhost:9999
79
+ export STASH_API_KEY=<key>
80
+ ```
81
+
82
+ `STASH_URL` is the base URL of your Stash server. You make an API key in Stash
83
+ under Settings > Security > Authentication. If a variable is not set, the
84
+ command stops with exit status 4. For the other exit statuses, read
85
+ [Errors and exit statuses][errors].
86
+
87
+ ## Quick start
88
+
89
+ Make sure that your Stash server has every name that stashapp-cli uses. Run this
90
+ command before the first write to a server, and after you upgrade Stash:
91
+
92
+ ```bash
93
+ stashapp-cli introspect
94
+ ```
95
+
96
+ Find a tag by its name or alias:
97
+
98
+ ```bash
99
+ stashapp-cli tag find --name hd
100
+ ```
101
+
102
+ Make the tag if it does not exist. Without `--apply`, the command only reports
103
+ what it would send:
104
+
105
+ ```bash
106
+ stashapp-cli tag find-or-create hd
107
+ ```
108
+
109
+ ```json
110
+ {"applied": false, "operation": "tagCreate", "input": {"name": "hd"}}
111
+ ```
112
+
113
+ Add `--apply` to make the change:
114
+
115
+ ```bash
116
+ stashapp-cli tag find-or-create hd --apply
117
+ ```
118
+
119
+ Each command has a `--help` output with its options and examples:
120
+
121
+ ```bash
122
+ stashapp-cli --help
123
+ stashapp-cli tag --help
124
+ stashapp-cli tag merge --help
125
+ ```
126
+
127
+ ## Changes are dry runs by default
128
+
129
+ Each command has one of three kinds. The `--help` output of a command states
130
+ its kind.
131
+
132
+ | Kind | What the command does |
133
+ | --- | --- |
134
+ | `read` | It never changes Stash. |
135
+ | `write` | It changes Stash only with `--apply`. Else it reports the change. |
136
+ | `destructive` | It can make a change that you cannot undo. |
137
+
138
+ A destructive change needs both `--apply` and `--force`. You can put `--apply`
139
+ anywhere in the command. Put `--force` after the command name, for example
140
+ `stashapp-cli tag merge --destination 3 --source 7 --apply --force`.
141
+
142
+ Before you merge or delete, back up the Stash database with
143
+ `stashapp-cli backup --apply`.
144
+
145
+ Do not use `--input` to add one tag, URL, or alias. A list in `--input`
146
+ replaces the whole list in Stash, so the other values are removed. Use the add
147
+ and remove options instead, for example
148
+ `stashapp-cli scene update 812 --add-tag-id 55`.
149
+
150
+ For the full rules, read [Writes are dry runs by default][writes] and
151
+ [Updates replace lists][lists].
152
+
153
+ ## Commands
154
+
155
+ Each command is a group followed by an action, for example `tag merge`. The
156
+ [command reference][commands] has a table of all commands and their kinds.
157
+
158
+ | Group | What it does |
159
+ | --- | --- |
160
+ | [`studio`][studio-cmd] | Get, find, create, and update studios. |
161
+ | [`tag`][tag-cmd] | Get, find, create, update, delete, and merge tags. |
162
+ | [`group`][group-cmd] | Get, find, create, and update groups, for example films. |
163
+ | [`scene`][scene-cmd] | Get, find, and update scenes, and start identify jobs. |
164
+ | [`performer`][performer-cmd] | Get, find, create, update, and merge performers. |
165
+ | [`scrape`][scrape-cmd] | Get metadata from stash-boxes, scrapers, and URLs. |
166
+ | [`scan`, `generate`, `job`][jobs-cmd] | Start scan and generate jobs, and wait for jobs. |
167
+ | [`backup`][backup-cmd] | Back up the Stash database. |
168
+ | [`stashbox`][stashbox-cmd] | Submit scene fingerprints to a stash-box. |
169
+ | [`introspect`, `graphql`][graphql-cmd] | Check the schema, and send your own GraphQL. |
170
+
171
+ ## Documentation
172
+
173
+ - [Usage][usage]: global options, input values, find filters, dry runs, and
174
+ list updates.
175
+ - [Command reference][commands]: the behavior of each command.
176
+ - [Guides][guides]: step-by-step tasks, such as how to merge duplicate tags.
177
+ - [Errors and exit statuses][errors]: the JSON error object, the error codes,
178
+ and the exit statuses.
179
+ - [Glossary][glossary]: the terms that these documents use.
180
+
181
+ ## Contributing
182
+
183
+ Bug reports and pull requests are welcome. Read [CONTRIBUTING.md][contributing]
184
+ for how to run the tests and how to add a command.
185
+
186
+ ## License
187
+
188
+ stashapp-cli is released under the [MIT License][license].
189
+
190
+ [writes]: docs/usage.md#writes-are-dry-runs-by-default
191
+ [lists]: docs/usage.md#updates-replace-lists
192
+ [commands]: docs/commands/README.md
193
+ [studio-cmd]: docs/commands/studio.md
194
+ [tag-cmd]: docs/commands/tag.md
195
+ [group-cmd]: docs/commands/group.md
196
+ [scene-cmd]: docs/commands/scene.md
197
+ [performer-cmd]: docs/commands/performer.md
198
+ [scrape-cmd]: docs/commands/scrape.md
199
+ [jobs-cmd]: docs/commands/jobs.md
200
+ [backup-cmd]: docs/commands/backup.md
201
+ [stashbox-cmd]: docs/commands/stashbox.md
202
+ [graphql-cmd]: docs/commands/graphql.md
203
+ [usage]: docs/usage.md
204
+ [guides]: docs/guides/README.md
205
+ [errors]: docs/errors.md
206
+ [glossary]: docs/glossary.md
207
+ [contributing]: CONTRIBUTING.md
208
+ [license]: LICENSE
@@ -0,0 +1,41 @@
1
+ stashapp_cli/__init__.py,sha256=AzIUqyIfLYgFUqY8-disNtggT9c6ks2_JM9KYulAXCQ,58
2
+ stashapp_cli/cli.py,sha256=WoFD8T49RCrRx-Bqwt7k_PY1pXFrnJBFejV37BOInvA,5258
3
+ stashapp_cli/commands/__init__.py,sha256=cEN6-NiIu1qN1pVjYraQWLj9jjr8_Lsjgafh-hMHbpc,596
4
+ stashapp_cli/commands/_common.py,sha256=9sJwM6-d5NT75ibbWZphMmGZKypXqZRyiuNs-NOpe8U,15849
5
+ stashapp_cli/commands/backup.py,sha256=Tz8x7KIr-SiRHZGX7CnpJ6UYamhovzYqT1J3rtwKL1w,2481
6
+ stashapp_cli/commands/generate.py,sha256=0rLxNDDsh41htZF9XzBwU2j1r8BBBnj_Y9ZfDqIWt3U,2826
7
+ stashapp_cli/commands/graphql.py,sha256=mYII2b0_e8oQKeY23-_r39wFVB54LiEDe3zKOIRH9nQ,6833
8
+ stashapp_cli/commands/group.py,sha256=hmtBVZbb7H9J6lSDiYtsjoIDI1JGq5gJ7HSuf5cL3w0,4401
9
+ stashapp_cli/commands/introspect.py,sha256=9cmnNX0FHTIaxX0ImbW006kmLC35ZpGR63LuRnD2Uhs,956
10
+ stashapp_cli/commands/job.py,sha256=G8CphGq3JkHs-PyhdAgidwE5z5Fg7b1Z7S_AX3ZMyFk,4053
11
+ stashapp_cli/commands/performer.py,sha256=We4HF9PKbBVix369G6Dw_5TYfi4U5q-qwxoAOoTdaUw,12309
12
+ stashapp_cli/commands/scan.py,sha256=tT2eERot-CzWfu1An4fr-gBF2FSaAmQZ1Idt7kPmqZw,2980
13
+ stashapp_cli/commands/scene.py,sha256=zxeP1xLboXsQD-bvHQyyuSSrXNLLoScQBcn7j4Sq77Q,14020
14
+ stashapp_cli/commands/scrape.py,sha256=5IXsJTmxEVEpw9QynI_D5rqcNTcI_siLOnsoD2h7C3o,4565
15
+ stashapp_cli/commands/stashbox.py,sha256=DxNzfw8a-ZZWTIl6g5xqZkmW5rim8onA8dp3Ladmhnw,6238
16
+ stashapp_cli/commands/studio.py,sha256=9O9ya3_xAZP1Ozk79jHx-X4kp6RJmw4I_gcOW7wZ25A,7343
17
+ stashapp_cli/commands/tag.py,sha256=nK0FwTdzqz8FEuim1Y-ArU7J_PPZ_dZVwg4pfvzvOkA,24475
18
+ stashapp_cli/core.py,sha256=24ACYGr41Nckrjdx96MHhTqmZcq4paDKdhkAeVtwWzs,5355
19
+ stashapp_cli/images.py,sha256=D4tns44i9yxrvSFyUwRFVNuHndJ8fEvv-HV6dVlhcfY,2322
20
+ stashapp_cli/introspect.py,sha256=JmgANDrYadEEnLNIVuH1KSJ2wHMBBSB6CaFdIIbJ8Ys,10076
21
+ stashapp_cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ stashapp_cli/queries/__init__.py,sha256=7r7JbMhv0M1aqZ6WXMP8pX31ss78IUOwNfx5aG6TjHs,931
23
+ stashapp_cli/queries/_get.py,sha256=HszqEMbZhyQZRiQabOvESywYzOUlUBUfoUahwpFNOzA,978
24
+ stashapp_cli/queries/_image_flags.py,sha256=Tj9jAZmM5Z6_sOVgx9BUM_93-A-5S-dfXbGBOmH9W_E,1005
25
+ stashapp_cli/queries/backup.py,sha256=wwhfT6gLtfEQHl_DW5RaBQAZCf89qb9XedpvrD7RGs4,535
26
+ stashapp_cli/queries/group.py,sha256=VlHwcCFePCbIbM12C4m20i1KLxti6PFDQ7ar8JRXzmY,2917
27
+ stashapp_cli/queries/job.py,sha256=F3f7bRBgJLN7CrD3Us9JCd_DVrsM0Rx53cmHa1yRPkI,619
28
+ stashapp_cli/queries/metadata.py,sha256=kGYk1OP02oXOLhrONOHdQ71JIlSGUeit194A9BGkX_I,1229
29
+ stashapp_cli/queries/performer.py,sha256=cnpu2HA6X23I6JZ58JHXUB7XX9c4RjcEymIq1WR7oSI,4962
30
+ stashapp_cli/queries/scene.py,sha256=WErgFDkRDu7Vo-AAMH512J9Ds8rZVjARbp-qXHFSESw,3806
31
+ stashapp_cli/queries/scrape.py,sha256=SUb_t9_uiGYFXrR6NX1cLJuxFAktgPPbBuCGNaZ3TbM,3988
32
+ stashapp_cli/queries/sources.py,sha256=Jcmk6zppA5WXVGyZgehf7iR2Gbn9izlVqVNTx87yKIo,2421
33
+ stashapp_cli/queries/stashbox.py,sha256=TwZUQR1_xaMICt2vUnGyX0qmK2CB4V_HnrJNIZJe2kA,2136
34
+ stashapp_cli/queries/studio.py,sha256=wS06I5kmwc5ow5qXxPRm9Ynpn3ENsS5TR_iF5Oam_pY,3661
35
+ stashapp_cli/queries/tag.py,sha256=Ne-x29Eazd8tuKx6rtFBQYa7I1kUHuYIVeXYw2DkXB8,6650
36
+ stashapp_cli/sources.py,sha256=lVNzMU_ac9MCVSRdGSKuLjX1pWBCC2TxM0v1q-BljZ8,4235
37
+ stashapp_cli-0.1.0.dist-info/licenses/LICENSE,sha256=U2yKVpbNvfD5RmmKudZu-atrjDw5sEHMKmudBYEGJ3k,1067
38
+ stashapp_cli-0.1.0.dist-info/WHEEL,sha256=MWx7psoF7KNST9G72pGtiBYuaXRXQXBk9pw5R6FzYko,80
39
+ stashapp_cli-0.1.0.dist-info/entry_points.txt,sha256=48xiz1A3woEOKx80HRTUUOY6X5OaKUTlq3u6lWUNrCI,56
40
+ stashapp_cli-0.1.0.dist-info/METADATA,sha256=TvctQ89xI9ix2NDk1lznYsPh9Qhd7zd-DfkqujziCto,7105
41
+ stashapp_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.13.7
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ stashapp-cli = stashapp_cli.cli:main
3
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 razputingh
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.