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>
2026-10-13 11:31:37 +02:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:halkyon_learn_flutter/src/core/video/media_players.dart';
|
|
|
|
|
import 'package:halkyon_learn_flutter/src/feature/jellyfin/data/jellyfin_gateway.dart';
|
|
|
|
|
import 'package:halkyon_learn_flutter/src/feature/jellyfin/data/jellyfin_store.dart';
|
|
|
|
|
import 'package:halkyon_learn_flutter/src/feature/jellyfin/model/jellyfin.dart';
|
|
|
|
|
import 'package:material_ui/material_ui.dart';
|
|
|
|
|
|
|
|
|
|
/// The server of [FakeJellyfinGateway].
|
|
|
|
|
final fakeJellyfinServer = JellyfinServer(
|
|
|
|
|
address: Uri.parse('https://jellyfin.local:8920'),
|
|
|
|
|
id: 'server-1',
|
|
|
|
|
name: 'Living room',
|
|
|
|
|
version: '12.2.0',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/// A [JellyfinGateway] in memory: [fakeJellyfinServer] at
|
|
|
|
|
/// `jellyfin.local:8920`, the person `mika` with the password `secret`,
|
|
|
|
|
/// the libraries and what each item holds ([tree], by parent id; the
|
|
|
|
|
/// libraries under `''`), the videos' playback and subtitles ([vtt], by
|
|
|
|
|
/// item id and track index).
|
|
|
|
|
class FakeJellyfinGateway({
|
|
|
|
|
final Map<String, List<JellyfinItem>> tree = const {},
|
|
|
|
|
final Map<String, JellyfinPlayback> playbacks = const {},
|
|
|
|
|
final Map<(String, int), String> vtt = const {},
|
feat(jellyfin): songs and their lyrics, read as subtitles are
A music library's artists and albums open as shows and seasons do, and
can be tied to a studyset. A song plays as sound alone (`/Audio/{id}/
stream`, as stored) with its lyrics as Jellyfin keeps them (`/Audio/{id}/
Lyrics`: an LRC file beside it, or its tags), cut into the dictionary's
words as a video's subtitles are, with no translation. Timed lyrics
follow the song: the line sung large and bright among the others faded,
scrolled to as it comes, a line tapped played from its start; untimed
ones show whole. A song without lyrics shows greyed and doesn't open
(`HasLyrics`), as there is nothing in it to read. Its cover stands where
the picture would, glowing as a video does, and its words are tagged
with the artist, shown, and "artist · title", hidden.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 19:46:54 +02:00
|
|
|
|
|
|
|
|
/// Each song's lyrics, by its id.
|
|
|
|
|
final Map<String, List<({String text, Duration? start})>> lyricsOf = const {},
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
}) implements JellyfinGateway {
|
|
|
|
|
/// When set, every request after signing in fails with it.
|
|
|
|
|
JellyfinProblem? fail;
|
|
|
|
|
|
|
|
|
|
/// Whether the Quick Connect code was approved.
|
|
|
|
|
bool approved = false;
|
|
|
|
|
|
2026-10-14 01:52:42 +02:00
|
|
|
/// The people the server shows on its login screen; those named in
|
|
|
|
|
/// [withoutPassword] sign in with none.
|
feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap
An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.
In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 23:25:33 +02:00
|
|
|
List<JellyfinPublicUser> shownUsers = const [];
|
|
|
|
|
|
2026-10-14 01:52:42 +02:00
|
|
|
/// Names of accounts without a password, as a demo's.
|
|
|
|
|
Set<String> withoutPassword = const {};
|
|
|
|
|
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
/// What was reported of playbacks: their positions, in order.
|
|
|
|
|
final reports = <({Duration position, bool started, bool stopped})>[];
|
|
|
|
|
|
|
|
|
|
/// The tokens signed out.
|
|
|
|
|
final signedOut = <String>[];
|
|
|
|
|
|
|
|
|
|
void _check(JellyfinAccount account) {
|
|
|
|
|
if (fail case final problem?) {
|
|
|
|
|
throw JellyfinException(problem: problem);
|
|
|
|
|
}
|
|
|
|
|
if (signedOut.contains(account.token)) {
|
|
|
|
|
throw JellyfinException(problem: JellyfinProblem.signedOut);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap
An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.
In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 23:25:33 +02:00
|
|
|
JellyfinAccount _account(
|
|
|
|
|
String token, {
|
|
|
|
|
String userId = 'user-1',
|
|
|
|
|
String userName = 'mika',
|
|
|
|
|
}) => JellyfinAccount(
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
server: fakeJellyfinServer,
|
feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap
An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.
In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 23:25:33 +02:00
|
|
|
userId: userId,
|
|
|
|
|
userName: userName,
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
token: token,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<JellyfinServer> server(Uri address) async {
|
|
|
|
|
if (address.host != fakeJellyfinServer.address.host ||
|
|
|
|
|
address.port != fakeJellyfinServer.address.port) {
|
|
|
|
|
throw JellyfinException(problem: JellyfinProblem.unreachable);
|
|
|
|
|
}
|
|
|
|
|
return JellyfinServer(
|
|
|
|
|
address: address,
|
|
|
|
|
id: fakeJellyfinServer.id,
|
|
|
|
|
name: fakeJellyfinServer.name,
|
|
|
|
|
version: fakeJellyfinServer.version,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<bool> quickConnectEnabled(JellyfinServer server) async => true;
|
|
|
|
|
|
feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap
An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.
In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 23:25:33 +02:00
|
|
|
@override
|
|
|
|
|
Future<List<JellyfinPublicUser>> publicUsers(JellyfinServer server) async =>
|
|
|
|
|
shownUsers;
|
|
|
|
|
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
@override
|
|
|
|
|
Future<JellyfinAccount> signIn(
|
|
|
|
|
JellyfinServer server,
|
|
|
|
|
String user,
|
|
|
|
|
String password,
|
|
|
|
|
) async {
|
feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap
An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.
In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 23:25:33 +02:00
|
|
|
for (final public in shownUsers) {
|
2026-10-14 01:52:42 +02:00
|
|
|
if (public.name == user &&
|
|
|
|
|
withoutPassword.contains(user) &&
|
|
|
|
|
password.isEmpty) {
|
feat(jellyfin): the instance suggests a Jellyfin server, signed in to with a tap
An instance now names a Jellyfin server for its people to learn from
(instance.info().jellyfinUrl): its operator's JELLYFIN_URL (`none`: none),
else https://jellyfin. on the domain registered for its public host, as
learn.halkyon.eu suggests jellyfin.halkyon.eu, once that answers as a
Jellyfin server. The registered domain comes from Mozilla's Public Suffix
List, kept in the server's data folder, so an instance at example.co.uk
never names someone else's jellyfin.co.uk. The instance looks as it
starts and again hourly when asked; the app never reaches for a guessed
address.
In the app, Add material offers From Jellyfin as soon as the instance
suggests a server, before anyone signed in to one. The sign-in fills the
server in and finds it by itself, and lists the people the server shows
on its login screen: one without a password, as a demo's, signs in with
a tap; one with a password is named in the form, which asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 23:25:33 +02:00
|
|
|
return _account('token-3', userId: public.id, userName: public.name);
|
|
|
|
|
}
|
|
|
|
|
}
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
if (user != 'mika' || password != 'secret') {
|
|
|
|
|
throw JellyfinException(problem: JellyfinProblem.wrongCredentials);
|
|
|
|
|
}
|
|
|
|
|
return _account('token-1');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<({String code, String secret})> startQuickConnect(
|
|
|
|
|
JellyfinServer server,
|
|
|
|
|
) async => (code: '123456', secret: 'secret-1');
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<bool> quickConnectApproved(
|
|
|
|
|
JellyfinServer server,
|
|
|
|
|
String secret,
|
|
|
|
|
) async => approved;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<JellyfinAccount> finishQuickConnect(
|
|
|
|
|
JellyfinServer server,
|
|
|
|
|
String secret,
|
|
|
|
|
) async => _account('token-2');
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> signOut(JellyfinAccount account) async =>
|
|
|
|
|
signedOut.add(account.token);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<List<JellyfinItem>> libraries(JellyfinAccount account) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
return tree[''] ?? const [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<List<JellyfinItem>> children(
|
|
|
|
|
JellyfinAccount account,
|
|
|
|
|
String parentId,
|
|
|
|
|
) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
return tree[parentId] ?? const [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<List<JellyfinItem>> search(
|
|
|
|
|
JellyfinAccount account,
|
|
|
|
|
String term,
|
|
|
|
|
) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
return [
|
|
|
|
|
for (final items in tree.values)
|
|
|
|
|
for (final item in items)
|
|
|
|
|
if (item.kind != JellyfinItemKind.library &&
|
|
|
|
|
item.name.toLowerCase().contains(term.toLowerCase()))
|
|
|
|
|
item,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<JellyfinItem> item(JellyfinAccount account, String id) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
// A server answers 404 for an item it no longer has.
|
|
|
|
|
return [
|
|
|
|
|
for (final items in tree.values) ...items,
|
|
|
|
|
].where((item) => item.id == id).firstOrNull ??
|
|
|
|
|
(throw JellyfinException(problem: JellyfinProblem.failed));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<JellyfinPlayback> playback(
|
|
|
|
|
JellyfinAccount account,
|
|
|
|
|
String itemId,
|
|
|
|
|
) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
return playbacks[itemId] ??
|
|
|
|
|
(throw JellyfinException(problem: JellyfinProblem.failed));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Uri streamOf(JellyfinAccount account, JellyfinPlayback playback) =>
|
|
|
|
|
fakeJellyfinServer.address.replace(
|
|
|
|
|
path: '/Videos/${playback.itemId}/stream',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Map<String, String> headersOf(JellyfinAccount account) => {
|
|
|
|
|
'Authorization': 'MediaBrowser Token="${account.token}"',
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<String> subtitles(
|
|
|
|
|
JellyfinAccount account,
|
|
|
|
|
JellyfinPlayback playback,
|
|
|
|
|
JellyfinSubtitleTrack track,
|
|
|
|
|
) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
return vtt[(playback.itemId, track.index)] ?? 'WEBVTT\n';
|
|
|
|
|
}
|
|
|
|
|
|
feat(jellyfin): songs and their lyrics, read as subtitles are
A music library's artists and albums open as shows and seasons do, and
can be tied to a studyset. A song plays as sound alone (`/Audio/{id}/
stream`, as stored) with its lyrics as Jellyfin keeps them (`/Audio/{id}/
Lyrics`: an LRC file beside it, or its tags), cut into the dictionary's
words as a video's subtitles are, with no translation. Timed lyrics
follow the song: the line sung large and bright among the others faded,
scrolled to as it comes, a line tapped played from its start; untimed
ones show whole. A song without lyrics shows greyed and doesn't open
(`HasLyrics`), as there is nothing in it to read. Its cover stands where
the picture would, glowing as a video does, and its words are tagged
with the artist, shown, and "artist · title", hidden.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-13 19:46:54 +02:00
|
|
|
@override
|
|
|
|
|
Future<List<({String text, Duration? start})>> lyrics(
|
|
|
|
|
JellyfinAccount account,
|
|
|
|
|
String itemId,
|
|
|
|
|
) async {
|
|
|
|
|
_check(account);
|
|
|
|
|
return lyricsOf[itemId] ?? const [];
|
|
|
|
|
}
|
|
|
|
|
|
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>
2026-10-13 11:31:37 +02:00
|
|
|
@override
|
|
|
|
|
Uri imageOf(JellyfinAccount account, JellyfinItem item, {int height = 360}) =>
|
|
|
|
|
fakeJellyfinServer.address.replace(path: '/Items/${item.id}/Images');
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> report(
|
|
|
|
|
JellyfinAccount account,
|
|
|
|
|
JellyfinPlayback playback,
|
|
|
|
|
Duration position, {
|
|
|
|
|
bool paused = false,
|
|
|
|
|
bool started = false,
|
|
|
|
|
bool stopped = false,
|
|
|
|
|
}) async => reports.add((
|
|
|
|
|
position: position,
|
|
|
|
|
started: started,
|
|
|
|
|
stopped: stopped,
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A [JellyfinStore] in memory, with what [kept] holds to start with.
|
|
|
|
|
class MemoryJellyfinStore({JellyfinState? kept}) implements JellyfinStore {
|
|
|
|
|
JellyfinState? kept = kept;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<JellyfinState> read() async =>
|
|
|
|
|
kept ?? const JellyfinState(deviceId: 'device-1');
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> write(JellyfinState state) async => kept = state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// [MediaPlayers] that play nothing: a playback stands where it is put
|
|
|
|
|
/// ([FakeMediaPlayback.moveTo]), and its picture is [frame], or a dark box.
|
|
|
|
|
class FakeMediaPlayers({
|
|
|
|
|
/// What the picture shows.
|
|
|
|
|
final Widget? frame,
|
|
|
|
|
|
|
|
|
|
/// The audio tracks of every video, as its player lists them.
|
|
|
|
|
final List<MediaAudioTrack> audio = const [],
|
|
|
|
|
@override final bool available = true,
|
|
|
|
|
}) implements MediaPlayers {
|
|
|
|
|
/// The videos opened, in order.
|
|
|
|
|
final opened = <({Uri url, Map<String, String> headers, Duration start})>[];
|
|
|
|
|
|
|
|
|
|
/// The playback opened last.
|
|
|
|
|
FakeMediaPlayback? last;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<MediaPlayback> open(
|
|
|
|
|
Uri url, {
|
|
|
|
|
Map<String, String> headers = const {},
|
|
|
|
|
Duration start = Duration.zero,
|
|
|
|
|
}) async {
|
|
|
|
|
opened.add((url: url, headers: headers, start: start));
|
|
|
|
|
return last = FakeMediaPlayback(start: start, frame: frame, audio: audio);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A [MediaPlayback] standing still until moved.
|
|
|
|
|
class FakeMediaPlayback({
|
|
|
|
|
Duration start = Duration.zero,
|
|
|
|
|
final Widget? frame,
|
|
|
|
|
final List<MediaAudioTrack> audio = const [],
|
|
|
|
|
}) implements MediaPlayback {
|
|
|
|
|
final ValueNotifier<MediaState> _state = ValueNotifier(
|
|
|
|
|
MediaState(position: start, duration: const Duration(minutes: 24)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/// Whether it was disposed.
|
|
|
|
|
bool disposed = false;
|
|
|
|
|
|
|
|
|
|
/// The audio track chosen, if one was.
|
|
|
|
|
MediaAudioTrack? selectedAudio;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<List<MediaAudioTrack>> audioTracks() async => audio;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> selectAudio(MediaAudioTrack track) async =>
|
|
|
|
|
selectedAudio = track;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
ValueListenable<MediaState> get state => _state;
|
|
|
|
|
|
|
|
|
|
/// Puts it at [position], as playing would.
|
|
|
|
|
void moveTo(Duration position) => _state.value = MediaState(
|
|
|
|
|
position: position,
|
|
|
|
|
duration: _state.value.duration,
|
|
|
|
|
playing: _state.value.playing,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> play() async => _state.value = MediaState(
|
|
|
|
|
position: _state.value.position,
|
|
|
|
|
duration: _state.value.duration,
|
|
|
|
|
playing: true,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> pause() async => _state.value = MediaState(
|
|
|
|
|
position: _state.value.position,
|
|
|
|
|
duration: _state.value.duration,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> seekTo(Duration position) async => moveTo(position);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget view() => AspectRatio(
|
|
|
|
|
aspectRatio: 16 / 9,
|
|
|
|
|
child: frame ?? const ColoredBox(color: Color(0xFF101418)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> dispose() async => disposed = true;
|
|
|
|
|
}
|