@nitrimandylis/flick 0.1.1 โ 0.2.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.
- package/README.md +10 -0
- package/dist/flick.js +244 -12
- package/man/flick.1 +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
-FF3DCB?style=flat-square&labelColor=111111)
|
|
20
20
|

|
|
21
21
|
|
|
22
|
+

|
|
23
|
+
|
|
22
24
|
</div>
|
|
23
25
|
|
|
24
26
|
---
|
|
@@ -47,6 +49,7 @@ nick@flick:~$ flick couch
|
|
|
47
49
|
| 06 | **pluggable** | engine rqbit or the built-in webtorrent, player IINA, mpv, VLC or the browser |
|
|
48
50
|
| 07 | **cache with a cap** | 10 GB by default, least recently watched goes first, nothing seeds after a film closes |
|
|
49
51
|
| 08 | **no ratings** | on purpose. you are about to watch it anyway |
|
|
52
|
+
| 09 | **tonight** | `flick tonight 110` shows one film from your Letterboxd watchlist that fits in 110 minutes. enter plays it, `n` asks for another |
|
|
50
53
|
|
|
51
54
|
## ๐ Run it
|
|
52
55
|
|
|
@@ -57,11 +60,18 @@ npx @nitrimandylis/flick # run once, nothing installed
|
|
|
57
60
|
npm i -g @nitrimandylis/flick # or: bun add -g @nitrimandylis/flick
|
|
58
61
|
flick
|
|
59
62
|
flick couch
|
|
63
|
+
flick tonight 110 # one film from your Letterboxd watchlist, 110 minutes or less
|
|
60
64
|
man flick
|
|
61
65
|
```
|
|
62
66
|
|
|
67
|
+
`bun add -g` skips install scripts, so the built-in engine's native parts are missing there: that is fine with rqbit installed, otherwise run `bun pm -g trust --all` once.
|
|
68
|
+
|
|
63
69
|
Type a title, press enter twice, and the film is playing. The second enter is the one you will regret at 2 am.
|
|
64
70
|
|
|
71
|
+
### Tonight
|
|
72
|
+
|
|
73
|
+
`flick tonight` is for the evenings when choosing takes longer than the film. Put your Letterboxd username in `~/.config/flick/config.json` as `letterboxd` (the watchlist has to be public), then `flick tonight` shows one film from it, with a source already picked. `flick tonight 110` keeps to films of 110 minutes or less, and `flick couch tonight` does the same for a room. Films that are not out yet, or that have no 1080p source to just play, are passed over.
|
|
74
|
+
|
|
65
75
|
### Couch on a fixed address
|
|
66
76
|
|
|
67
77
|
A room gets a new random `trycloudflare.com` address each run. For one that never changes (a bookmark the other person keeps), create a named Cloudflare tunnel routed to `http://127.0.0.1:8765` and put its token and hostname in `~/.config/flick/config.json` as `tunnelToken` and `tunnelHost`. The token is a secret, so it lives only in that file.
|
package/dist/flick.js
CHANGED
|
@@ -68,19 +68,32 @@ async function graphql(query) {
|
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return
|
|
71
|
+
var TITLE_FIELDS = "id titleText { text } releaseYear { year } titleType { id } primaryImage { url }";
|
|
72
|
+
function titleFrom(t) {
|
|
73
|
+
return {
|
|
74
74
|
id: t.id,
|
|
75
75
|
name: t.titleText?.text ?? "",
|
|
76
76
|
year: t.releaseYear?.year ?? null,
|
|
77
77
|
kind: t.titleType?.id ?? "",
|
|
78
78
|
poster: t.primaryImage?.url ?? "",
|
|
79
79
|
cast: ""
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function parseTrending(json) {
|
|
83
|
+
const edges = json?.data?.advancedTitleSearch?.edges ?? [];
|
|
84
|
+
return edges.map((e) => e.node?.title).filter((t) => typeof t?.id === "string" && t.id.startsWith("tt")).map(titleFrom);
|
|
85
|
+
}
|
|
86
|
+
function parseTitle(json) {
|
|
87
|
+
const t = json?.data?.title;
|
|
88
|
+
return typeof t?.id === "string" && t.id.startsWith("tt") ? titleFrom(t) : null;
|
|
89
|
+
}
|
|
90
|
+
async function titleById(id) {
|
|
91
|
+
if (!/^tt\d+$/.test(id))
|
|
92
|
+
return null;
|
|
93
|
+
return parseTitle(await graphql(`query { title(id: "${id}") { ${TITLE_FIELDS} } }`));
|
|
81
94
|
}
|
|
82
95
|
async function trending(kind) {
|
|
83
|
-
const json = await graphql(`query { advancedTitleSearch(first: 20, sort: {sortBy: POPULARITY, sortOrder: ASC}, constraints: {titleTypeConstraint: {anyTitleTypeIds: ["${kind}"]}}) { edges { node { title {
|
|
96
|
+
const json = await graphql(`query { advancedTitleSearch(first: 20, sort: {sortBy: POPULARITY, sortOrder: ASC}, constraints: {titleTypeConstraint: {anyTitleTypeIds: ["${kind}"]}}) { edges { node { title { ${TITLE_FIELDS} } } } } }`);
|
|
84
97
|
return parseTrending(json);
|
|
85
98
|
}
|
|
86
99
|
function parseDetails(json) {
|
|
@@ -1119,7 +1132,6 @@ class Couch {
|
|
|
1119
1132
|
// src/engines.ts
|
|
1120
1133
|
import { spawn as spawn3, spawnSync as spawnSync2 } from "node:child_process";
|
|
1121
1134
|
import { mkdirSync as mkdirSync4 } from "node:fs";
|
|
1122
|
-
import WebTorrent from "webtorrent";
|
|
1123
1135
|
var VIDEO = /\.(mkv|mp4|avi|webm|mov|m4v|ts)$/i;
|
|
1124
1136
|
var SUBTITLE = /\.(srt|vtt|ass|ssa)$/i;
|
|
1125
1137
|
function pickVideos(files) {
|
|
@@ -1211,6 +1223,12 @@ class Webtorrent {
|
|
|
1211
1223
|
async ensure() {
|
|
1212
1224
|
if (this.client)
|
|
1213
1225
|
return;
|
|
1226
|
+
let WebTorrent;
|
|
1227
|
+
try {
|
|
1228
|
+
WebTorrent = (await import("webtorrent")).default;
|
|
1229
|
+
} catch {
|
|
1230
|
+
throw new Error("the built-in engine's native parts aren't installed. Install rqbit (brew install rqbit), or reinstall flick with npm, or run: bun pm -g trust --all");
|
|
1231
|
+
}
|
|
1214
1232
|
this.client = new WebTorrent;
|
|
1215
1233
|
const server = this.client.createServer({ hostname: "127.0.0.1" });
|
|
1216
1234
|
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
@@ -1834,6 +1852,92 @@ function run2(program, args) {
|
|
|
1834
1852
|
});
|
|
1835
1853
|
}
|
|
1836
1854
|
|
|
1855
|
+
// src/tonight.ts
|
|
1856
|
+
function unescapeHtml(text) {
|
|
1857
|
+
return text.replace(/&#(\d+);/g, (_, code) => String.fromCodePoint(Number(code))).replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCodePoint(parseInt(code, 16))).replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1858
|
+
}
|
|
1859
|
+
function parseWatchlist(html) {
|
|
1860
|
+
const films = [];
|
|
1861
|
+
for (const tag of html.match(/<[^>]*data-item-name="[^>]*>/g) ?? []) {
|
|
1862
|
+
const text = unescapeHtml(tag.match(/data-item-name="([^"]*)"/)?.[1] ?? "");
|
|
1863
|
+
const slug = tag.match(/data-item-slug="([^"]*)"/)?.[1] ?? "";
|
|
1864
|
+
if (!text || !slug)
|
|
1865
|
+
continue;
|
|
1866
|
+
const parts = text.match(/^(.*) \((\d{4})\)$/);
|
|
1867
|
+
if (parts)
|
|
1868
|
+
films.push({ name: parts[1], year: Number(parts[2]), slug });
|
|
1869
|
+
else
|
|
1870
|
+
films.push({ name: text, year: null, slug });
|
|
1871
|
+
}
|
|
1872
|
+
return films;
|
|
1873
|
+
}
|
|
1874
|
+
async function fetchWatchlist(user) {
|
|
1875
|
+
const films = [];
|
|
1876
|
+
for (let page = 1;page <= 50; page++) {
|
|
1877
|
+
let html = "";
|
|
1878
|
+
try {
|
|
1879
|
+
const res = await fetch(`https://letterboxd.com/${encodeURIComponent(user)}/watchlist/page/${page}/`, {
|
|
1880
|
+
headers: { "User-Agent": UA }
|
|
1881
|
+
});
|
|
1882
|
+
if (!res.ok)
|
|
1883
|
+
break;
|
|
1884
|
+
html = await res.text();
|
|
1885
|
+
} catch {
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
const found = parseWatchlist(html);
|
|
1889
|
+
if (!found.length)
|
|
1890
|
+
break;
|
|
1891
|
+
films.push(...found);
|
|
1892
|
+
}
|
|
1893
|
+
return films;
|
|
1894
|
+
}
|
|
1895
|
+
function parseImdbId(html) {
|
|
1896
|
+
return html.match(/imdb\.com\/title\/(tt\d+)/)?.[1] ?? null;
|
|
1897
|
+
}
|
|
1898
|
+
async function imdbIdOf(slug) {
|
|
1899
|
+
try {
|
|
1900
|
+
const res = await fetch(`https://letterboxd.com/film/${slug}/`, { headers: { "User-Agent": UA } });
|
|
1901
|
+
return res.ok ? parseImdbId(await res.text()) : null;
|
|
1902
|
+
} catch {
|
|
1903
|
+
return null;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
function shuffled(list, random = Math.random) {
|
|
1907
|
+
const copy = [...list];
|
|
1908
|
+
for (let i = copy.length - 1;i > 0; i--) {
|
|
1909
|
+
const j = Math.floor(random() * (i + 1));
|
|
1910
|
+
[copy[i], copy[j]] = [copy[j], copy[i]];
|
|
1911
|
+
}
|
|
1912
|
+
return copy;
|
|
1913
|
+
}
|
|
1914
|
+
function fits(minutes, limit) {
|
|
1915
|
+
if (limit === null)
|
|
1916
|
+
return true;
|
|
1917
|
+
return minutes > 0 && minutes <= limit;
|
|
1918
|
+
}
|
|
1919
|
+
async function nextPick(queue, limit, couch) {
|
|
1920
|
+
while (queue.length) {
|
|
1921
|
+
const film = queue.shift();
|
|
1922
|
+
const id = await imdbIdOf(film.slug);
|
|
1923
|
+
if (!id)
|
|
1924
|
+
continue;
|
|
1925
|
+
const title = await titleById(id);
|
|
1926
|
+
if (!title || title.kind !== "movie" && title.kind !== "tvMovie")
|
|
1927
|
+
continue;
|
|
1928
|
+
const facts = await details(title.id);
|
|
1929
|
+
if (!fits(facts.minutes, limit))
|
|
1930
|
+
continue;
|
|
1931
|
+
const report = await findSources({ kind: "film", title });
|
|
1932
|
+
const torrents = couch ? report.torrents.filter((t) => browserPlayable(t.name)) : report.torrents;
|
|
1933
|
+
const torrent = pickBest(torrents);
|
|
1934
|
+
if (!torrent)
|
|
1935
|
+
continue;
|
|
1936
|
+
return { title, details: facts, torrent };
|
|
1937
|
+
}
|
|
1938
|
+
return null;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1837
1941
|
// src/watch.ts
|
|
1838
1942
|
async function watch(options) {
|
|
1839
1943
|
const { title, engine, onStatus } = options;
|
|
@@ -1873,13 +1977,13 @@ var SECTIONS = ["Continue", "Now showing", "Shows"];
|
|
|
1873
1977
|
function App(props) {
|
|
1874
1978
|
const { exit } = useApp();
|
|
1875
1979
|
const { rows: height, columns: width } = useWindowSize();
|
|
1876
|
-
const [splash, setSplash] = useState2(!props.initialQuery);
|
|
1980
|
+
const [splash, setSplash] = useState2(!props.initialQuery && !props.tonight);
|
|
1877
1981
|
const [query, setQuery] = useState2(props.initialQuery);
|
|
1878
1982
|
const [section, setSection] = useState2("Continue");
|
|
1879
1983
|
const [home, setHome] = useState2({ Continue: [], "Now showing": [], Shows: [] });
|
|
1880
1984
|
const [results, setResults] = useState2([]);
|
|
1881
1985
|
const [selected, setSelected] = useState2(0);
|
|
1882
|
-
const [screen, setScreen] = useState2({ kind: "browse" });
|
|
1986
|
+
const [screen, setScreen] = useState2(props.tonight ? { kind: "tonight", pick: null, loading: true, note: "reading your watchlistโฆ" } : { kind: "browse" });
|
|
1883
1987
|
const [busy, setBusy] = useState2("");
|
|
1884
1988
|
const [toast, setToast] = useState2(null);
|
|
1885
1989
|
const toastTimer = useRef(undefined);
|
|
@@ -1887,6 +1991,8 @@ function App(props) {
|
|
|
1887
1991
|
const session = useRef(null);
|
|
1888
1992
|
const searchId = useRef(0);
|
|
1889
1993
|
const sourcesId = useRef(0);
|
|
1994
|
+
const tonightId = useRef(0);
|
|
1995
|
+
const tonightQueue = useRef(null);
|
|
1890
1996
|
const moved = useRef(false);
|
|
1891
1997
|
const selectedHash = useRef("");
|
|
1892
1998
|
const uploads = useRef([]);
|
|
@@ -1947,6 +2053,33 @@ function App(props) {
|
|
|
1947
2053
|
return () => clearTimeout(timer);
|
|
1948
2054
|
}, [query]);
|
|
1949
2055
|
const rows = query.trim() ? results : home[section];
|
|
2056
|
+
async function rollTonight() {
|
|
2057
|
+
if (!props.tonight)
|
|
2058
|
+
return;
|
|
2059
|
+
const id = ++tonightId.current;
|
|
2060
|
+
const show = (change) => {
|
|
2061
|
+
if (id === tonightId.current)
|
|
2062
|
+
setScreen({ kind: "tonight", ...change });
|
|
2063
|
+
};
|
|
2064
|
+
if (!tonightQueue.current) {
|
|
2065
|
+
show({ pick: null, loading: true, note: "reading your watchlistโฆ" });
|
|
2066
|
+
tonightQueue.current = shuffled(await fetchWatchlist(props.tonight.user));
|
|
2067
|
+
if (!tonightQueue.current.length) {
|
|
2068
|
+
tonightQueue.current = null;
|
|
2069
|
+
return show({ pick: null, loading: false, note: `couldn't read a watchlist at letterboxd.com/${props.tonight.user}/watchlist` });
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
show({ pick: null, loading: true, note: "finding a film that fitsโฆ" });
|
|
2073
|
+
const pick = await nextPick(tonightQueue.current, props.tonight.minutes, Boolean(couch));
|
|
2074
|
+
if (pick)
|
|
2075
|
+
show({ pick, loading: false, note: "" });
|
|
2076
|
+
else
|
|
2077
|
+
show({ pick: null, loading: false, note: "nothing else on your watchlist fits tonight" });
|
|
2078
|
+
}
|
|
2079
|
+
useEffect2(() => {
|
|
2080
|
+
if (props.tonight)
|
|
2081
|
+
rollTonight();
|
|
2082
|
+
}, []);
|
|
1950
2083
|
async function openTitle(title) {
|
|
1951
2084
|
if (couch && isSeries(title)) {
|
|
1952
2085
|
showToast("couch plays films only", "no");
|
|
@@ -2085,6 +2218,23 @@ function App(props) {
|
|
|
2085
2218
|
}
|
|
2086
2219
|
return;
|
|
2087
2220
|
}
|
|
2221
|
+
if (screen.kind === "tonight") {
|
|
2222
|
+
const pick = screen.pick;
|
|
2223
|
+
if (key.return && pick) {
|
|
2224
|
+
tonightId.current++;
|
|
2225
|
+
return void startWatching(pick.torrent, pick.title, `${pick.title.name}${pick.title.year ? ` (${pick.title.year})` : ""}`);
|
|
2226
|
+
}
|
|
2227
|
+
if (input === "n" && !screen.loading)
|
|
2228
|
+
return void rollTonight();
|
|
2229
|
+
if (key.escape || input === "q") {
|
|
2230
|
+
tonightId.current++;
|
|
2231
|
+
setSelected(0);
|
|
2232
|
+
return setScreen({ kind: "browse" });
|
|
2233
|
+
}
|
|
2234
|
+
if (input === "?")
|
|
2235
|
+
return setShowHelp(true);
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2088
2238
|
if (screen.kind === "browse" && (key.leftArrow || key.rightArrow || key.upArrow || key.downArrow)) {
|
|
2089
2239
|
const step = key.leftArrow || key.upArrow ? -1 : 1;
|
|
2090
2240
|
return setSelected((i) => Math.max(0, Math.min(rows.length - 1, i + step)));
|
|
@@ -2243,7 +2393,7 @@ function App(props) {
|
|
|
2243
2393
|
const big = posterSize(Math.max(8, Math.min(22, height - 19)));
|
|
2244
2394
|
const small = posterSize(Math.round(big.rows * 0.6));
|
|
2245
2395
|
const stageHeight = height - 5;
|
|
2246
|
-
const hints = screen.kind === "browse" ? [["โโ", "browse"], ["โ", "sources"], ["tab", "section"], ["type", "search"], ["esc", query ? "clear" : "home"]] : screen.kind === "episodes" ? [["โโ", "episode"], ["โโ", "season"], ["โ", "sources"], ["esc", "back"]] : screen.kind === "sources" ? [["โโ", "move"], ["โ", couch ? "put it on in the room" : "play"], ["esc", "back"]] : couch ? [["c", "copy the room link"], ["esc", "take the film off"]] : [["esc", "stop"]];
|
|
2396
|
+
const hints = screen.kind === "browse" ? [["โโ", "browse"], ["โ", "sources"], ["tab", "section"], ["type", "search"], ["esc", query ? "clear" : "home"]] : screen.kind === "tonight" ? [["โ", couch ? "put it on in the room" : "play"], ["n", "another"], ["esc", "browse"]] : screen.kind === "episodes" ? [["โโ", "episode"], ["โโ", "season"], ["โ", "sources"], ["esc", "back"]] : screen.kind === "sources" ? [["โโ", "move"], ["โ", couch ? "put it on in the room" : "play"], ["esc", "back"]] : couch ? [["c", "copy the room link"], ["esc", "take the film off"]] : [["esc", "stop"]];
|
|
2247
2397
|
let body = null;
|
|
2248
2398
|
if (showHelp) {
|
|
2249
2399
|
body = /* @__PURE__ */ jsx2(Help, {});
|
|
@@ -2258,6 +2408,16 @@ function App(props) {
|
|
|
2258
2408
|
label,
|
|
2259
2409
|
empty: query.trim() ? "Nothing found." : "Loadingโฆ"
|
|
2260
2410
|
});
|
|
2411
|
+
} else if (screen.kind === "tonight") {
|
|
2412
|
+
body = /* @__PURE__ */ jsx2(Stage, {
|
|
2413
|
+
poster: screen.pick?.title.poster ?? "",
|
|
2414
|
+
big,
|
|
2415
|
+
children: /* @__PURE__ */ jsx2(Tonight, {
|
|
2416
|
+
screen,
|
|
2417
|
+
minutes: props.tonight?.minutes ?? null,
|
|
2418
|
+
width: inner - big.cols - 3
|
|
2419
|
+
})
|
|
2420
|
+
});
|
|
2261
2421
|
} else if (screen.kind === "episodes") {
|
|
2262
2422
|
body = /* @__PURE__ */ jsx2(Stage, {
|
|
2263
2423
|
poster: screen.title.poster,
|
|
@@ -2405,6 +2565,8 @@ function App(props) {
|
|
|
2405
2565
|
}
|
|
2406
2566
|
function trail(screen, query, section) {
|
|
2407
2567
|
const from = query.trim() ? `โ ${query.trim()}` : section.toLowerCase();
|
|
2568
|
+
if (screen.kind === "tonight")
|
|
2569
|
+
return screen.pick ? ["tonight", screen.pick.title.name] : ["tonight"];
|
|
2408
2570
|
if (screen.kind === "episodes")
|
|
2409
2571
|
return [from, screen.title.name, screen.anime ? "episodes" : `season ${screen.season}`];
|
|
2410
2572
|
if (screen.kind === "sources") {
|
|
@@ -2853,6 +3015,56 @@ function About({ title, note, width }) {
|
|
|
2853
3015
|
]
|
|
2854
3016
|
});
|
|
2855
3017
|
}
|
|
3018
|
+
function Tonight({ screen, minutes, width }) {
|
|
3019
|
+
if (!screen.pick) {
|
|
3020
|
+
return /* @__PURE__ */ jsxs2(Box2, {
|
|
3021
|
+
marginTop: 1,
|
|
3022
|
+
children: [
|
|
3023
|
+
screen.loading ? /* @__PURE__ */ jsxs2(Fragment, {
|
|
3024
|
+
children: [
|
|
3025
|
+
/* @__PURE__ */ jsx2(Spinner, {}),
|
|
3026
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3027
|
+
children: " "
|
|
3028
|
+
})
|
|
3029
|
+
]
|
|
3030
|
+
}) : null,
|
|
3031
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3032
|
+
color: screen.loading ? C.mute : C.warn,
|
|
3033
|
+
children: screen.note
|
|
3034
|
+
})
|
|
3035
|
+
]
|
|
3036
|
+
});
|
|
3037
|
+
}
|
|
3038
|
+
const { title, torrent } = screen.pick;
|
|
3039
|
+
const q = parseQuality(torrent.name);
|
|
3040
|
+
return /* @__PURE__ */ jsxs2(Box2, {
|
|
3041
|
+
flexDirection: "column",
|
|
3042
|
+
children: [
|
|
3043
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3044
|
+
color: C.bulb,
|
|
3045
|
+
children: minutes ? `from your watchlist, fits in ${minutes} min` : "from your watchlist"
|
|
3046
|
+
}),
|
|
3047
|
+
/* @__PURE__ */ jsx2(About, {
|
|
3048
|
+
title,
|
|
3049
|
+
note: "",
|
|
3050
|
+
width
|
|
3051
|
+
}),
|
|
3052
|
+
/* @__PURE__ */ jsxs2(Box2, {
|
|
3053
|
+
marginTop: 1,
|
|
3054
|
+
children: [
|
|
3055
|
+
/* @__PURE__ */ jsx2(Badge, {
|
|
3056
|
+
text: resolutionLabel(q.res),
|
|
3057
|
+
color: RES_COLOR[q.res] ?? C.mute
|
|
3058
|
+
}),
|
|
3059
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3060
|
+
color: C.mute,
|
|
3061
|
+
children: ` ${humanSize(torrent.bytes)} ยท ${torrent.seeders} seeders ยท ${sourceTag(torrent.source)}`
|
|
3062
|
+
})
|
|
3063
|
+
]
|
|
3064
|
+
})
|
|
3065
|
+
]
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
2856
3068
|
function Stage({ poster, big, children }) {
|
|
2857
3069
|
return /* @__PURE__ */ jsxs2(Box2, {
|
|
2858
3070
|
flexShrink: 0,
|
|
@@ -3440,6 +3652,7 @@ function Help() {
|
|
|
3440
3652
|
["โ โ", "move"],
|
|
3441
3653
|
["tab", "the programme: continue, now showing, shows"],
|
|
3442
3654
|
["โ โ", "change season"],
|
|
3655
|
+
["n", "flick tonight: another film from your watchlist"],
|
|
3443
3656
|
["c", "couch: copy the room link while a film is on"],
|
|
3444
3657
|
["esc", "back, clear the search, or home"],
|
|
3445
3658
|
["paste", "a magnet link or info hash plays it straight away"],
|
|
@@ -3473,7 +3686,7 @@ function Help() {
|
|
|
3473
3686
|
|
|
3474
3687
|
// src/cli.tsx
|
|
3475
3688
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3476
|
-
var VERSION = "0.
|
|
3689
|
+
var VERSION = "0.2.0";
|
|
3477
3690
|
var HELP = `flick ${VERSION}: search a film, pick a torrent, watch it now
|
|
3478
3691
|
|
|
3479
3692
|
usage:
|
|
@@ -3481,6 +3694,9 @@ usage:
|
|
|
3481
3694
|
flick <title> open flick already searching for <title>
|
|
3482
3695
|
flick couch [title] watch together: films play in a room in both your
|
|
3483
3696
|
browsers, in sync; flick prints the room's link
|
|
3697
|
+
flick tonight [minutes] one film from your Letterboxd watchlist that fits in
|
|
3698
|
+
<minutes> (any length if left out): enter plays it,
|
|
3699
|
+
n picks another. Also: flick couch tonight [minutes]
|
|
3484
3700
|
|
|
3485
3701
|
options:
|
|
3486
3702
|
--engine rqbit|webtorrent torrent engine (default: rqbit if installed, else webtorrent)
|
|
@@ -3490,7 +3706,8 @@ options:
|
|
|
3490
3706
|
-h, --help this help
|
|
3491
3707
|
-v, --version the version
|
|
3492
3708
|
|
|
3493
|
-
Settings live in ~/.config/flick/config.json (engine, player, cacheGB, dub
|
|
3709
|
+
Settings live in ~/.config/flick/config.json (engine, player, cacheGB, dub,
|
|
3710
|
+
and letterboxd: your Letterboxd username, for flick tonight).
|
|
3494
3711
|
couch rooms run on this computer through a free Cloudflare quick tunnel (a new
|
|
3495
3712
|
address each time). For one fixed address, create a named Cloudflare tunnel
|
|
3496
3713
|
routed to http://127.0.0.1:8765 and set tunnelToken and tunnelHost there.
|
|
@@ -3524,6 +3741,15 @@ function parseArgs(argv) {
|
|
|
3524
3741
|
args.couch = true;
|
|
3525
3742
|
words.shift();
|
|
3526
3743
|
}
|
|
3744
|
+
if (words[0] === "tonight") {
|
|
3745
|
+
args.tonight = true;
|
|
3746
|
+
words.shift();
|
|
3747
|
+
if (words.length > 1 || words.length === 1 && !/^[1-9]\d*$/.test(words[0])) {
|
|
3748
|
+
return { error: "tonight takes a number of minutes, like: flick tonight 110" };
|
|
3749
|
+
}
|
|
3750
|
+
if (words.length === 1)
|
|
3751
|
+
args.minutes = Number(words.shift());
|
|
3752
|
+
}
|
|
3527
3753
|
args.query = words.join(" ");
|
|
3528
3754
|
return args;
|
|
3529
3755
|
}
|
|
@@ -3556,6 +3782,11 @@ function main() {
|
|
|
3556
3782
|
process.exitCode = 1;
|
|
3557
3783
|
return;
|
|
3558
3784
|
}
|
|
3785
|
+
if (parsed.tonight && !config.letterboxd) {
|
|
3786
|
+
console.error('flick tonight reads your Letterboxd watchlist: add "letterboxd": "<your username>" to ~/.config/flick/config.json');
|
|
3787
|
+
process.exitCode = 1;
|
|
3788
|
+
return;
|
|
3789
|
+
}
|
|
3559
3790
|
if (!process.stdin.isTTY) {
|
|
3560
3791
|
console.error("flick needs an interactive terminal");
|
|
3561
3792
|
process.exitCode = 1;
|
|
@@ -3576,7 +3807,8 @@ function main() {
|
|
|
3576
3807
|
cacheGB: config.cacheGB ?? 10,
|
|
3577
3808
|
dub: parsed.dub || Boolean(config.dub),
|
|
3578
3809
|
initialQuery: parsed.query,
|
|
3579
|
-
couch
|
|
3810
|
+
couch,
|
|
3811
|
+
tonight: parsed.tonight && config.letterboxd ? { user: config.letterboxd, minutes: parsed.minutes ?? null } : undefined
|
|
3580
3812
|
}), { alternateScreen: true, exitOnCtrlC: false });
|
|
3581
3813
|
}
|
|
3582
3814
|
function startedDirectly() {
|
package/man/flick.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH FLICK 1 "2026-11-
|
|
1
|
+
.TH FLICK 1 "2026-11-17" "flick 0.2.0" "User Commands"
|
|
2
2
|
.SH NAME
|
|
3
3
|
flick \- search a film or a show, pick a torrent, watch it now
|
|
4
4
|
.SH SYNOPSIS
|
|
@@ -9,6 +9,11 @@ flick \- search a film or a show, pick a torrent, watch it now
|
|
|
9
9
|
.B flick couch
|
|
10
10
|
[\fItitle\fR]
|
|
11
11
|
[\fIoptions\fR]
|
|
12
|
+
.br
|
|
13
|
+
.B flick
|
|
14
|
+
[\fBcouch\fR]
|
|
15
|
+
.B tonight
|
|
16
|
+
[\fIminutes\fR]
|
|
12
17
|
.SH DESCRIPTION
|
|
13
18
|
.B flick
|
|
14
19
|
is a full\-screen terminal UI. It opens on a splash, then a wall of posters:
|
|
@@ -37,6 +42,15 @@ pause and seek sync, and the film itself from this computer through a
|
|
|
37
42
|
Cloudflare tunnel, and prints the room's link. The other person opens the link
|
|
38
43
|
in a desktop browser; nothing to install. Only files every browser plays (MP4
|
|
39
44
|
with H.264) are offered. Couch plays films, not shows.
|
|
45
|
+
.TP
|
|
46
|
+
.B flick tonight \fR[\fIminutes\fR]
|
|
47
|
+
Show one film from your public Letterboxd watchlist, chosen at random, with a
|
|
48
|
+
source already picked. Enter plays it; \fBn\fR shows another. With
|
|
49
|
+
\fIminutes\fR, only films that long or shorter are offered. Films that are
|
|
50
|
+
not out yet, or have no source flick would pick, are passed over. Needs
|
|
51
|
+
\fBletterboxd\fR (your username) in \fI~/.config/flick/config.json\fR.
|
|
52
|
+
.B flick couch tonight
|
|
53
|
+
does the same for a room.
|
|
40
54
|
.SH OPTIONS
|
|
41
55
|
.TP
|
|
42
56
|
.BI \-\-engine " rqbit\fR|\fPwebtorrent"
|
|
@@ -71,6 +85,8 @@ Switch section: continue, now showing, shows.
|
|
|
71
85
|
.B enter
|
|
72
86
|
Open a title, an episode, or play a source.
|
|
73
87
|
.TP
|
|
88
|
+
.B n
|
|
89
|
+
flick tonight: show another film from the watchlist.
|
|
74
90
|
.B c
|
|
75
91
|
Couch: copy the room link while a film is on.
|
|
76
92
|
.TP
|
package/package.json
CHANGED