@nitrimandylis/flick 0.1.2 โ 0.2.1
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 +8 -0
- package/dist/flick.js +253 -15
- 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,6 +60,7 @@ 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
|
|
|
@@ -64,6 +68,10 @@ man flick
|
|
|
64
68
|
|
|
65
69
|
Type a title, press enter twice, and the film is playing. The second enter is the one you will regret at 2 am.
|
|
66
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
|
+
|
|
67
75
|
### Couch on a fixed address
|
|
68
76
|
|
|
69
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) {
|
|
@@ -601,6 +614,10 @@ function parseYifyEnglish(html) {
|
|
|
601
614
|
}
|
|
602
615
|
return null;
|
|
603
616
|
}
|
|
617
|
+
function parseYifyZip(html) {
|
|
618
|
+
const link = html.match(/href="(\/subtitle\/[^"]+\.zip)"/);
|
|
619
|
+
return link ? link[1] : null;
|
|
620
|
+
}
|
|
604
621
|
async function fromYify(imdbId) {
|
|
605
622
|
const srt = join3(SUBS_DIR, `${imdbId}.srt`);
|
|
606
623
|
if (existsSync3(srt))
|
|
@@ -615,8 +632,15 @@ async function fromYify(imdbId) {
|
|
|
615
632
|
const slug = parseYifyEnglish(await page.text());
|
|
616
633
|
if (!slug)
|
|
617
634
|
return null;
|
|
618
|
-
const
|
|
619
|
-
|
|
635
|
+
const subPage = `${YIFY}/subtitles/${slug}`;
|
|
636
|
+
const detail = await fetch(subPage, { headers: { "User-Agent": UA }, signal: AbortSignal.timeout(15000) });
|
|
637
|
+
if (!detail.ok)
|
|
638
|
+
return null;
|
|
639
|
+
const zipLink = parseYifyZip(await detail.text());
|
|
640
|
+
if (!zipLink)
|
|
641
|
+
return null;
|
|
642
|
+
const zip = await fetch(`${YIFY}${zipLink}`, {
|
|
643
|
+
headers: { "User-Agent": UA, Referer: subPage },
|
|
620
644
|
signal: AbortSignal.timeout(20000)
|
|
621
645
|
});
|
|
622
646
|
if (!zip.ok)
|
|
@@ -1096,7 +1120,7 @@ class Couch {
|
|
|
1096
1120
|
touchFilm(stream.folder);
|
|
1097
1121
|
trimCache(loadConfig().cacheGB ?? 10, stream.folder);
|
|
1098
1122
|
this.room.setFilm({ id: title.id, title: title.name, year: title.year ?? undefined }, stream.urlOf(video), subs?.vtt ?? null);
|
|
1099
|
-
onStatus(`on in the room${subs ? ", English subtitles available" : ""}`);
|
|
1123
|
+
onStatus(`on in the room${subs ? ", English subtitles available" : ", no English subtitles found"}`);
|
|
1100
1124
|
}
|
|
1101
1125
|
async progress() {
|
|
1102
1126
|
return this.stream ? this.stream.progress() : null;
|
|
@@ -1839,6 +1863,92 @@ function run2(program, args) {
|
|
|
1839
1863
|
});
|
|
1840
1864
|
}
|
|
1841
1865
|
|
|
1866
|
+
// src/tonight.ts
|
|
1867
|
+
function unescapeHtml(text) {
|
|
1868
|
+
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, "&");
|
|
1869
|
+
}
|
|
1870
|
+
function parseWatchlist(html) {
|
|
1871
|
+
const films = [];
|
|
1872
|
+
for (const tag of html.match(/<[^>]*data-item-name="[^>]*>/g) ?? []) {
|
|
1873
|
+
const text = unescapeHtml(tag.match(/data-item-name="([^"]*)"/)?.[1] ?? "");
|
|
1874
|
+
const slug = tag.match(/data-item-slug="([^"]*)"/)?.[1] ?? "";
|
|
1875
|
+
if (!text || !slug)
|
|
1876
|
+
continue;
|
|
1877
|
+
const parts = text.match(/^(.*) \((\d{4})\)$/);
|
|
1878
|
+
if (parts)
|
|
1879
|
+
films.push({ name: parts[1], year: Number(parts[2]), slug });
|
|
1880
|
+
else
|
|
1881
|
+
films.push({ name: text, year: null, slug });
|
|
1882
|
+
}
|
|
1883
|
+
return films;
|
|
1884
|
+
}
|
|
1885
|
+
async function fetchWatchlist(user) {
|
|
1886
|
+
const films = [];
|
|
1887
|
+
for (let page = 1;page <= 50; page++) {
|
|
1888
|
+
let html = "";
|
|
1889
|
+
try {
|
|
1890
|
+
const res = await fetch(`https://letterboxd.com/${encodeURIComponent(user)}/watchlist/page/${page}/`, {
|
|
1891
|
+
headers: { "User-Agent": UA }
|
|
1892
|
+
});
|
|
1893
|
+
if (!res.ok)
|
|
1894
|
+
break;
|
|
1895
|
+
html = await res.text();
|
|
1896
|
+
} catch {
|
|
1897
|
+
break;
|
|
1898
|
+
}
|
|
1899
|
+
const found = parseWatchlist(html);
|
|
1900
|
+
if (!found.length)
|
|
1901
|
+
break;
|
|
1902
|
+
films.push(...found);
|
|
1903
|
+
}
|
|
1904
|
+
return films;
|
|
1905
|
+
}
|
|
1906
|
+
function parseImdbId(html) {
|
|
1907
|
+
return html.match(/imdb\.com\/title\/(tt\d+)/)?.[1] ?? null;
|
|
1908
|
+
}
|
|
1909
|
+
async function imdbIdOf(slug) {
|
|
1910
|
+
try {
|
|
1911
|
+
const res = await fetch(`https://letterboxd.com/film/${slug}/`, { headers: { "User-Agent": UA } });
|
|
1912
|
+
return res.ok ? parseImdbId(await res.text()) : null;
|
|
1913
|
+
} catch {
|
|
1914
|
+
return null;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function shuffled(list, random = Math.random) {
|
|
1918
|
+
const copy = [...list];
|
|
1919
|
+
for (let i = copy.length - 1;i > 0; i--) {
|
|
1920
|
+
const j = Math.floor(random() * (i + 1));
|
|
1921
|
+
[copy[i], copy[j]] = [copy[j], copy[i]];
|
|
1922
|
+
}
|
|
1923
|
+
return copy;
|
|
1924
|
+
}
|
|
1925
|
+
function fits(minutes, limit) {
|
|
1926
|
+
if (limit === null)
|
|
1927
|
+
return true;
|
|
1928
|
+
return minutes > 0 && minutes <= limit;
|
|
1929
|
+
}
|
|
1930
|
+
async function nextPick(queue, limit, couch) {
|
|
1931
|
+
while (queue.length) {
|
|
1932
|
+
const film = queue.shift();
|
|
1933
|
+
const id = await imdbIdOf(film.slug);
|
|
1934
|
+
if (!id)
|
|
1935
|
+
continue;
|
|
1936
|
+
const title = await titleById(id);
|
|
1937
|
+
if (!title || title.kind !== "movie" && title.kind !== "tvMovie")
|
|
1938
|
+
continue;
|
|
1939
|
+
const facts = await details(title.id);
|
|
1940
|
+
if (!fits(facts.minutes, limit))
|
|
1941
|
+
continue;
|
|
1942
|
+
const report = await findSources({ kind: "film", title });
|
|
1943
|
+
const torrents = couch ? report.torrents.filter((t) => browserPlayable(t.name)) : report.torrents;
|
|
1944
|
+
const torrent = pickBest(torrents);
|
|
1945
|
+
if (!torrent)
|
|
1946
|
+
continue;
|
|
1947
|
+
return { title, details: facts, torrent };
|
|
1948
|
+
}
|
|
1949
|
+
return null;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1842
1952
|
// src/watch.ts
|
|
1843
1953
|
async function watch(options) {
|
|
1844
1954
|
const { title, engine, onStatus } = options;
|
|
@@ -1857,7 +1967,7 @@ async function watch(options) {
|
|
|
1857
1967
|
}
|
|
1858
1968
|
touchFilm(stream.folder);
|
|
1859
1969
|
trimCache(options.cacheGB, stream.folder);
|
|
1860
|
-
onStatus(`playing in ${options.player}${subs ? ", English subtitles on" : ""}`);
|
|
1970
|
+
onStatus(`playing in ${options.player}${subs ? ", English subtitles on" : ", no English subtitles found"}`);
|
|
1861
1971
|
const playing = play(options.player, { url: stream.urlOf(video), title: options.name, subtitle: subs?.path ?? null, vtt: subs?.vtt ?? null });
|
|
1862
1972
|
const timer = setInterval(async () => options.onProgress(await stream.progress()), 2000);
|
|
1863
1973
|
const closed = playing.closed.then(async () => {
|
|
@@ -1878,13 +1988,13 @@ var SECTIONS = ["Continue", "Now showing", "Shows"];
|
|
|
1878
1988
|
function App(props) {
|
|
1879
1989
|
const { exit } = useApp();
|
|
1880
1990
|
const { rows: height, columns: width } = useWindowSize();
|
|
1881
|
-
const [splash, setSplash] = useState2(!props.initialQuery);
|
|
1991
|
+
const [splash, setSplash] = useState2(!props.initialQuery && !props.tonight);
|
|
1882
1992
|
const [query, setQuery] = useState2(props.initialQuery);
|
|
1883
1993
|
const [section, setSection] = useState2("Continue");
|
|
1884
1994
|
const [home, setHome] = useState2({ Continue: [], "Now showing": [], Shows: [] });
|
|
1885
1995
|
const [results, setResults] = useState2([]);
|
|
1886
1996
|
const [selected, setSelected] = useState2(0);
|
|
1887
|
-
const [screen, setScreen] = useState2({ kind: "browse" });
|
|
1997
|
+
const [screen, setScreen] = useState2(props.tonight ? { kind: "tonight", pick: null, loading: true, note: "reading your watchlistโฆ" } : { kind: "browse" });
|
|
1888
1998
|
const [busy, setBusy] = useState2("");
|
|
1889
1999
|
const [toast, setToast] = useState2(null);
|
|
1890
2000
|
const toastTimer = useRef(undefined);
|
|
@@ -1892,6 +2002,8 @@ function App(props) {
|
|
|
1892
2002
|
const session = useRef(null);
|
|
1893
2003
|
const searchId = useRef(0);
|
|
1894
2004
|
const sourcesId = useRef(0);
|
|
2005
|
+
const tonightId = useRef(0);
|
|
2006
|
+
const tonightQueue = useRef(null);
|
|
1895
2007
|
const moved = useRef(false);
|
|
1896
2008
|
const selectedHash = useRef("");
|
|
1897
2009
|
const uploads = useRef([]);
|
|
@@ -1952,6 +2064,33 @@ function App(props) {
|
|
|
1952
2064
|
return () => clearTimeout(timer);
|
|
1953
2065
|
}, [query]);
|
|
1954
2066
|
const rows = query.trim() ? results : home[section];
|
|
2067
|
+
async function rollTonight() {
|
|
2068
|
+
if (!props.tonight)
|
|
2069
|
+
return;
|
|
2070
|
+
const id = ++tonightId.current;
|
|
2071
|
+
const show = (change) => {
|
|
2072
|
+
if (id === tonightId.current)
|
|
2073
|
+
setScreen({ kind: "tonight", ...change });
|
|
2074
|
+
};
|
|
2075
|
+
if (!tonightQueue.current) {
|
|
2076
|
+
show({ pick: null, loading: true, note: "reading your watchlistโฆ" });
|
|
2077
|
+
tonightQueue.current = shuffled(await fetchWatchlist(props.tonight.user));
|
|
2078
|
+
if (!tonightQueue.current.length) {
|
|
2079
|
+
tonightQueue.current = null;
|
|
2080
|
+
return show({ pick: null, loading: false, note: `couldn't read a watchlist at letterboxd.com/${props.tonight.user}/watchlist` });
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
show({ pick: null, loading: true, note: "finding a film that fitsโฆ" });
|
|
2084
|
+
const pick = await nextPick(tonightQueue.current, props.tonight.minutes, Boolean(couch));
|
|
2085
|
+
if (pick)
|
|
2086
|
+
show({ pick, loading: false, note: "" });
|
|
2087
|
+
else
|
|
2088
|
+
show({ pick: null, loading: false, note: "nothing else on your watchlist fits tonight" });
|
|
2089
|
+
}
|
|
2090
|
+
useEffect2(() => {
|
|
2091
|
+
if (props.tonight)
|
|
2092
|
+
rollTonight();
|
|
2093
|
+
}, []);
|
|
1955
2094
|
async function openTitle(title) {
|
|
1956
2095
|
if (couch && isSeries(title)) {
|
|
1957
2096
|
showToast("couch plays films only", "no");
|
|
@@ -2090,6 +2229,23 @@ function App(props) {
|
|
|
2090
2229
|
}
|
|
2091
2230
|
return;
|
|
2092
2231
|
}
|
|
2232
|
+
if (screen.kind === "tonight") {
|
|
2233
|
+
const pick = screen.pick;
|
|
2234
|
+
if (key.return && pick) {
|
|
2235
|
+
tonightId.current++;
|
|
2236
|
+
return void startWatching(pick.torrent, pick.title, `${pick.title.name}${pick.title.year ? ` (${pick.title.year})` : ""}`);
|
|
2237
|
+
}
|
|
2238
|
+
if (input === "n" && !screen.loading)
|
|
2239
|
+
return void rollTonight();
|
|
2240
|
+
if (key.escape || input === "q") {
|
|
2241
|
+
tonightId.current++;
|
|
2242
|
+
setSelected(0);
|
|
2243
|
+
return setScreen({ kind: "browse" });
|
|
2244
|
+
}
|
|
2245
|
+
if (input === "?")
|
|
2246
|
+
return setShowHelp(true);
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2093
2249
|
if (screen.kind === "browse" && (key.leftArrow || key.rightArrow || key.upArrow || key.downArrow)) {
|
|
2094
2250
|
const step = key.leftArrow || key.upArrow ? -1 : 1;
|
|
2095
2251
|
return setSelected((i) => Math.max(0, Math.min(rows.length - 1, i + step)));
|
|
@@ -2248,7 +2404,7 @@ function App(props) {
|
|
|
2248
2404
|
const big = posterSize(Math.max(8, Math.min(22, height - 19)));
|
|
2249
2405
|
const small = posterSize(Math.round(big.rows * 0.6));
|
|
2250
2406
|
const stageHeight = height - 5;
|
|
2251
|
-
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"]];
|
|
2407
|
+
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"]];
|
|
2252
2408
|
let body = null;
|
|
2253
2409
|
if (showHelp) {
|
|
2254
2410
|
body = /* @__PURE__ */ jsx2(Help, {});
|
|
@@ -2263,6 +2419,16 @@ function App(props) {
|
|
|
2263
2419
|
label,
|
|
2264
2420
|
empty: query.trim() ? "Nothing found." : "Loadingโฆ"
|
|
2265
2421
|
});
|
|
2422
|
+
} else if (screen.kind === "tonight") {
|
|
2423
|
+
body = /* @__PURE__ */ jsx2(Stage, {
|
|
2424
|
+
poster: screen.pick?.title.poster ?? "",
|
|
2425
|
+
big,
|
|
2426
|
+
children: /* @__PURE__ */ jsx2(Tonight, {
|
|
2427
|
+
screen,
|
|
2428
|
+
minutes: props.tonight?.minutes ?? null,
|
|
2429
|
+
width: inner - big.cols - 3
|
|
2430
|
+
})
|
|
2431
|
+
});
|
|
2266
2432
|
} else if (screen.kind === "episodes") {
|
|
2267
2433
|
body = /* @__PURE__ */ jsx2(Stage, {
|
|
2268
2434
|
poster: screen.title.poster,
|
|
@@ -2410,6 +2576,8 @@ function App(props) {
|
|
|
2410
2576
|
}
|
|
2411
2577
|
function trail(screen, query, section) {
|
|
2412
2578
|
const from = query.trim() ? `โ ${query.trim()}` : section.toLowerCase();
|
|
2579
|
+
if (screen.kind === "tonight")
|
|
2580
|
+
return screen.pick ? ["tonight", screen.pick.title.name] : ["tonight"];
|
|
2413
2581
|
if (screen.kind === "episodes")
|
|
2414
2582
|
return [from, screen.title.name, screen.anime ? "episodes" : `season ${screen.season}`];
|
|
2415
2583
|
if (screen.kind === "sources") {
|
|
@@ -2858,6 +3026,56 @@ function About({ title, note, width }) {
|
|
|
2858
3026
|
]
|
|
2859
3027
|
});
|
|
2860
3028
|
}
|
|
3029
|
+
function Tonight({ screen, minutes, width }) {
|
|
3030
|
+
if (!screen.pick) {
|
|
3031
|
+
return /* @__PURE__ */ jsxs2(Box2, {
|
|
3032
|
+
marginTop: 1,
|
|
3033
|
+
children: [
|
|
3034
|
+
screen.loading ? /* @__PURE__ */ jsxs2(Fragment, {
|
|
3035
|
+
children: [
|
|
3036
|
+
/* @__PURE__ */ jsx2(Spinner, {}),
|
|
3037
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3038
|
+
children: " "
|
|
3039
|
+
})
|
|
3040
|
+
]
|
|
3041
|
+
}) : null,
|
|
3042
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3043
|
+
color: screen.loading ? C.mute : C.warn,
|
|
3044
|
+
children: screen.note
|
|
3045
|
+
})
|
|
3046
|
+
]
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
const { title, torrent } = screen.pick;
|
|
3050
|
+
const q = parseQuality(torrent.name);
|
|
3051
|
+
return /* @__PURE__ */ jsxs2(Box2, {
|
|
3052
|
+
flexDirection: "column",
|
|
3053
|
+
children: [
|
|
3054
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3055
|
+
color: C.bulb,
|
|
3056
|
+
children: minutes ? `from your watchlist, fits in ${minutes} min` : "from your watchlist"
|
|
3057
|
+
}),
|
|
3058
|
+
/* @__PURE__ */ jsx2(About, {
|
|
3059
|
+
title,
|
|
3060
|
+
note: "",
|
|
3061
|
+
width
|
|
3062
|
+
}),
|
|
3063
|
+
/* @__PURE__ */ jsxs2(Box2, {
|
|
3064
|
+
marginTop: 1,
|
|
3065
|
+
children: [
|
|
3066
|
+
/* @__PURE__ */ jsx2(Badge, {
|
|
3067
|
+
text: resolutionLabel(q.res),
|
|
3068
|
+
color: RES_COLOR[q.res] ?? C.mute
|
|
3069
|
+
}),
|
|
3070
|
+
/* @__PURE__ */ jsx2(Text2, {
|
|
3071
|
+
color: C.mute,
|
|
3072
|
+
children: ` ${humanSize(torrent.bytes)} ยท ${torrent.seeders} seeders ยท ${sourceTag(torrent.source)}`
|
|
3073
|
+
})
|
|
3074
|
+
]
|
|
3075
|
+
})
|
|
3076
|
+
]
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
2861
3079
|
function Stage({ poster, big, children }) {
|
|
2862
3080
|
return /* @__PURE__ */ jsxs2(Box2, {
|
|
2863
3081
|
flexShrink: 0,
|
|
@@ -3445,6 +3663,7 @@ function Help() {
|
|
|
3445
3663
|
["โ โ", "move"],
|
|
3446
3664
|
["tab", "the programme: continue, now showing, shows"],
|
|
3447
3665
|
["โ โ", "change season"],
|
|
3666
|
+
["n", "flick tonight: another film from your watchlist"],
|
|
3448
3667
|
["c", "couch: copy the room link while a film is on"],
|
|
3449
3668
|
["esc", "back, clear the search, or home"],
|
|
3450
3669
|
["paste", "a magnet link or info hash plays it straight away"],
|
|
@@ -3478,7 +3697,7 @@ function Help() {
|
|
|
3478
3697
|
|
|
3479
3698
|
// src/cli.tsx
|
|
3480
3699
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3481
|
-
var VERSION = "0.1
|
|
3700
|
+
var VERSION = "0.2.1";
|
|
3482
3701
|
var HELP = `flick ${VERSION}: search a film, pick a torrent, watch it now
|
|
3483
3702
|
|
|
3484
3703
|
usage:
|
|
@@ -3486,6 +3705,9 @@ usage:
|
|
|
3486
3705
|
flick <title> open flick already searching for <title>
|
|
3487
3706
|
flick couch [title] watch together: films play in a room in both your
|
|
3488
3707
|
browsers, in sync; flick prints the room's link
|
|
3708
|
+
flick tonight [minutes] one film from your Letterboxd watchlist that fits in
|
|
3709
|
+
<minutes> (any length if left out): enter plays it,
|
|
3710
|
+
n picks another. Also: flick couch tonight [minutes]
|
|
3489
3711
|
|
|
3490
3712
|
options:
|
|
3491
3713
|
--engine rqbit|webtorrent torrent engine (default: rqbit if installed, else webtorrent)
|
|
@@ -3495,7 +3717,8 @@ options:
|
|
|
3495
3717
|
-h, --help this help
|
|
3496
3718
|
-v, --version the version
|
|
3497
3719
|
|
|
3498
|
-
Settings live in ~/.config/flick/config.json (engine, player, cacheGB, dub
|
|
3720
|
+
Settings live in ~/.config/flick/config.json (engine, player, cacheGB, dub,
|
|
3721
|
+
and letterboxd: your Letterboxd username, for flick tonight).
|
|
3499
3722
|
couch rooms run on this computer through a free Cloudflare quick tunnel (a new
|
|
3500
3723
|
address each time). For one fixed address, create a named Cloudflare tunnel
|
|
3501
3724
|
routed to http://127.0.0.1:8765 and set tunnelToken and tunnelHost there.
|
|
@@ -3529,6 +3752,15 @@ function parseArgs(argv) {
|
|
|
3529
3752
|
args.couch = true;
|
|
3530
3753
|
words.shift();
|
|
3531
3754
|
}
|
|
3755
|
+
if (words[0] === "tonight") {
|
|
3756
|
+
args.tonight = true;
|
|
3757
|
+
words.shift();
|
|
3758
|
+
if (words.length > 1 || words.length === 1 && !/^[1-9]\d*$/.test(words[0])) {
|
|
3759
|
+
return { error: "tonight takes a number of minutes, like: flick tonight 110" };
|
|
3760
|
+
}
|
|
3761
|
+
if (words.length === 1)
|
|
3762
|
+
args.minutes = Number(words.shift());
|
|
3763
|
+
}
|
|
3532
3764
|
args.query = words.join(" ");
|
|
3533
3765
|
return args;
|
|
3534
3766
|
}
|
|
@@ -3561,6 +3793,11 @@ function main() {
|
|
|
3561
3793
|
process.exitCode = 1;
|
|
3562
3794
|
return;
|
|
3563
3795
|
}
|
|
3796
|
+
if (parsed.tonight && !config.letterboxd) {
|
|
3797
|
+
console.error('flick tonight reads your Letterboxd watchlist: add "letterboxd": "<your username>" to ~/.config/flick/config.json');
|
|
3798
|
+
process.exitCode = 1;
|
|
3799
|
+
return;
|
|
3800
|
+
}
|
|
3564
3801
|
if (!process.stdin.isTTY) {
|
|
3565
3802
|
console.error("flick needs an interactive terminal");
|
|
3566
3803
|
process.exitCode = 1;
|
|
@@ -3581,7 +3818,8 @@ function main() {
|
|
|
3581
3818
|
cacheGB: config.cacheGB ?? 10,
|
|
3582
3819
|
dub: parsed.dub || Boolean(config.dub),
|
|
3583
3820
|
initialQuery: parsed.query,
|
|
3584
|
-
couch
|
|
3821
|
+
couch,
|
|
3822
|
+
tonight: parsed.tonight && config.letterboxd ? { user: config.letterboxd, minutes: parsed.minutes ?? null } : undefined
|
|
3585
3823
|
}), { alternateScreen: true, exitOnCtrlC: false });
|
|
3586
3824
|
}
|
|
3587
3825
|
function startedDirectly() {
|
package/man/flick.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH FLICK 1 "2026-11-
|
|
1
|
+
.TH FLICK 1 "2026-11-23" "flick 0.2.1" "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