diff options
Diffstat (limited to 'player/external_files.c')
-rw-r--r-- | player/external_files.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/player/external_files.c b/player/external_files.c index e42558f594..06585bf18f 100644 --- a/player/external_files.c +++ b/player/external_files.c @@ -43,6 +43,7 @@ static const char *const audio_exts[] = {"mp3", "aac", "mka", "dts", "flac", NULL}; // Stolen from: vlc/-/blob/master/modules/meta_engine/folder.c#L40 +// sorted by priority (descending) static const char *const cover_files[] = { "AlbumArt.jpg", "Album.jpg", @@ -81,11 +82,13 @@ static int test_ext(bstr ext) return -1; } -static int test_filename(bstr fname) +static int test_cover_filename(bstr fname, int *priority) { for (int n = 0; cover_files[n]; n++) { - if (bstrcasecmp(bstr0(cover_files[n]), fname) == 0) + if (bstrcasecmp(bstr0(cover_files[n]), fname) == 0) { + *priority = MP_ARRAY_SIZE(cover_files) - n; return STREAM_VIDEO; + } } return -1; } @@ -188,9 +191,10 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts, talloc_steal(tmpmem2, dename.start); // check what it is (most likely) + int cover_prio = 0; int type = test_ext(tmp_fname_ext); if (type < 0) - type = test_filename(dename); + type = test_cover_filename(dename, &cover_prio); char **langs = NULL; int fuzz = -1; switch (type) { @@ -247,7 +251,7 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts, // cover art: just accept it if (type == STREAM_VIDEO && fuzz >= 1) - prio |= 1; + prio = cover_prio; mp_dbg(log, "Potential external file: \"%s\" Priority: %d\n", de->d_name, prio); |