fito-tui 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,28 +35,59 @@ run's business — a source clone, sibling pipeline stages
35
35
  under `output/`, the URL list itself: the run neither adds
36
36
  to them nor removes them.
37
37
 
38
- Create the workspace with `mktemp -d` and carry the path it
39
- prints forward literally, in place of `<workspace>` below.
40
- Each `bash` call is a fresh shell, so a variable set in one
41
- call is empty in the next, and a `trap … EXIT` would delete
42
- the workspace on the way out of the call that created it.
38
+ Find Python first. Try the three candidates in this order
39
+ and take the first whose `--version` prints `Python 3.`
40
+ and a version number; carry that command forward
41
+ literally, in place of `<python>` below — `py -3`
42
+ included. A candidate counts by what it prints: on
43
+ Windows, `python3` can be the Microsoft Store's
44
+ placeholder, which prints no version and runs no Python.
45
+ When none prints one, stop and report that the fetch
46
+ needs Python 3.
43
47
 
44
48
  ```bash
45
- mktemp -d
49
+ python3 --version
50
+ python --version
51
+ py -3 --version
52
+ ```
53
+
54
+ Then create the workspace with `<python>` and carry the
55
+ path it prints forward literally, in place of
56
+ `<workspace>` below. Python prints it with `/`
57
+ (`C:/Users/…` on Windows), the one form that Bash, Python
58
+ and the `write` tool all read as the same folder; keep
59
+ it in double quotes in every command, since it can hold
60
+ a space. Each `bash` call is a fresh shell, so a
61
+ variable set in one call is empty in the next, and a
62
+ `trap … EXIT` would delete the workspace on the way out
63
+ of the call that created it.
64
+
65
+ The venv keeps its programs in `<workspace>/venv/Scripts/`
66
+ on Windows and in `<workspace>/venv/bin/` elsewhere:
67
+ `<bin>` below is whichever of the two
68
+ `ls "<workspace>/venv"` lists.
69
+
70
+ ```bash
71
+ <python> -c "import pathlib, tempfile; print(pathlib.Path(tempfile.mkdtemp(prefix='fito-fetch-')).as_posix())"
46
72
  # → this run's workspace; substitute what it printed for <workspace>
47
73
 
48
74
  # a PEP 668-protected box refuses a bare `pip install`;
49
75
  # add any fallback package the same way
50
- python3 -m venv <workspace>/venv
51
- <workspace>/venv/bin/pip install trafilatura youtube-transcript-api
76
+ <python> -m venv "<workspace>/venv"
77
+ # the venv's pip is the one <python> shipped, and an old one skips
78
+ # the lxml_html_clean extra that `import trafilatura` needs, so
79
+ # upgrade it first; call pip through the venv's python every time,
80
+ # since on Windows the pip program refuses to replace itself
81
+ "<workspace>/venv/<bin>/python" -m pip install --upgrade pip
82
+ "<workspace>/venv/<bin>/python" -m pip install trafilatura youtube-transcript-api
52
83
 
53
84
  # write the fetch script to <workspace>/fetch_urls.py, then run it from
54
85
  # the working directory — never `cd` into the workspace, or the script's
55
86
  # ./output/… paths move with you
56
- <workspace>/venv/bin/python <workspace>/fetch_urls.py urls.txt
87
+ "<workspace>/venv/<bin>/python" "<workspace>/fetch_urls.py" "<URL list file>"
57
88
 
58
89
  # the run's last act, before the summary — failed runs included
59
- rm -rf <workspace>
90
+ rm -rf "<workspace>"
60
91
  ```
61
92
 
62
93
  ## URL Detection
@@ -77,10 +108,12 @@ multiple languages are available, prefer manual
77
108
  captions over auto-generated ones.
78
109
 
79
110
  If no transcript is available at all, fall back to
80
- auto-generated subtitles, landing them in the workspace:
111
+ auto-generated subtitles, landing them in the workspace.
112
+ Install `yt-dlp` into the venv first:
81
113
 
82
114
  ```bash
83
- <workspace>/venv/bin/yt-dlp --write-auto-sub --skip-download -P <workspace> <url>
115
+ "<workspace>/venv/<bin>/python" -m pip install yt-dlp
116
+ "<workspace>/venv/<bin>/yt-dlp" --write-auto-sub --skip-download -P "<workspace>" "<url>"
84
117
  ```
85
118
 
86
119
  Then read and clean the resulting .vtt file there
@@ -172,10 +205,14 @@ Create the directory if it doesn't exist.
172
205
 
173
206
  ### Summary generation
174
207
 
175
- After cleaning the content, generate a summary of
176
- the actual page content in your own words. The summary
177
- must be a coherent sentence or two describing what
178
- the page is about, max 50 words. Do NOT truncate
208
+ The summary is yours, written from the page you have
209
+ read: a script has no words of its own, and a summary
210
+ written before the fetch comes from recall. So the
211
+ script writes each file with every front-matter key
212
+ but `summary`. Once the script has run, read each file
213
+ it wrote, then add its `summary` to the front matter
214
+ with `edit`: a coherent sentence or two describing
215
+ what the page is about, max 50 words. Do NOT truncate
179
216
  the content or copy its first lines — write an
180
217
  original summary.
181
218