diff options
author | Guido Cella <guido@guidocella.xyz> | 2021-12-03 16:52:53 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-04-21 16:42:27 +0000 |
commit | 9d2a6dc302a3c2ed7320b66793f4ac03c2b5ce80 (patch) | |
tree | 3fcfdf4b75ff33ed4c6fac1748bdaa59a7ba5450 | |
parent | c317abbb635fa9e59857f8fc13107ffd66e956c8 (diff) | |
download | mpv-9d2a6dc302a3c2ed7320b66793f4ac03c2b5ce80.tar.bz2 mpv-9d2a6dc302a3c2ed7320b66793f4ac03c2b5ce80.tar.xz |
player: add cover-art-whitelist option
This allows more fine grained control over which cover art to load. With
--cover-art-auto=exact and --cover-art-whitelist=yes, you can now load
cover art with the exact media filename and the whitelisted filenames,
but not cover art that contains the media filename
(--cover-art-auto=fuzzy).
-rw-r--r-- | DOCS/man/options.rst | 10 | ||||
-rw-r--r-- | options/options.c | 2 | ||||
-rw-r--r-- | options/options.h | 1 | ||||
-rw-r--r-- | player/external_files.c | 2 |
4 files changed, 12 insertions, 3 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index bca96ac2fb..21ff76708f 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -6905,8 +6905,7 @@ Miscellaneous :no: Don't automatically load cover art. :exact: Load the media filename with an image file extension. - :fuzzy: Load all cover art containing the media filename and filenames - in an internal whitelist, such as ``cover.jpg`` (default). + :fuzzy: Load all cover art containing the media filename (default). :all: Load all images in the current directory. See ``--cover-art-files`` for details about what constitutes cover art. @@ -6914,6 +6913,13 @@ Miscellaneous See ``--audio-display`` how to control display of cover art (this can be used to disable cover art that is part of the file). +``--cover-art-whitelist=<no|yes>`` + Whether to load filenames in an internal whitelist, such as ``cover.jpg``, + as cover art. If ``cover-art-auto`` is set to ``no``, the whitelisted + filenames are never loaded even if this option is set to ``yes``. + + Default: ``yes``. + ``--autoload-files=<yes|no>`` Automatically load/select external files (default: yes). diff --git a/options/options.c b/options/options.c index e996eb8026..650ba00b46 100644 --- a/options/options.c +++ b/options/options.c @@ -611,6 +611,7 @@ static const m_option_t mp_opts[] = { {"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})}, {"cover-art-auto", OPT_CHOICE(coverart_auto, {"no", -1}, {"exact", 0}, {"fuzzy", 1}, {"all", 2})}, + {"cover-art-whitelist", OPT_BOOL(coverart_whitelist)}, {"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)}, {"", OPT_SUBSTRUCT(subs_filt, mp_sub_filter_opts)}, @@ -1033,6 +1034,7 @@ static const struct MPOpts mp_default_opts = { .sub_auto = 0, .audiofile_auto = -1, .coverart_auto = 1, + .coverart_whitelist = true, .osd_bar_visible = 1, .screenshot_template = "mpv-shot%n", .play_dir = 1, diff --git a/options/options.h b/options/options.h index b32dc06519..4eb5ef07c7 100644 --- a/options/options.h +++ b/options/options.h @@ -306,6 +306,7 @@ typedef struct MPOpts { int sub_auto; int audiofile_auto; int coverart_auto; + bool coverart_whitelist; int osd_bar_visible; int w32_priority; diff --git a/player/external_files.c b/player/external_files.c index 3aca20dfdb..16aeb665c7 100644 --- a/player/external_files.c +++ b/player/external_files.c @@ -246,7 +246,7 @@ 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) + if (type == STREAM_VIDEO && opts->coverart_whitelist && prio == 0) prio = test_cover_filename(dename); // doesn't contain the movie name |