bunkr-api 0.1.0b4__tar.gz → 0.2.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.
Files changed (29) hide show
  1. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/PKG-INFO +112 -80
  2. bunkr_api-0.1.0b4/src/bunkr_api.egg-info/PKG-INFO → bunkr_api-0.2.0/README.md +102 -95
  3. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/pyproject.toml +23 -3
  4. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/cli.py +167 -104
  5. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/config.py +1 -1
  6. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/core/scraper.py +56 -29
  7. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/core/tokens.py +20 -8
  8. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/inspector.py +55 -37
  9. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/media/downloader.py +55 -38
  10. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/media/player.py +28 -21
  11. bunkr_api-0.2.0/src/bunkr_api/utils/aio.py +14 -0
  12. bunkr_api-0.1.0b4/README.md → bunkr_api-0.2.0/src/bunkr_api.egg-info/PKG-INFO +128 -80
  13. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api.egg-info/SOURCES.txt +1 -0
  14. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/LICENSE +0 -0
  15. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/MANIFEST.in +0 -0
  16. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/setup.cfg +0 -0
  17. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/__init__.py +0 -0
  18. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/__main__.py +0 -0
  19. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/api.py +0 -0
  20. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/core/__init__.py +0 -0
  21. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/core/db.py +0 -0
  22. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/media/__init__.py +0 -0
  23. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/utils/__init__.py +0 -0
  24. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/utils/formatting.py +0 -0
  25. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api/utils/http.py +0 -0
  26. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api.egg-info/dependency_links.txt +0 -0
  27. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api.egg-info/entry_points.txt +0 -0
  28. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api.egg-info/requires.txt +0 -0
  29. {bunkr_api-0.1.0b4 → bunkr_api-0.2.0}/src/bunkr_api.egg-info/top_level.txt +0 -0
@@ -1,9 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bunkr-api
3
- Version: 0.1.0b4
3
+ Version: 0.2.0
4
4
  Summary: Interactive Python API wrapper for Bunkr
5
5
  Author-email: mrflattire <mrflattirex@gmail.com>
6
6
  License-Expression: MIT
7
+ Keywords: bunkr,api,scraper,downloader,media-downloader,yt-dlp,cli
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Internet :: WWW/HTTP
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Operating System :: OS Independent
7
16
  Requires-Python: >=3.12
8
17
  Description-Content-Type: text/markdown
9
18
  License-File: LICENSE
@@ -21,9 +30,12 @@ Dynamic: license-file
21
30
  **Modular Python toolkit and API wrapper for Bunkr**
22
31
  Search, catalog, download, and stream media with a high-performance interactive terminal UI.
23
32
 
