From 519e56f80f8f251c96682daaa90f409c05277464 Mon Sep 17 00:00:00 2001 From: Arthur Williams Date: Sun, 21 May 2023 01:56:18 -0700 Subject: [PATCH] player: always try to detect subtitle language from file name Previously, we'd only attempt to call guess_lang_from_filename if the external file name matched the video name ignoring the extensions. So if they didn't match, we'd just report the language as "unknown". And since the name will never match for urls, the language would always be treated as unknown. Now we'll always try to guess the language from the filename regardless of its similarity to the video file name. Closes #10348 --- player/external_files.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/player/external_files.c b/player/external_files.c index ad8fdfef36..cc9e9bf398 100644 --- a/player/external_files.c +++ b/player/external_files.c @@ -248,10 +248,9 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts, prio |= 32; // exact movie name match bstr lang = {0}; + int start = 0; + lang = guess_lang_from_filename(tmp_fname_trim, &start); if (bstr_startswith(tmp_fname_trim, f_fname_trim)) { - int start = 0; - lang = guess_lang_from_filename(tmp_fname_trim, &start); - if (lang.len && start == f_fname_trim.len) prio |= 16; // exact movie name + followed by lang }