summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--DOCS/man/options.rst6
-rw-r--r--options/options.c2
-rw-r--r--player/external_files.c12
3 files changed, 8 insertions, 12 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 955503bde6..4dfa459e00 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -6729,9 +6729,9 @@ Miscellaneous
:no: Don't automatically load cover art.
:exact: Load the media filename with an image file extension.
- :fuzzy: Load cover art with a filename included in an internal whitelist,
- such as ``cover.jpg``.
- :all: Union of exact and fuzzy (default).
+ :fuzzy: Load all cover art containing the media filename and filenames
+ in an internal whitelist, such as ``cover.jpg`` (default).
+ :all: Load all images in the current directory.
See ``--cover-art-files`` for details about what constitutes cover art.
diff --git a/options/options.c b/options/options.c
index f43068f221..89ea4f85e0 100644
--- a/options/options.c
+++ b/options/options.c
@@ -1018,7 +1018,7 @@ static const struct MPOpts mp_default_opts = {
.pitch_correction = 1,
.sub_auto = 0,
.audiofile_auto = -1,
- .coverart_auto = 2,
+ .coverart_auto = 1,
.osd_bar_visible = 1,
.screenshot_template = "mpv-shot%n",
.play_dir = 1,
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);