1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-29 10:32:15 +00:00

external_files: base cover-art-whitelist on cover-art-auto-exts

Combine the cover art whitelist with the extensions in
--cover-art-auto-exts instead of hardcoding them. This is shorter,
checks for more extensions, saves us from updating the whitelist
everytime we add a new image extension, and since the whitelist had
gotten so big and the priority is calculated as
MP_ARRAY_SIZE(cover_files) - n, files like cover.jpg were taking
priority over cover art loaded by --cover-art-auto=exact.
This commit is contained in:
Guido Cella 2023-10-01 16:33:05 +02:00 committed by Dudemanguy
parent c4c70d8efe
commit 0070a5820e
2 changed files with 14 additions and 44 deletions

View File

@ -7218,9 +7218,10 @@ Miscellaneous
This is a string list option. See `List Options`_ for details. This is a string list option. See `List Options`_ for details.
``--cover-art-whitelist=<no|yes>`` ``--cover-art-whitelist=<no|yes>``
Whether to load filenames in an internal whitelist, such as ``cover.jpg``, Whether to load files with a filename among "AlbumArt", "Album", "cover",
as cover art. If ``cover-art-auto`` is set to ``no``, the whitelisted "front", "AlbumArtSmall", "Folder", ".folder", "thumb", "front", and an
filenames are never loaded even if this option is set to ``yes``. extension in ``--cover-art-auto-exts``, as cover art. This has no effect is
``cover-art-auto`` is ``no``.
Default: ``yes``. Default: ``yes``.

View File

@ -35,46 +35,15 @@
// Stolen from: vlc/-/blob/master/modules/meta_engine/folder.c#L40 // Stolen from: vlc/-/blob/master/modules/meta_engine/folder.c#L40
// sorted by priority (descending) // sorted by priority (descending)
static const char *const cover_files[] = { static const char *const cover_files[] = {
"AlbumArt.jpg", "AlbumArt",
"AlbumArt.webp", "Album",
"AlbumArt.jxl", "cover",
"AlbumArt.avif", "front",
"Album.jpg", "AlbumArtSmall",
"Album.webp", "Folder",
"Album.jxl", ".folder",
"Album.avif", "thumb",
"cover.jpg", "front",
"cover.png",
"cover.webp",
"cover.jxl",
"cover.avif",
"front.jpg",
"front.png",
"front.webp",
"front.jxl",
"front.avif",
"AlbumArtSmall.jpg",
"AlbumArtSmall.webp",
"AlbumArtSmall.jxl",
"AlbumArtSmall.avif",
"Folder.jpg",
"Folder.png",
"Folder.webp",
"Folder.jxl",
"Folder.avif",
".folder.png",
".folder.webp",
".folder.jxl",
".folder.avif",
"thumb.jpg",
"thumb.webp",
"thumb.jxl",
"thumb.avif",
"front.bmp",
"front.gif",
"cover.gif",
NULL NULL
}; };
@ -267,7 +236,7 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts,
prio |= 2; // contains the movie name prio |= 2; // contains the movie name
if (type == STREAM_VIDEO && opts->coverart_whitelist && prio == 0) if (type == STREAM_VIDEO && opts->coverart_whitelist && prio == 0)
prio = test_cover_filename(dename); prio = test_cover_filename(tmp_fname_trim);
// doesn't contain the movie name // doesn't contain the movie name
// don't try in the mplayer subtitle directory // don't try in the mplayer subtitle directory