video-cook 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ChHsiching
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,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: video-cook
3
+ Version: 0.1.0
4
+ Summary: Deterministic executor for the video-cooking skill pipeline. Handles yt-dlp download, whisperX transcription, ffmpeg burn, and mechanical shipment verification — so agents don't hand-assemble long commands.
5
+ Author: ChHsiching
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ChHsiching/video-cook
8
+ Project-URL: Repository, https://github.com/ChHsiching/video-cook
9
+ Keywords: yt-dlp,whisperx,ffmpeg,subtitles,video,cli
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Multimedia :: Video
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: download
21
+ Requires-Dist: yt-dlp>=2026.3.3; extra == "download"
22
+ Provides-Extra: transcribe
23
+ Requires-Dist: whisperx>=3.8.0; extra == "transcribe"
24
+ Provides-Extra: all
25
+ Requires-Dist: yt-dlp>=2026.3.3; extra == "all"
26
+ Requires-Dist: whisperx>=3.8.0; extra == "all"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # video-cook
32
+
33
+ Deterministic executor for the [video-cooking](https://github.com/ChHsiching/video-cooking-skill) skill pipeline. Wraps yt-dlp, whisperX, and ffmpeg into subcommands that assemble correctly every time — so the skill docs can stay short and the agent never hand-assembles a long command.
34
+
35
+ **This is the hands, not the brain.** Skills decide *what* to do, *when*, and handle creative work (translation, copywriting). cook only executes the deterministic parts and verifies the expected outputs exist.
36
+
37
+ ## Why
38
+
39
+ The video-cooking / video-download / video-subtitle skill trio started as natural-language docs that told the agent which yt-dlp / ffmpeg / whisperx commands to run. Three classes of bugs kept recurring:
40
+
41
+ 1. **Shell escaping traps** — Windows paths with `C:` break ffmpeg's `ass` filter; backslashes get eaten by PowerShell; stdout redirects silently swallow downloads.
42
+ 2. **Hand-assembly drift** — the agent forgets a flag (`--convert-thumbnails jpg`), picks the wrong template variable, renames the wrong file.
43
+ 3. **No mechanical completion check** — "the agent feels done" is not a Done criterion. Real runs shipped without `cover.jpg`, without `cloud-srt/`, with translation drift the agent couldn't see.
44
+
45
+ cook fixes all three by being the single place where the commands are assembled. The skill docs shrink to a pipeline skeleton; the completion criteria become "cook exit 0".
46
+
47
+ ## Install
48
+
49
+ **Option 1: One-liner via uv** (recommended — uv handles Python interpreter + isolated env + PATH wiring automatically, no pip/venv knowledge needed):
50
+
51
+ ```bash
52
+ # Linux / macOS
53
+ curl -LsSf https://github.com/ChHsiching/video-cook/releases/latest/download/install.sh | sh
54
+ # Windows (PowerShell)
55
+ irm https://github.com/ChHsiching/video-cook/releases/latest/download/install.ps1 | iex
56
+ ```
57
+
58
+ The installer uses [uv](https://astral.sh/uv/) to install `video-cook[all]` as an isolated tool (~2GB — pulls whisperx + torch). After install, open a new shell and run `cook doctor`.
59
+
60
+ **Option 2: pip directly**:
61
+
62
+ ```bash
63
+ pip install video-cook[all] # yt-dlp + whisperx + cook itself
64
+ # or pick what you need:
65
+ pip install video-cook[download] # for `cook download`
66
+ pip install video-cook[transcribe] # for `cook transcribe`
67
+ ```
68
+
69
+ ffmpeg and Node.js must be on PATH separately (cook can't pip-install those).
70
+
71
+ ## Subcommands
72
+
73
+ | Command | What it does | Replaces (manual steps) |
74
+ |---|---|---|
75
+ | `cook doctor` | Check environment (ffmpeg/node/yt-dlp/whisperx/torch+CUDA) | Skill's "Environment reuse" prose |
76
+ | `cook download <url>` | yt-dlp download + cookie negotiation + thumbnail rename + ffprobe verify | video-download Steps 1-3 |
77
+ | `cook extract <root> <name>` | ffmpeg 16kHz mono WAV extraction | video-subtitle Step 1 |
78
+ | `cook transcribe <root> <name>` | whisperX transcription, auto-detects CUDA, auto-detaches | video-subtitle Step 2 |
79
+ | `cook subtitles <root> <name>` | shorten → merge-short → biliteral → ASS + cloud-srt in one shot | video-subtitle Step 4 + cloud-srt |
80
+ | `cook burn <root> <name>` | ffmpeg subtitle burning, auto-detaches, subprocess list-form | video-subtitle Step 5 |
81
+ | `cook cover <root> <name>` | Place `cover.jpg` in `cooked/` (reuses raw thumbnail) | video-subtitle Step 6 cover task |
82
+ | `cook show-source <root> <name>` | Extract key fields (title/uploader/links/description) from source.json | (new — surfaces the source context for translation + upload metadata) |
83
+ | `cook verify-align <root> <name>` | DP-align `en.srt` vs `translations.txt`, catch missing/drifted translations | (new — no prior equivalent) |
84
+ | `cook verify-shipment <root> <name>` | Check the full release set exists; exit 0 = ready to ship | (new — no prior equivalent) |
85
+
86
+ Every command prints a JSON object on stdout (machine-readable; agents parse this) and human-readable progress on stderr. Exit codes are meaningful: 0 = done criterion passed, non-zero = it didn't.
87
+
88
+ ## Usage from a skill
89
+
90
+ The skill docs call cook as a subprocess and branch on its exit code. Example skeleton from video-subtitle:
91
+
92
+ ```
93
+ Step 1: cook extract <root> <name> → exit 0 = done
94
+ Step 2: cook transcribe <root> <name> → exit 0 = launched, poll log until "[transcribe] done."
95
+ Step 3: (agent translates → writes translations.txt)
96
+ cook verify-align <root> <name> → exit 0 = aligned, proceed
97
+ Step 4: cook subtitles <root> <name> --mode bottom-bar --bar-px 180
98
+ Step 5: cook burn <root> <name> --mode bottom-bar --bar-px 180
99
+ Step 6: (agent writes upload.md)
100
+ cook cover <root> <name>
101
+ Step 7: (agent writes README.md)
102
+ ```
103
+
104
+ The router (`video-cooking`) calls `cook verify-shipment` as the final gate before reporting the pipeline done.
105
+
106
+ ## Bugs that cook fixes
107
+
108
+ | Bug in the old skill docs | How cook fixes it |
109
+ |---|---|
110
+ | `--dump-json > file.json` silently swallowed downloads | cook uses `print_to_file` (yt-dlp's native JSON-to-file option) |
111
+ | Thumbnail came out as `<name>.raw.jpg` not `<name>.jpg` | cook renames it after download |
112
+ | Windows `C:` paths broke ffmpeg `ass` filter | cook uses subprocess list-form (never shell), runs from subtitle/ dir with bare filename |
113
+ | `subtitles.py split` leaked single-language cues across zh.srt/en.srt | cook copies `*.merged.srt` to cloud-srt instead of splitting bilingual.srt |
114
+ | `transcribe.py` hardcoded `device="cpu"`, float16 unusable on GPU | cook auto-detects CUDA → float16+cuda, else float32+cpu |
115
+ | `source.json` downloaded but never read by downstream — author/links/description wasted | `cook show-source` surfaces the curated fields translation and upload metadata consume |
116
+ | detached template only covered transcribe, not burn | cook's `_detach()` helper handles both uniformly |
117
+ | No mechanical way to catch translation drift | `cook verify-align` runs DP global alignment |
118
+ | No mechanical way to catch missing release-set files | `cook verify-shipment` checks every expected file |
119
+
120
+ ## Development
121
+
122
+ ```bash
123
+ git clone https://github.com/ChHsiching/video-cook
124
+ cd video-cook
125
+ pip install -e .[dev]
126
+ pytest test_cook.py -v
127
+ ```
128
+
129
+ Tests cover the subcommands whose correctness is non-obvious: `verify-align` (DP alignment edge cases), `verify-shipment` (file-presence checks), and the cloud-srt copy logic (the fix for the split leak). No network, no ffmpeg, no whisperx — all tests use temp dirs and fake files.
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,103 @@
1
+ # video-cook
2
+
3
+ Deterministic executor for the [video-cooking](https://github.com/ChHsiching/video-cooking-skill) skill pipeline. Wraps yt-dlp, whisperX, and ffmpeg into subcommands that assemble correctly every time — so the skill docs can stay short and the agent never hand-assembles a long command.
4
+
5
+ **This is the hands, not the brain.** Skills decide *what* to do, *when*, and handle creative work (translation, copywriting). cook only executes the deterministic parts and verifies the expected outputs exist.
6
+
7
+ ## Why
8
+
9
+ The video-cooking / video-download / video-subtitle skill trio started as natural-language docs that told the agent which yt-dlp / ffmpeg / whisperx commands to run. Three classes of bugs kept recurring:
10
+
11
+ 1. **Shell escaping traps** — Windows paths with `C:` break ffmpeg's `ass` filter; backslashes get eaten by PowerShell; stdout redirects silently swallow downloads.
12
+ 2. **Hand-assembly drift** — the agent forgets a flag (`--convert-thumbnails jpg`), picks the wrong template variable, renames the wrong file.
13
+ 3. **No mechanical completion check** — "the agent feels done" is not a Done criterion. Real runs shipped without `cover.jpg`, without `cloud-srt/`, with translation drift the agent couldn't see.
14
+
15
+ cook fixes all three by being the single place where the commands are assembled. The skill docs shrink to a pipeline skeleton; the completion criteria become "cook exit 0".
16
+
17
+ ## Install
18
+
19
+ **Option 1: One-liner via uv** (recommended — uv handles Python interpreter + isolated env + PATH wiring automatically, no pip/venv knowledge needed):
20
+
21
+ ```bash
22
+ # Linux / macOS
23
+ curl -LsSf https://github.com/ChHsiching/video-cook/releases/latest/download/install.sh | sh
24
+ # Windows (PowerShell)
25
+ irm https://github.com/ChHsiching/video-cook/releases/latest/download/install.ps1 | iex
26
+ ```
27
+
28
+ The installer uses [uv](https://astral.sh/uv/) to install `video-cook[all]` as an isolated tool (~2GB — pulls whisperx + torch). After install, open a new shell and run `cook doctor`.
29
+
30
+ **Option 2: pip directly**:
31
+
32
+ ```bash
33
+ pip install video-cook[all] # yt-dlp + whisperx + cook itself
34
+ # or pick what you need:
35
+ pip install video-cook[download] # for `cook download`
36
+ pip install video-cook[transcribe] # for `cook transcribe`
37
+ ```
38
+
39
+ ffmpeg and Node.js must be on PATH separately (cook can't pip-install those).
40
+
41
+ ## Subcommands
42
+
43
+ | Command | What it does | Replaces (manual steps) |
44
+ |---|---|---|
45
+ | `cook doctor` | Check environment (ffmpeg/node/yt-dlp/whisperx/torch+CUDA) | Skill's "Environment reuse" prose |
46
+ | `cook download <url>` | yt-dlp download + cookie negotiation + thumbnail rename + ffprobe verify | video-download Steps 1-3 |
47
+ | `cook extract <root> <name>` | ffmpeg 16kHz mono WAV extraction | video-subtitle Step 1 |
48
+ | `cook transcribe <root> <name>` | whisperX transcription, auto-detects CUDA, auto-detaches | video-subtitle Step 2 |
49
+ | `cook subtitles <root> <name>` | shorten → merge-short → biliteral → ASS + cloud-srt in one shot | video-subtitle Step 4 + cloud-srt |
50
+ | `cook burn <root> <name>` | ffmpeg subtitle burning, auto-detaches, subprocess list-form | video-subtitle Step 5 |
51
+ | `cook cover <root> <name>` | Place `cover.jpg` in `cooked/` (reuses raw thumbnail) | video-subtitle Step 6 cover task |
52
+ | `cook show-source <root> <name>` | Extract key fields (title/uploader/links/description) from source.json | (new — surfaces the source context for translation + upload metadata) |
53
+ | `cook verify-align <root> <name>` | DP-align `en.srt` vs `translations.txt`, catch missing/drifted translations | (new — no prior equivalent) |
54
+ | `cook verify-shipment <root> <name>` | Check the full release set exists; exit 0 = ready to ship | (new — no prior equivalent) |
55
+
56
+ Every command prints a JSON object on stdout (machine-readable; agents parse this) and human-readable progress on stderr. Exit codes are meaningful: 0 = done criterion passed, non-zero = it didn't.
57
+
58
+ ## Usage from a skill
59
+
60
+ The skill docs call cook as a subprocess and branch on its exit code. Example skeleton from video-subtitle:
61
+
62
+ ```
63
+ Step 1: cook extract <root> <name> → exit 0 = done
64
+ Step 2: cook transcribe <root> <name> → exit 0 = launched, poll log until "[transcribe] done."
65
+ Step 3: (agent translates → writes translations.txt)
66
+ cook verify-align <root> <name> → exit 0 = aligned, proceed
67
+ Step 4: cook subtitles <root> <name> --mode bottom-bar --bar-px 180
68
+ Step 5: cook burn <root> <name> --mode bottom-bar --bar-px 180
69
+ Step 6: (agent writes upload.md)
70
+ cook cover <root> <name>
71
+ Step 7: (agent writes README.md)
72
+ ```
73
+
74
+ The router (`video-cooking`) calls `cook verify-shipment` as the final gate before reporting the pipeline done.
75
+
76
+ ## Bugs that cook fixes
77
+
78
+ | Bug in the old skill docs | How cook fixes it |
79
+ |---|---|
80
+ | `--dump-json > file.json` silently swallowed downloads | cook uses `print_to_file` (yt-dlp's native JSON-to-file option) |
81
+ | Thumbnail came out as `<name>.raw.jpg` not `<name>.jpg` | cook renames it after download |
82
+ | Windows `C:` paths broke ffmpeg `ass` filter | cook uses subprocess list-form (never shell), runs from subtitle/ dir with bare filename |
83
+ | `subtitles.py split` leaked single-language cues across zh.srt/en.srt | cook copies `*.merged.srt` to cloud-srt instead of splitting bilingual.srt |
84
+ | `transcribe.py` hardcoded `device="cpu"`, float16 unusable on GPU | cook auto-detects CUDA → float16+cuda, else float32+cpu |
85
+ | `source.json` downloaded but never read by downstream — author/links/description wasted | `cook show-source` surfaces the curated fields translation and upload metadata consume |
86
+ | detached template only covered transcribe, not burn | cook's `_detach()` helper handles both uniformly |
87
+ | No mechanical way to catch translation drift | `cook verify-align` runs DP global alignment |
88
+ | No mechanical way to catch missing release-set files | `cook verify-shipment` checks every expected file |
89
+
90
+ ## Development
91
+
92
+ ```bash
93
+ git clone https://github.com/ChHsiching/video-cook
94
+ cd video-cook
95
+ pip install -e .[dev]
96
+ pytest test_cook.py -v
97
+ ```
98
+
99
+ Tests cover the subcommands whose correctness is non-obvious: `verify-align` (DP alignment edge cases), `verify-shipment` (file-presence checks), and the cloud-srt copy logic (the fix for the split leak). No network, no ffmpeg, no whisperx — all tests use temp dirs and fake files.
100
+
101
+ ## License
102
+
103
+ MIT