@nitrimandylis/flick 0.2.0 → 0.2.2
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 +1 -1
- package/dist/flick.js +19 -7
- package/man/flick.1 +1 -1
- package/package.json +1 -1
- package/room/art/couch.webp +0 -0
- package/room/art/lobby.webp +0 -0
- package/room/art/projector.webp +0 -0
- package/room/room.js +10 -1
- package/room/style.css +20 -0
package/README.md
CHANGED
|
@@ -116,6 +116,6 @@ flick's list of torrent sources follows the one curated by [torlink](https://git
|
|
|
116
116
|
|
|
117
117
|
`THE FILM STARTS WHEN YOU DO`
|
|
118
118
|
|
|
119
|
-
MIT licensed.
|
|
119
|
+
MIT licensed. The room art (`room/art/`) was generated with FLUX 3 Image Klein under the FLUX Kommunity licence.
|
|
120
120
|
|
|
121
121
|
</div>
|
package/dist/flick.js
CHANGED
|
@@ -308,7 +308,8 @@ var TYPES = {
|
|
|
308
308
|
".js": "text/javascript; charset=utf-8",
|
|
309
309
|
".css": "text/css; charset=utf-8",
|
|
310
310
|
".svg": "image/svg+xml",
|
|
311
|
-
".woff2": "font/woff2"
|
|
311
|
+
".woff2": "font/woff2",
|
|
312
|
+
".webp": "image/webp"
|
|
312
313
|
};
|
|
313
314
|
function emptyState() {
|
|
314
315
|
return { film: null, src: null, playing: false, time: 0, at: 0, ended: false, ratings: {}, last: null };
|
|
@@ -547,7 +548,7 @@ class Room {
|
|
|
547
548
|
res.writeHead(200, { "content-type": "application/json" });
|
|
548
549
|
return res.end(JSON.stringify(await filmDetails(details[1])));
|
|
549
550
|
}
|
|
550
|
-
if (/^\/(style\.css|room\.js|favicon\.svg|fonts\/[a-z0-9-]+\.woff2)$/.test(path))
|
|
551
|
+
if (/^\/(style\.css|room\.js|favicon\.svg|fonts\/[a-z0-9-]+\.woff2|art\/[a-z]+\.webp)$/.test(path))
|
|
551
552
|
return this.file(res, path.slice(1));
|
|
552
553
|
} catch {
|
|
553
554
|
if (!res.headersSent)
|
|
@@ -614,6 +615,10 @@ function parseYifyEnglish(html) {
|
|
|
614
615
|
}
|
|
615
616
|
return null;
|
|
616
617
|
}
|
|
618
|
+
function parseYifyZip(html) {
|
|
619
|
+
const link = html.match(/href="(\/subtitle\/[^"]+\.zip)"/);
|
|
620
|
+
return link ? link[1] : null;
|
|
621
|
+
}
|
|
617
622
|
async function fromYify(imdbId) {
|
|
618
623
|
const srt = join3(SUBS_DIR, `${imdbId}.srt`);
|
|
619
624
|
if (existsSync3(srt))
|
|
@@ -628,8 +633,15 @@ async function fromYify(imdbId) {
|
|
|
628
633
|
const slug = parseYifyEnglish(await page.text());
|
|
629
634
|
if (!slug)
|
|
630
635
|
return null;
|
|
631
|
-
const
|
|
632
|
-
|
|
636
|
+
const subPage = `${YIFY}/subtitles/${slug}`;
|
|
637
|
+
const detail = await fetch(subPage, { headers: { "User-Agent": UA }, signal: AbortSignal.timeout(15000) });
|
|
638
|
+
if (!detail.ok)
|
|
639
|
+
return null;
|
|
640
|
+
const zipLink = parseYifyZip(await detail.text());
|
|
641
|
+
if (!zipLink)
|
|
642
|
+
return null;
|
|
643
|
+
const zip = await fetch(`${YIFY}${zipLink}`, {
|
|
644
|
+
headers: { "User-Agent": UA, Referer: subPage },
|
|
633
645
|
signal: AbortSignal.timeout(20000)
|
|
634
646
|
});
|
|
635
647
|
if (!zip.ok)
|
|
@@ -1109,7 +1121,7 @@ class Couch {
|
|
|
1109
1121
|
touchFilm(stream.folder);
|
|
1110
1122
|
trimCache(loadConfig().cacheGB ?? 10, stream.folder);
|
|
1111
1123
|
this.room.setFilm({ id: title.id, title: title.name, year: title.year ?? undefined }, stream.urlOf(video), subs?.vtt ?? null);
|
|
1112
|
-
onStatus(`on in the room${subs ? ", English subtitles available" : ""}`);
|
|
1124
|
+
onStatus(`on in the room${subs ? ", English subtitles available" : ", no English subtitles found"}`);
|
|
1113
1125
|
}
|
|
1114
1126
|
async progress() {
|
|
1115
1127
|
return this.stream ? this.stream.progress() : null;
|
|
@@ -1956,7 +1968,7 @@ async function watch(options) {
|
|
|
1956
1968
|
}
|
|
1957
1969
|
touchFilm(stream.folder);
|
|
1958
1970
|
trimCache(options.cacheGB, stream.folder);
|
|
1959
|
-
onStatus(`playing in ${options.player}${subs ? ", English subtitles on" : ""}`);
|
|
1971
|
+
onStatus(`playing in ${options.player}${subs ? ", English subtitles on" : ", no English subtitles found"}`);
|
|
1960
1972
|
const playing = play(options.player, { url: stream.urlOf(video), title: options.name, subtitle: subs?.path ?? null, vtt: subs?.vtt ?? null });
|
|
1961
1973
|
const timer = setInterval(async () => options.onProgress(await stream.progress()), 2000);
|
|
1962
1974
|
const closed = playing.closed.then(async () => {
|
|
@@ -3686,7 +3698,7 @@ function Help() {
|
|
|
3686
3698
|
|
|
3687
3699
|
// src/cli.tsx
|
|
3688
3700
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3689
|
-
var VERSION = "0.2.
|
|
3701
|
+
var VERSION = "0.2.2";
|
|
3690
3702
|
var HELP = `flick ${VERSION}: search a film, pick a torrent, watch it now
|
|
3691
3703
|
|
|
3692
3704
|
usage:
|
package/man/flick.1
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/room/room.js
CHANGED
|
@@ -10,6 +10,7 @@ const DRIFT_LIMIT = 3; // seconds apart before the pill turns magenta
|
|
|
10
10
|
const CURTAIN_CAP = 10000; // ms before the loading curtain gives up and lifts
|
|
11
11
|
const SEEK_LEAD = 1.5; // seconds: a jump while playing re-buffers through the tunnel, so land ahead
|
|
12
12
|
const FOLLOW_SLACK = 2; // seconds a playing film may differ from the room before we seek
|
|
13
|
+
const CATCH_UP_MAX = 15; // seconds: under this, a drifted player catches up by speed, not by seeking
|
|
13
14
|
|
|
14
15
|
const roomId = location.pathname.split("/")[2];
|
|
15
16
|
const $ = (id) => document.getElementById(id);
|
|
@@ -272,8 +273,16 @@ setInterval(() => {
|
|
|
272
273
|
// Right after our own seek the room hasn't heard about it yet, and its clock
|
|
273
274
|
// still shows the old spot. Don't drag the person back to it.
|
|
274
275
|
if (Date.now() - lastLocalAction < 3000) return;
|
|
276
|
+
// Still loading data: we fall behind while we wait, and seeking now would
|
|
277
|
+
// throw away what is arriving and start a new request through the tunnel,
|
|
278
|
+
// which stalls again. That loop stopped one seat every few seconds.
|
|
279
|
+
if (video.readyState < 3) return;
|
|
275
280
|
const behind = roomTime() - video.currentTime;
|
|
276
|
-
|
|
281
|
+
// A few seconds off: catch up by speed. The film keeps reading the same
|
|
282
|
+
// stretch of file, so nothing has to reload.
|
|
283
|
+
if (Math.abs(behind) > CATCH_UP_MAX) follow();
|
|
284
|
+
else if (behind > FOLLOW_SLACK) video.playbackRate = 1.5;
|
|
285
|
+
else if (behind < -FOLLOW_SLACK) video.playbackRate = 0.75;
|
|
277
286
|
else if (behind > 0.3) video.playbackRate = 1.05;
|
|
278
287
|
else if (behind < -0.3) video.playbackRate = 0.95;
|
|
279
288
|
else video.playbackRate = 1;
|
package/room/style.css
CHANGED
|
@@ -108,6 +108,23 @@ button { cursor: pointer; }
|
|
|
108
108
|
var(--void);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/* Screenprint art behind the two waiting screens (room/art/, FLUX 3 Klein).
|
|
112
|
+
The upscaler smooths the print grain away, so the grain layer puts it back.
|
|
113
|
+
The radial wash is darkest where the centred text sits. */
|
|
114
|
+
#gate, #empty {
|
|
115
|
+
--grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
|
|
116
|
+
--wash: radial-gradient(55% 45% at 50% 50%, rgba(6, 10, 18, 0.72), rgba(6, 10, 18, 0.3) 100%);
|
|
117
|
+
}
|
|
118
|
+
/* The couch fills the lower half, so the gate's content sits up on the wall. */
|
|
119
|
+
#gate {
|
|
120
|
+
--wash: radial-gradient(60% 40% at 50% 28%, rgba(6, 10, 18, 0.75), rgba(6, 10, 18, 0.2) 100%);
|
|
121
|
+
place-content: start center;
|
|
122
|
+
padding-top: 10vh;
|
|
123
|
+
background: var(--grain), var(--wash), url("/art/couch.webp") center bottom / cover no-repeat, var(--void);
|
|
124
|
+
}
|
|
125
|
+
/* An empty marquee board: literally nothing on yet. */
|
|
126
|
+
#empty { background: var(--grain), var(--wash), url("/art/lobby.webp") center / cover no-repeat, var(--void); }
|
|
127
|
+
|
|
111
128
|
.panel p { margin: 0; max-width: 34ch; color: var(--mute); }
|
|
112
129
|
.panel .lead { color: var(--ink); font-size: 20px; }
|
|
113
130
|
|
|
@@ -310,6 +327,9 @@ button { cursor: pointer; }
|
|
|
310
327
|
position: absolute;
|
|
311
328
|
inset: 0 0 auto 0;
|
|
312
329
|
height: 78vh;
|
|
330
|
+
/* The fallback when Wikidata has no art for the film; room.js sets the
|
|
331
|
+
film's own image inline over it. */
|
|
332
|
+
background-image: url("/art/projector.webp");
|
|
313
333
|
background-size: cover;
|
|
314
334
|
background-position: center 30%;
|
|
315
335
|
opacity: 0.38;
|