mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-04 16:57:00 +01:00
feat(core,app,android,ios): play the dialogue, not the signs and songs
Anime releases often carry two subtitle tracks in one language, the dialogue and a "Signs & Songs" track, and the second is as often as not the one marked default or forced. mpv, picking by language, played it. pstr_core::subtitles reads a track's name and forced flag for whether it is the dialogue, and every client asks it once per file, after mpv has made its own pick, whether to switch to a track in the same language that is. A subtitle track the viewer chose by name stays, and subtitles that are off stay off.
This commit is contained in:
1 parent
8d615579e2
commit
b1ea076ea3
10 files changed
+353
-7
No files matched your search
@@ -578,6 +578,15 @@ fn run(
|
||||
if let Some(show) = target.track_prefs.as_deref() {
|
||||
restore_tracks(&player, show);
|
||||
}
|
||||
// A subtitle track picked by name stays; one mpv picked by
|
||||
// language may be the signs and songs, not the dialogue.
|
||||
let picked = target
|
||||
.track_prefs
|
||||
.as_deref()
|
||||
.is_some_and(|show| show.subtitle_title.is_some());
|
||||
if !picked {
|
||||
prefer_full_subtitles(&player);
|
||||
}
|
||||
emit_tracks(&engine, id, &player);
|
||||
}
|
||||
PlayerEvent::Duration(value) => duration = Some(*value),
|
||||
@@ -735,6 +744,16 @@ fn restore_tracks(player: &Player, show: &pstr_core::catalog::TitleTrackPrefs) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Play the dialogue rather than the signs and songs mpv picked by language.
|
||||
/// Not remembered: it is the choice mpv should have made, not the viewer's.
|
||||
fn prefer_full_subtitles(player: &Player) {
|
||||
if let Some(track) = pstr_player::full_subtitles_instead(&player.tracks())
|
||||
&& let Err(error) = player.select_track(TrackKind::Subtitle, Some(track))
|
||||
{
|
||||
tracing::warn!("select dialogue subtitle {track}: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Hand mpv the subtitle files paired with the video it has just loaded.
|
||||
///
|
||||
/// One is turned on only when subtitles are on and the video has none of its
|
||||
|
||||
Reference in new issue
Block a user