summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2021-06-21 18:27:44 +0200
committerDudemanguy <random342@airmail.cc>2021-06-23 16:23:50 +0000
commitcb56c2f888dbe86dbc38839c32684d54ea93c63e (patch)
treeb6fc1dd2a1e372762f1906b03de9dc17a890b6c4 /player
parent0427fe97e1d162116a51754c92fcca46533112fe (diff)
downloadmpv-cb56c2f888dbe86dbc38839c32684d54ea93c63e.tar.bz2
mpv-cb56c2f888dbe86dbc38839c32684d54ea93c63e.tar.xz
player: change cover-art-auto behavior
This makes cover-art-auto behave more like sub-auto and audio-file-auto: - load cover art with a language, e.g. if playing foo.mp3, foo.en.jpg will be loaded with lang=en - load cover art containing the media filename with fuzzy and all, e.g. 'foo (large).jpg' - make all/2 load all images in the directory, and make fuzzy/1 the default These are all uncommon use cases, but synchronizing the behavior of the external file options simplifies the code.
Diffstat (limited to 'player')
-rw-r--r--player/external_files.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/player/external_files.c b/player/external_files.c
index 412f28405b..841534659c 100644
--- a/player/external_files.c
+++ b/player/external_files.c
@@ -220,13 +220,10 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts,
// higher prio -> auto-selection may prefer it (0 = not loaded)
int prio = 0;
- if (bstrcmp(tmp_fname_trim, f_fname_trim) == 0 &&
- (type != STREAM_VIDEO || fuzz != 1))
+ if (bstrcmp(tmp_fname_trim, f_fname_trim) == 0)
prio |= 32; // exact movie name match
bstr lang = {0};
- if (type == STREAM_VIDEO)
- goto cover_art;
if (bstr_startswith(tmp_fname_trim, f_fname_trim)) {
int start = 0;
lang = guess_lang_from_filename(tmp_fname_trim, &start);
@@ -249,15 +246,14 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts,
if (bstr_find(tmp_fname_trim, f_fname_trim) >= 0 && fuzz >= 1)
prio |= 2; // contains the movie name
+ if (type == STREAM_VIDEO && fuzz >= 1 && prio == 0)
+ prio = test_cover_filename(dename);
+
// doesn't contain the movie name
// don't try in the mplayer subtitle directory
if (!limit_fuzziness && fuzz >= 2)
prio |= 1;
- cover_art:
- if (type == STREAM_VIDEO && fuzz >= 1 && prio == 0)
- prio = test_cover_filename(dename);
-
mp_dbg(log, "Potential external file: \"%s\" Priority: %d\n",
de->d_name, prio);