mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
external_files: allow specifying --cover-art-whitelist filenames
Fixes https://github.com/mpv-player/mpv/discussions/14520.
This commit is contained in:
@@ -30,20 +30,6 @@
|
||||
#include "options/path.h"
|
||||
#include "external_files.h"
|
||||
|
||||
// Stolen from: vlc/-/blob/master/modules/meta_engine/folder.c#L40
|
||||
// sorted by priority (descending)
|
||||
static const char *const cover_files[] = {
|
||||
"AlbumArt",
|
||||
"Album",
|
||||
"cover",
|
||||
"front",
|
||||
"AlbumArtSmall",
|
||||
"Folder",
|
||||
".folder",
|
||||
"thumb",
|
||||
NULL
|
||||
};
|
||||
|
||||
// Needed for mp_might_be_subtitle_file
|
||||
char **sub_exts;
|
||||
|
||||
@@ -70,11 +56,13 @@ static int test_ext(MPOpts *opts, bstr ext)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int test_cover_filename(bstr fname)
|
||||
static int test_cover_filename(bstr fname, char **cover_files)
|
||||
{
|
||||
for (int n = 0; cover_files[n]; n++) {
|
||||
if (bstrcasecmp(bstr0(cover_files[n]), fname) == 0) {
|
||||
return MP_ARRAY_SIZE(cover_files) - n;
|
||||
size_t size = n;
|
||||
while (cover_files[++size]);
|
||||
return size - n;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -198,8 +186,8 @@ 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 && opts->coverart_whitelist && prio == 0)
|
||||
prio = test_cover_filename(tmp_fname_trim);
|
||||
if (type == STREAM_VIDEO && prio == 0)
|
||||
prio = test_cover_filename(tmp_fname_trim, opts->coverart_whitelist);
|
||||
|
||||
// doesn't contain the movie name
|
||||
// don't try in the mplayer subtitle directory
|
||||
|
||||
Reference in New Issue
Block a user