feat(jellyfin): watch from one's own Jellyfin server and learn the words of its subtitles

Animelon's way of learning from video, from the person's own Jellyfin
server: connected per device (Settings, or a studyset's Add material ›
Watch from Jellyfin) with a name and password or a Quick Connect code,
over HTTPS only (plain HTTP only to a server on the same machine); the
token stays in the system's keyring. Shows, films and videos tied to a
studyset follow the person in their settings as the server's and the
item's ids alone (settings schema 9), named by the server when shown.

The Watch screen plays the video (video_player on Android, media_kit's
libmpv on Linux and Windows) with the line in the studyset's front
language cut into the dictionary's words with furigana, and the back
language's line beneath; a word tapped pauses the video and becomes a
card with the line and its translation as its first hint, tagged with
the show. The video's words are listed, most frequent first. The sound is
the track in the studyset's language, whichever the file marks default,
and the menu switches it; the subtitles read are a whole track, never a
forced one (which only covers what the sound doesn't say), and captions
for the hard of hearing only without plain ones. The line and its
translation take the video's width in a box of a fixed height, so the
video keeps its size; in the dark theme the video's colours glow around
it, as YouTube's ambient mode, and the words' panel takes the colour of
the episode's picture under the pointer.

A line is cut into words with one request: DictionaryEndpoint.withKeys
looks up every stretch of it that may be a word, as it stands and as
every word it may be a conjugation of, in the new dictionary_key table
(one row per key, indexed; migration dictionary-keys adds the table and
its index, nothing else), which the loader fills beside the entries.
The instance gets the text of each line looked up and keeps none of it,
as the Watch screen says.

Linux builds need libmpv-dev, and the app links libmpv: the snap stages
Ubuntu's libmpv2, makes the update-alternatives links for BLAS and LAPACK
that ffmpeg's speech recognition needs (staging never runs install
scripts), and removes what the GNOME runtime and core24 already hold, as
older copies of cairo, pango and librsvg hid the runtime's from its GTK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-13 11:31:37 +02:00
commit da51ef73cb
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -96,10 +96,16 @@ parts:
source: .
source-type: git
# The sound player links GStreamer, which the GNOME SDK lacks; the GNOME
# runtime brings the same GStreamer (1.24) to run.
# runtime brings the same GStreamer (1.24) to run. The video player
# (media_kit, for Jellyfin) links libmpv, which neither has: the Snap
# brings Ubuntu's libmpv2 with what it needs (ffmpeg's libraries), or the
# app wouldn't start.
build-packages:
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev
- libmpv-dev
stage-packages:
- libmpv2
override-build: |
set -eu
export PATH="$CRAFT_STAGE/usr/bin:$PATH"
@ -110,9 +116,47 @@ parts:
--dart-define=SERVER_URL=https://learn.halkyon.eu/
mkdir -p "$CRAFT_PART_INSTALL/bin"
cp -r build/linux/x64/release/bundle/. "$CRAFT_PART_INSTALL/bin/"
# ffmpeg's speech recognition (libsphinxbase) links libblas.so.3 and
# liblapack.so.3, which Ubuntu keeps in blas/ and lapack/ and links into
# the library folder from its packages' install scripts
# (update-alternatives), which staging never runs: without these links
# the app doesn't start. The linter doesn't notice, as the build
# machine has them.
lib="$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR"
mkdir -p "$lib"
ln -sf blas/libblas.so.3 "$lib/libblas.so.3"
ln -sf lapack/liblapack.so.3 "$lib/liblapack.so.3"
secret-backend:
plugin: dump
source: snap/local
organize:
secret-backend: bin/secret-backend
# Staged packages bring their whole dependency tree, also what the GNOME
# runtime and the base hold already: libmpv's ffmpeg brought Ubuntu's older
# librsvg, cairo, pango, harfbuzz and gdk-pixbuf, which came first on the
# library path and hid the runtime's newer ones from its GTK (its SVG
# loader failed for a function only the runtime's librsvg has). So every
# file the runtime or the base has at the same path goes, as the GNOME
# extension's reference shows, but only under usr/ and never a directory:
# its example removes every path the base has, and core24's bin and lib are
# links, so it would take the app's bin/ with them. blas/ and lapack/ stay:
# the runtime has them too, but the links into them are the app's own.
cleanup:
after: [halkyon-learn, secret-backend]
plugin: nil
build-snaps: [core24, gnome-46-2404]
override-prime: |
set -eu
for snap in core24 gnome-46-2404; do
cd "/snap/$snap/current/usr"
find . \( -type f -o -type l \) -print0 |
while IFS= read -r -d '' path; do
case "$path" in */blas/* | */lapack/*) continue ;; esac
target="$CRAFT_PRIME/usr/$path"
if [ -L "$target" ] || [ -f "$target" ]; then
rm -f "$target"
fi
done
done