summaryrefslogtreecommitdiffstats
path: root/player/external_files.c
diff options
context:
space:
mode:
authorArthur Williams <taaparthur@disroot.org>2023-05-21 01:56:18 -0700
committerLeo Izen <leo.izen@gmail.com>2023-05-21 10:02:03 -0400
commit519e56f80f8f251c96682daaa90f409c05277464 (patch)
tree1dcbe170434963db65d25ebaa4989038d501340e /player/external_files.c
parentec58670a0dc9d4c3970cb4814b2f47ca7011a421 (diff)
downloadmpv-519e56f80f8f251c96682daaa90f409c05277464.tar.bz2
mpv-519e56f80f8f251c96682daaa90f409c05277464.tar.xz
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
Diffstat (limited to 'player/external_files.c')
-rw-r--r--player/external_files.c5
1 files 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
}