24
- [![Version](https://img.shields.io/badge/version-0.1.0--beta.4-orange)](https://github.com/mrflattire/bunkr-api)
33
+ [![CI](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/mrflattire/bunkr-api/main/ci-badge.json&cacheSeconds=300&&logo=github)](https://github.com/mrflattire/bunkr-api/actions)
34
+ [![PyPI version](https://badge.fury.io/py/bunkr-api.svg?icon=si%3Apython&maxAge=300)](https://pypi.org/project/bunkr-api)
25
35
  [![Python](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
36
+ ![Coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/mrflattire/bunkr-api/main/coverage-badge.json&cacheSeconds=300&logo=pytest)
26
37
  [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
38
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
27
39
 
28
40
  [Features](#-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [Usage](#-detailed-usage--advanced-workflows)
29
41
 
@@ -59,7 +71,7 @@ uv tool install bunkr-api
59
71
  pip install bunkr-api
60
72
  ```
61
73
 
62
- > **Windows users:** `uv tool install` places executables in `%USERPROFILE%\.local\bin`, which is **not** on `PATH` by default on Windows (unlike most Linux/macOS setups). If `bunkr-api`, `bunkr-download`, etc. aren't recognized after install, run:
74
+ > **Windows users:** `uv tool install` places executables in `%USERPROFILE%\.local\bin`, which is **not** on `PATH` by default on Windows (unlike most Linux/macOS setups). If `bunkr-api`, `bunkr-api download`, etc. aren't recognized after install, run:
63
75
  > ```powershell
64
76
  > uv tool update-shell
65
77
  > ```
@@ -124,20 +136,41 @@ Unlike standard video tools, **FFmpeg is not a prerequisite** for this package.
124
136
 
125
137
  ### Command Line Interface
126
138
 
139
+ `bunkr-api` is a single command. Run it bare for the interactive dashboard, or give it a subcommand for scripting:
140
+
127
141
  ```sh
128
142
  # Launch the main interactive catalog menu
129
143
  bunkr-api
130
144
 
131
145
  # Search for a creator and catalog their albums
132
- bunkr-scrape "creator_name"
146
+ bunkr-api scrape "creator_name"
133
147
 
134
148
  # Download a specific album by its database ID
135
- bunkr-download --db-id 5 --workers 5
149
+ bunkr-api download --db-id 5 --workers 5
136
150
 
137
151
  # Stream a specific album directly to MPV
138
- bunkr-stream --db-id 5
152
+ bunkr-api stream --db-id 5
139
153
  ```
140
154
 
155
+ | Command | What it does |
156
+ | :--- | :--- |
157
+ | `bunkr-api` | Interactive dashboard (no arguments) |
158
+ | `bunkr-api scrape [QUERY]` | Search, or browse trending with `--top`, and catalog an album |
159
+ | `bunkr-api download` | Download an album (`--db-id`), staged files (`--staged`), or failed files (`--triage`) |
160
+ | `bunkr-api stream` | Stream an album or staged files in mpv/VLC |
161
+ | `bunkr-api open ID` | Open an album already in the database |
162
+ | `bunkr-api import FILE` | Import a legacy JSON metadata file and open it |
163
+ | `bunkr-api mint` | Refresh expiring CDN tokens (daemon, or one album with `-a ID`) |
164
+ | `bunkr-api inspect` | Database reports, staging and maintenance |
165
+
166
+ Every command has its own `-h`, e.g. `bunkr-api download -h`.
167
+
168
+ **Scripting notes**
169
+
170
+ - Commands exit `0` on success (including "nothing to do", such as an empty `--staged` queue), `1` on a runtime failure (album or file not found), `2` on a usage error, and `130` when interrupted.
171
+ - When no source is given, `download` and `stream` browse interactively *only* on a terminal; under cron or a pipe they exit `2` with a message instead of waiting for input.
172
+ - The pre-subcommand binaries (`bunkr-scrape`, `bunkr-download`, `bunkr-stream`, `bunkr-inspect`, `bunkr-mint`) still work as aliases for the matching subcommand.
173
+
141
174
  ### Python API
142
175
 
143
176
  ```python
@@ -166,10 +199,11 @@ asyncio.run(main())
166
199
  <details open>
167
200
  <summary><h3>Main Dashboard Interface (`bunkr-api`)</h3></summary>
168
201
 
169
- The primary entry point of the toolkit. It serves as an interactive hub for managing your entire media catalog. It is designed to intelligently handle inputs—whether you want to browse your collection, jump to a specific album, or import json metadata files.
202
+ The primary entry point of the toolkit. Run with no arguments it opens an interactive hub for managing your entire media catalog; with a subcommand it runs that one task and exits (see the sections below).
170
203
 
171
204
  ```sh
172
- bunkr-api [OPTIONS] [PATH/ID]
205
+ bunkr-api # interactive dashboard
206
+ bunkr-api <command> ... # scrape | download | stream | open | import | mint | inspect
173
207
  ```
174
208
 
175
209
  **Common Examples:**
@@ -179,17 +213,13 @@ bunkr-api [OPTIONS] [PATH/ID]
179
213
  bunkr-api
180
214
 
181
215
  # Jump directly to a specific album detail view by its Database ID
182
- bunkr-api --db-id 17
183
- # OR simply (legacy support)
184
- bunkr-api 17
216
+ bunkr-api open 17
185
217
 
186
218
  # Import a local JSON metadata file and view it immediately
187
- bunkr-api -i ./album_metadata.json
188
- # OR simply drop the file onto the terminal
189
- bunkr-api "./path/to/metadata.json"
219
+ bunkr-api import ./album_metadata.json
190
220
 
191
- # Perform a quick search and resolution directly from the launch command
192
- bunkr-api "Natalie Roush" --mode broad --per 40
221
+ # Search and resolve an album directly from the command line
222
+ bunkr-api scrape "Natalie Roush" --mode broad --per 40 --sort latest
193
223
  ```
194
224
 
195
225
  **Main Catalog Commands:**
@@ -203,7 +233,7 @@ Inside the main menu, use these single-character commands:
203
233
  | `d` | **Delete**: Remove albums from your database (supports single IDs, lists, or ranges). |
204
234
  | `q` | **Quit**: Safely exit the application. |
205
235
 
206
- **The [交互 Engine] Detail View:**
236
+ **The Album Detail View:**
207
237
 
208
238
  Once inside an album, the "Action Context" menu allows for granular media control:
209
239
 
@@ -215,7 +245,7 @@ Once inside an album, the "Action Context" menu allows for granular media contro
215
245
  6. **Stage/Unstage**: Flag specific items (or the whole album) for later batch retrieval.
216
246
  7. **Navigation (`n`/`p`)**: Flip through pages of large asset inventories.
217
247
 
218
- > **Intelligent Routing**: `bunkr-api` prioritizes its arguments. If it detects a path ending in `.json`, it imports it. If it detects a number, it jumps to that ID. Otherwise, it treats the input as a search term to launch the scraper.
248
+ > **Upgrading from the bare-argument form?** `bunkr-api 17`, `bunkr-api "query"`, `bunkr-api --db-id 17` and `bunkr-api -i file.json` still work for now: they are translated to `open`, `scrape` and `import` with a deprecation note on stderr. Prefer the explicit subcommands in scripts.
219
249
 
220
250
  ### Why this command is the best choice for users:
221
251
  1. **Centralized Control**: You never need to leave this interface to perform 99% of your tasks.
@@ -227,31 +257,31 @@ Once inside an album, the "Action Context" menu allows for granular media contro
227
257
  ---
228
258
 
229
259
  <details>
230
- <summary><h3>Standalone Downloader (`bunkr-download`)</h3></summary>
260
+ <summary><h3>Downloader (`bunkr-api download`)</h3></summary>
231
261
 
232
262
  A high-performance retrieval engine that utilizes a multi-threaded worker pool and the `yt-dlp` backend to maximize your bandwidth. It handles token resolution and directory organization automatically.
233
263
 
234
264
  ```sh
235
- bunkr-download [OPTIONS]
265
+ bunkr-api download [OPTIONS]
236
266
  ```
237
267
 
238
268
  **Common Examples:**
239
269
 
240
270
  ```sh
241
271
  # Download an entire album using 5 concurrent workers
242
- bunkr-download --db-id 17 --workers 5
272
+ bunkr-api download --db-id 17 --workers 5
243
273
 
244
274
  # Download a specific range of files (e.g., first five files)
245
- bunkr-download --db-id 17 --number 1-5
275
+ bunkr-api download --db-id 17 --number 1-5
246
276
 
247
277
  # The Triage Workflow: Retry all files currently marked as 'FAILED' in the DB
248
- bunkr-download --triage --workers 3
278
+ bunkr-api download --triage --workers 3
249
279
 
250
280
  # The Staged Workflow: Download everything globally marked as 'STAGED'
251
- bunkr-download --staged
281
+ bunkr-api download --staged
252
282
 
253
283
  # Point a download to a specific external hard drive path
254
- bunkr-download --db-id 17 -o "D:/Media/Archive"
284
+ bunkr-api download --db-id 17 -o "D:/Media/Archive"
255
285
  ```
256
286
 
257
287
  **Available Options:**
@@ -266,11 +296,11 @@ bunkr-download --db-id 17 -o "D:/Media/Archive"
266
296
  | `--triage` | Automatically aggregate and retry all items with a `FAILED` download status. |
267
297
  | `-i, --input` | Path to a local legacy JSON file to download without using the database. |
268
298
 
269
- > **Interactive Mode**: If you run `bunkr-download` without any arguments, it launches a catalog browser identical to the main dashboard, allowing you to pick an album and specify workers visually.
299
+ > **Interactive Mode**: If you run `bunkr-api download` in a terminal without choosing a source (`--db-id`, `--staged`, `--triage`, `-i`), it launches a catalog browser identical to the main dashboard, allowing you to pick an album and specify workers visually. Without a terminal (cron, pipes) it exits with an error instead of waiting for input. The source options are mutually exclusive.
270
300
 
271
- ### Why this standalone command is useful:
301
+ ### Why this command is useful:
272
302
  1. **Error Recovery**: The `--triage` flag is the fastest way to clean up a catalog that had network interruptions during a large batch.
273
- 2. **Automation**: It is perfect for headless environments or cron jobs (e.g., `bunkr-download --staged` running every night).
303
+ 2. **Automation**: It is perfect for headless environments or cron jobs (e.g., `bunkr-api download --staged` running every night).
274
304
  3. **Resource Management**: You can precisely control system load by adjusting the `--workers` flag based on your current internet speed and CPU availability.
275
305
 
276
306
  </details>
@@ -278,28 +308,28 @@ bunkr-download --db-id 17 -o "D:/Media/Archive"
278
308
  ---
279
309
 
280
310
  <details>
281
- <summary><h3>Standalone Streamer (`bunkr-stream`)</h3></summary>
311
+ <summary><h3>Streamer (`bunkr-api stream`)</h3></summary>
282
312
 
283
313
  Stream content directly to your media player without downloading. This command automatically triggers the "Escape Hatch" to refresh any expired tokens before playback starts.
284
314
 
285
315
  ```sh
286
- bunkr-stream --db-id ID [OPTIONS]
316
+ bunkr-api stream --db-id ID [OPTIONS]
287
317
  ```
288
318
 
289
319
  **Common Examples:**
290
320
 
291
321
  ```sh
292
322
  # Stream an entire album by its Database ID
293
- bunkr-stream --db-id 17
323
+ bunkr-api stream --db-id 17
294
324
 
295
325
  # Stream a specific selection (e.g., tracks 1, 5, and 10 through 15)
296
- bunkr-stream --db-id 17 --number 1,5,10-15
326
+ bunkr-api stream --db-id 17 --number 1,5,10-15
297
327
 
298
328
  # Force playback in VLC instead of the default MPV
299
- bunkr-stream --db-id 17 --player vlc
329
+ bunkr-api stream --db-id 17 --player vlc
300
330
 
301
331
  # Stream everything currently marked as 'STAGED' in your database
302
- bunkr-stream --staged
332
+ bunkr-api stream --staged
303
333
  ```
304
334
 
305
335
  **Available Options:**
@@ -313,38 +343,38 @@ bunkr-stream --staged
313
343
 
314
344
  > **Note on MPV**: When using MPV, `bunkr-api` opens a JSON IPC server. This allows the terminal to show you exactly which track is playing, the current timestamp, and the buffer/cache duration in real-time.
315
345
 
316
- ### Why this standalone command is useful:
346
+ ### Why this command is useful:
317
347
  1. **Low Latency**: It bypasses the Main Menu logic, allowing you to start video playback in one command.
318
348
  2. **Headless Maintenance**: If you know an album ID, you can start a stream without ever seeing the catalog list.
319
- 3. **Staging Workflow**: You can spend time "Staging" items via `bunkr-api` or `bunkr-inspect`, and then later just run `bunkr-stream --staged` to play your curated queue.
349
+ 3. **Staging Workflow**: You can spend time "Staging" items via `bunkr-api` or `bunkr-api inspect`, and then later just run `bunkr-api stream --staged` to play your curated queue.
320
350
 
321
351
  </details>
322
352
 
323
353
  ---
324
354
 
325
355
  <details>
326
- <summary><h3>Standalone Scraper (`bunkr-scrape`)</h3></summary>
356
+ <summary><h3>Scraper (`bunkr-api scrape`)</h3></summary>
327
357
 
328
358
  A deep-resolution engine designed to discover albums, extract asset metadata, and synchronize findings with your local database. Bypasses detection and provides real-time feedback during the resolution process.
329
359
 
330
360
  ```sh
331
- bunkr-scrape [QUERY] [OPTIONS]
361
+ bunkr-api scrape [QUERY] [OPTIONS]
332
362
  ```
333
363
 
334
364
  **Common Examples:**
335
365
 
336
366
  ```sh
337
367
  # Search for a creator and enter the interactive selection menu
338
- bunkr-scrape "InpossibleOreo"
368
+ bunkr-api scrape "InpossibleOreo"
339
369
 
340
370
  # Perform a strict search with high result volume and custom sorting
341
- bunkr-scrape "Natalie" --mode strict --per 60 --sort mostfiles
371
+ bunkr-api scrape "Natalie" --mode strict --per 60 --sort mostfiles
342
372
 
343
373
  # Browse trending videos from the last 24 hours
344
- bunkr-scrape --top videos
374
+ bunkr-api scrape --top videos
345
375
 
346
376
  # Archive metadata to a specific folder without using the default export path
347
- bunkr-scrape "CreatorName" --save-json --output "C:/Backups/Bunkr_Metadata"
377
+ bunkr-api scrape "CreatorName" --save-json --output "C:/Backups/Bunkr_Metadata"
348
378
  ```
349
379
 
350
380
  **Available Options:**
@@ -355,14 +385,16 @@ bunkr-scrape "CreatorName" --save-json --output "C:/Backups/Bunkr_Metadata"
355
385
  | `-m, --mode` | Filtering execution mode: `broad`, `strict`, `fuzzy`, `substring`, `whole`. |
356
386
  | `-p, --per` | Total results requested per page: `20`, `40`, `60`, `100`. |
357
387
  | `-s, --sort` | Result array sorting metric: `latest`, `oldest`, `mostfiles`. |
358
- | `-t, --top` | Crawl trending layout categories: `albums`, `videos`, `files`, `images`. |
388
+ | `-t, --top [CATEGORY]` | Browse trending instead of searching: `albums`, `videos`, `files`, `images` (omit the category to be asked). Cannot be combined with a query. |
359
389
  | `--save-json` | Export the resolved album metadata to a `.json` file. |
360
390
  | `-o, --output` | Override the default directory for JSON exports. |
361
391
 
362
- > **Deep Resolution Intelligence**: Unlike basic scrapers, `bunkr-scrape` performs a deep resolution. It navigates into your selected album, parses the internal JavaScript state, and extracts the **True IDs** required for streaming and downloading.
392
+ > **After the selection**: once you pick an album it is cataloged in the database and its detail view opens, so you can stream, download or stage it straight away.
393
+
394
+ > **Deep Resolution Intelligence**: Unlike basic scrapers, `bunkr-api scrape` performs a deep resolution. It navigates into your selected album, parses the internal JavaScript state, and extracts the **True IDs** required for streaming and downloading.
363
395
 
364
- ### Why this standalone command is useful:
365
- 1. **Direct Cataloging**: It is the primary way to "feed" your database. Any album resolved here becomes immediately available in `bunkr-api`, `bunkr-download`, and `bunkr-stream`.
396
+ ### Why this command is useful:
397
+ 1. **Direct Cataloging**: It is the primary way to "feed" your database. Any album resolved here becomes immediately available in `bunkr-api`, `bunkr-api download`, and `bunkr-api stream`.
366
398
  2. **Metadata Archival**: By using `--save-json`, you can create a portable snapshot of an album's contents (including original filenames and sizes) before a link potentially goes dead.
367
399
  3. **Bypass Navigation**: If you know exactly what you are looking for, flags like `--mode strict` and `--sort mostfiles` get you to the correct result much faster than manual browsing.
368
400
 
@@ -371,34 +403,34 @@ bunkr-scrape "CreatorName" --save-json --output "C:/Backups/Bunkr_Metadata"
371
403
  ---
372
404
 
373
405
  <details>
374
- <summary><h3>System Management (`bunkr-inspect`)</h3></summary>
406
+ <summary><h3>System Management (`bunkr-api inspect`)</h3></summary>
375
407
 
376
- The "Swiss Army Knife" for your local database. `bunkr-inspect` allows you to generate reports, manage staging queues, and perform database maintenance or schema migrations without writing raw SQL.
408
+ The "Swiss Army Knife" for your local database. `bunkr-api inspect` allows you to generate reports, manage staging queues, and perform database maintenance or schema migrations without writing raw SQL.
377
409
 
378
410
  ```sh
379
- bunkr-inspect [COMMAND] [TARGET] [OPTIONS]
411
+ bunkr-api inspect [COMMAND] [TARGET] [OPTIONS]
380
412
  ```
381
413
 
382
414
  **Common Examples:**
383
415
 
384
416
  ```sh
385
417
  # View a global summary of your database health and pipeline metrics
386
- bunkr-inspect view dashboard
418
+ bunkr-api inspect view dashboard
387
419
 
388
420
  # Get a detailed per-album breakdown of completion % and total sizes
389
- bunkr-inspect view albums
421
+ bunkr-api inspect view albums
390
422
 
391
423
  # Dump every internal field for a specific album (useful for debugging IDs)
392
- bunkr-inspect view album --id 11
424
+ bunkr-api inspect view album --id 11
393
425
 
394
426
  # Stage a range of assets globally for the next download run
395
- bunkr-inspect stage asset 50-100
427
+ bunkr-api inspect stage asset 50-100
396
428
 
397
429
  # Repair metadata drift: Recompute file counts and aggregate sizes from actual records
398
- bunkr-inspect db --recount
430
+ bunkr-api inspect db --recount
399
431
 
400
432
  # Permanently delete specific albums and their associated file records
401
- bunkr-inspect db --wipe 12,15-20
433
+ bunkr-api inspect db --wipe 12,15-20
402
434
  ```
403
435
 
404
436
  **Available Sub-Commands:**
@@ -414,7 +446,7 @@ bunkr-inspect db --wipe 12,15-20
414
446
  | `[table_name]` | Performs a raw dump of any table (e.g., `assets` or `system_config`). |
415
447
 
416
448
  #### 2. `stage` (Queue Management)
417
- Used to flag items for batch actions in `bunkr-download` or `bunkr-stream`.
449
+ Used to flag items for batch actions in `bunkr-api download` or `bunkr-api stream`.
418
450
  * **Targets**: `album` (cascades to all files) or `asset` (individual files).
419
451
  * **Selection**: Supports IDs, comma-separated lists, ranges, or `all`.
420
452
  * **Options**: Use `--off` to remove the staging flag.
@@ -430,7 +462,7 @@ Used to flag items for batch actions in `bunkr-download` or `bunkr-stream`.
430
462
 
431
463
  > **Raw Table Dumps**: You can filter any raw table view using `--search "text"` or change the output volume with `--limit 50` or `--all`.
432
464
 
433
- ### Why this standalone command is useful:
465
+ ### Why this command is useful:
434
466
  1. **Data Integrity**: If the scraper crashes mid-way, `--recount` ensures your dashboard doesn't show "33 files" when only 10 were successfully cataloged.
435
467
  2. **Audit Logs**: `view expiring` helps you predict which downloads might fail before you even start them.
436
468
  3. **Schema Evolution**: As the project grows, `add-column` allows you to update your local database structure without losing your existing history.
@@ -440,12 +472,12 @@ Used to flag items for batch actions in `bunkr-download` or `bunkr-stream`.
440
472
  ---
441
473
 
442
474
  <details>
443
- <summary><h3>Token Maintenance (`bunkr-mint`)</h3></summary>
475
+ <summary><h3>Token Maintenance (`bunkr-api mint`)</h3></summary>
444
476
 
445
- A dedicated maintenance utility designed to keep your media library "hot." Because Bunkr CDN links use 2-hour time-limited expiration (`ex`) timestamps, they eventually stop working. `bunkr-mint` automates the process of fetching fresh signatures using the stored **True IDs** in your database.
477
+ A dedicated maintenance utility designed to keep your media library "hot." Because Bunkr CDN links use 2-hour time-limited expiration (`ex`) timestamps, they eventually stop working. `bunkr-api mint` automates the process of fetching fresh signatures using the stored **True IDs** in your database.
446
478
 
447
479
  ```sh
448
- bunkr-mint [OPTIONS]
480
+ bunkr-api mint [OPTIONS]
449
481
  ```
450
482
 
451
483
  **Common Examples:**
@@ -453,10 +485,10 @@ bunkr-mint [OPTIONS]
453
485
  ```sh
454
486
  # Launch the background daemon
455
487
  # This will poll your entire database every 60s and refresh tokens near expiry
456
- bunkr-mint
488
+ bunkr-api mint
457
489
 
458
490
  # Perform a one-shot targeted refresh for a specific album and then exit
459
- bunkr-mint --album-id 17
491
+ bunkr-api mint --album-id 17
460
492
  ```
461
493
 
462
494
  **Available Options:**
@@ -468,15 +500,15 @@ bunkr-mint --album-id 17
468
500
 
469
501
  **The "Escape Hatch" Workflow:**
470
502
 
471
- While the main `bunkr-api` dashboard triggers an automated "Escape Hatch" refresh when you start a stream or download, running `bunkr-mint` in a separate terminal window is the recommended workflow for heavy users.
503
+ While the main `bunkr-api` dashboard triggers an automated "Escape Hatch" refresh when you start a stream or download, running `bunkr-api mint` in a separate terminal window is the recommended workflow for heavy users.
472
504
 
473
505
  * **Concurrency**: Uses a semaphore-controlled worker pool to refresh dozens of tokens simultaneously without hitting rate limits.
474
506
  * **Progress Tracking**: Features a real-time `Rich` progress bar and spinner so you can see exactly which assets are being updated.
475
507
  * **Database Sync**: Automatically updates the `signed_cdn_url` and `token_expiry_timestamp` columns in your SQLite database.
476
508
 
477
- > **Pro Tip**: If you are planning a massive download session (100+ files), run `bunkr-mint` in the background first to ensure every link is valid before the download engine starts.
509
+ > **Pro Tip**: If you are planning a massive download session (100+ files), run `bunkr-api mint` in the background first to ensure every link is valid before the download engine starts.
478
510
 
479
- ### Why this standalone command is useful:
511
+ ### Why this command is useful:
480
512
  1. **Continuous Uptime**: Keeps your catalog ready for instant streaming at any time, even weeks after the initial scrape.
481
513
  2. **Headless Operations**: Can be run on a server or a separate monitor to act as a "watchdog" for your media library.
482
514
  3. **Low Overhead**: The daemon stays idle most of the time, only consuming network resources when tokens are actually nearing their expiration window (default 10 minutes).
@@ -488,7 +520,7 @@ While the main `bunkr-api` dashboard triggers an automated "Escape Hatch" refres
488
520
  <details>
489
521
  <summary><h3>Python API (`BunkrAPI`)</h3></summary>
490
522
 
491
- Everything the CLI tools do is also available as a plain Python library, so you can script your own workflows — cron jobs, batch imports, custom dashboards — without touching the terminal UI at all. `BunkrAPI` is a single facade class wrapping the scraper, downloader, player, and database.
523
+ Everything the CLI tools do is also available as a plain Python library, so you can script your own workflows, like cron jobs, batch imports, custom dashboards, all without touching the terminal UI at all. `BunkrAPI` is a single facade class wrapping the scraper, downloader, player, and database.
492
524
 
493
525
  ```python
494
526
  from bunkr_api import BunkrAPI
@@ -519,19 +551,19 @@ api = BunkrAPI() # uses the same ~/.bunkr_api/media_tracker.db as the CLI tools
519
551
  | Method | Description |
520
552
  | :--- | :--- |
521
553
  | `download_album(album_id, workers=3, output_dir=...)` | Multi-threaded download for a whole album. Raises `ValueError` if the album doesn't exist. |
522
- | `download_staged(workers=3, output_dir=...)` | Downloads everything currently flagged as staged (see `bunkr-inspect stage` or the dashboard's `6` action). A no-op if nothing is staged. |
554
+ | `download_staged(workers=3, output_dir=...)` | Downloads everything currently flagged as staged (see `bunkr-api inspect stage` or the dashboard's `6` action). A no-op if nothing is staged. |
523
555
  | `retry_failed(workers=3, output_dir=...)` | Retries every asset currently marked `FAILED`. A no-op if nothing has failed. |
524
556
  | `stream_album(album_id, indices_spec="all", player="mpv")` | Resolves tokens and launches `mpv`/`vlc` for the given selection. Raises `ValueError` if the album has no assets. |
525
557
 
526
558
  #### Maintenance
527
559
  | Method | Description |
528
560
  | :--- | :--- |
529
- | `refresh_tokens(album_id=None)` *(async)* | Refreshes any expiring CDN tokens — scoped to one album, or the whole database if omitted. Always a single pass; never blocks forever. |
561
+ | `refresh_tokens(album_id=None)` *(async)* | Refreshes any expiring CDN tokens; scoped to one album, or the whole database if omitted. Always a single pass; never blocks forever. |
530
562
  | `delete_album(album_id)` *(sync)* | Deletes an album and all its assets (cascades at the database level). Returns `True` if something was actually deleted. |
531
563
 
532
564
  ---
533
565
 
534
- **Example — the classic three-step flow:**
566
+ **Example ; the classic three-step flow:**
535
567
 
536
568
  ```python
537
569
  import asyncio
@@ -549,7 +581,7 @@ async def main():
549
581
  asyncio.run(main())
550
582
  ```
551
583
 
552
- **Example — the same flow, collapsed into one call:**
584
+ **Example ; the same flow, collapsed into one call:**
553
585
 
554
586
  ```python
555
587
  import asyncio
@@ -565,7 +597,7 @@ async def main():
565
597
  asyncio.run(main())
566
598
  ```
567
599
 
568
- **Example — browsing your existing catalog without touching the network:**
600
+ **Example ; browsing your existing catalog without touching the network:**
569
601
 
570
602
  ```python
571
603
  from bunkr_api import BunkrAPI
@@ -584,7 +616,7 @@ if album:
584
616
  print(f" -> {api.get_valid_url(asset['id'])}")
585
617
  ```
586
618
 
587
- **Example — streaming programmatically:**
619
+ **Example ; streaming programmatically:**
588
620
 
589
621
  ```python
590
622
  import asyncio
@@ -598,7 +630,7 @@ async def main():
598
630
  asyncio.run(main())
599
631
  ```
600
632
 
601
- **Example — maintenance batch jobs (great for a nightly cron script):**
633
+ **Example ; maintenance batch jobs (great for a nightly cron script):**
602
634
 
603
635
  ```python
604
636
  import asyncio
@@ -610,7 +642,7 @@ async def nightly_maintenance():
610
642
  # Keep every token in the database fresh
611
643
  await api.refresh_tokens()
612
644
 
613
- # Pick up anything you staged earlier via `bunkr-inspect stage` or the dashboard
645
+ # Pick up anything you staged earlier via `bunkr-api inspect stage` or the dashboard
614
646
  await api.download_staged(workers=4)
615
647
 
616
648
  # Give yesterday's network blips another chance
@@ -619,7 +651,7 @@ async def nightly_maintenance():
619
651
  asyncio.run(nightly_maintenance())
620
652
  ```
621
653
 
622
- **Example — resolving several albums concurrently with `asyncio.gather`:**
654
+ **Example ; resolving several albums concurrently with `asyncio.gather`:**
623
655
 
624
656
  ```python
625
657
  import asyncio
@@ -646,7 +678,7 @@ async def main():
646
678
  asyncio.run(main())
647
679
  ```
648
680
 
649
- **Example — cleaning up an album you no longer want:**
681
+ **Example ; cleaning up an album you no longer want:**
650
682
 
651
683
  ```python
652
684
  from bunkr_api import BunkrAPI
@@ -658,8 +690,8 @@ print(f"Album 5 removed: {was_deleted}") # False if it never existed
658
690
 
659
691
  ### Why the Python API is useful:
660
692
  1. **No CLI required for automation**: cron jobs, scheduled maintenance, or a custom Discord bot can all drive the same database the interactive tools use, with zero terminal interaction.
661
- 2. **Composable**: every method returns plain dicts/lists/ints/bools — no custom objects to learn — so it's trivial to slot into an existing script, web framework, or notebook.
662
- 3. **Safe to embed**: because the network/disk/subprocess methods are genuinely async (not just decorated), you can call them from inside your own already-running event loop — a FastAPI route handler, a Discord.py command, a Jupyter cell — without the classic "asyncio.run() cannot be called from a running event loop" crash.
693
+ 2. **Composable**: every method returns plain dicts/lists/ints/bools. No custom objects to learn, so it's trivial to slot into an existing script, web framework, or notebook.
694
+ 3. **Safe to embed**: because the network/disk/subprocess methods are genuinely async (not just decorated), you can call them from inside your own already-running event loop; a FastAPI route handler, a Discord.py command, a Jupyter cell, all without the classic "asyncio.run() cannot be called from a running event loop" crash.
663
695
 
664
696
  </details>
665
697
 
@@ -672,9 +704,9 @@ The application stores all data in a hidden directory in your user profile to en
672
704
  * **SQLite Database**: `~/.bunkr_api/media_tracker.db`
673
705
  * **Logs**: `~/.bunkr_api/logs/`
674
706
  * **Default Downloads**: `~/Downloads/bunkr_downloads/`
675
- * **Default JSON Exports**: `~/Downloads/bunkr_downloads/jsons/` — used by both `bunkr-api --save-json` and `bunkr-scrape --save-json` when `-o/--output` isn't given.
707
+ * **Default JSON Exports**: `~/Downloads/bunkr_downloads/jsons/` Used by `bunkr-api scrape --save-json` when `-o/--output` isn't given.
676
708
 
677
- > **Pro Tip**: Every command that writes files (`bunkr-scrape --save-json`, `bunkr-download`, etc.) accepts an `-o/--output` flag to override its destination for that run.
709
+ > **Pro Tip**: Every command that writes files (`bunkr-api scrape --save-json`, `bunkr-api download`, etc.) accepts an `-o/--output` flag to override its destination for that run.
678
710
 
679
711
  ---
680
712