Skip to content

Commit 63b9b7c

Browse files
committed
options: add --playlist-exts
And add playlist to --directory-filter-types' default. Fixes #15096 (comment), fixes #15508
1 parent 5bf7061 commit 63b9b7c

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

DOCS/interface-changes/exts.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
add `--archive-exts`
22
add `archive` to `--directory-filter-types`' default
3+
add `--playlist-exts`
4+
add `playlist` to `--directory-filter-types`' default

DOCS/man/options.rst

+7
Original file line numberDiff line numberDiff line change
@@ -7738,6 +7738,13 @@ Miscellaneous
77387738
This is a string list option. See `List Options`_ for details. Use
77397739
``--help=archive-exts`` to see the default extensions.
77407740

7741+
``--playlist-exts=ext1,ext2,...``
7742+
Playlist file extentions to try to match when using
7743+
``--autocreate-playlist`` or ``--directory-filter-types``.
7744+
7745+
This is a string list option. See `List Options`_ for details. Use
7746+
``--help=playlist-exts`` to see the default extensions.
7747+
77417748
``--autoload-files=<yes|no>``
77427749
Automatically load/select external files (default: yes).
77437750

demux/demux_playlist.c

+14-7
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ enum dir_mode {
4444
};
4545

4646
enum autocreate_mode {
47-
AUTO_NONE = 0,
48-
AUTO_VIDEO = 1 << 0,
49-
AUTO_AUDIO = 1 << 1,
50-
AUTO_IMAGE = 1 << 2,
51-
AUTO_ARCHIVE = 1 << 3,
52-
AUTO_ANY = 1 << 4,
47+
AUTO_NONE = 0,
48+
AUTO_VIDEO = 1 << 0,
49+
AUTO_AUDIO = 1 << 1,
50+
AUTO_IMAGE = 1 << 2,
51+
AUTO_ARCHIVE = 1 << 3,
52+
AUTO_PLAYLIST = 1 << 4,
53+
AUTO_ANY = 1 << 5,
5354
};
5455

5556
#define OPT_BASE_STRUCT struct demux_playlist_opts
@@ -73,7 +74,7 @@ struct m_sub_options demux_playlist_conf = {
7374
.defaults = &(const struct demux_playlist_opts){
7475
.dir_mode = DIR_AUTO,
7576
.directory_filter = (char *[]){
76-
"video", "audio", "image", "archive", NULL
77+
"video", "audio", "image", "archive", "playlist", NULL
7778
},
7879
},
7980
};
@@ -440,6 +441,8 @@ static bool test_path(struct pl_parser *p, char *path, int autocreate)
440441
return true;
441442
if (autocreate & AUTO_ARCHIVE && str_in_list(ext, p->mp_opts->archive_exts))
442443
return true;
444+
if (autocreate & AUTO_PLAYLIST && str_in_list(ext, p->mp_opts->playlist_exts))
445+
return true;
443446

444447
return false;
445448
}
@@ -525,6 +528,8 @@ static enum autocreate_mode get_directory_filter(struct pl_parser *p)
525528
autocreate |= AUTO_IMAGE;
526529
if (str_in_list(bstr0("archive"), p->opts->directory_filter))
527530
autocreate |= AUTO_ARCHIVE;
531+
if (str_in_list(bstr0("playlist"), p->opts->directory_filter))
532+
autocreate |= AUTO_PLAYLIST;
528533
return autocreate;
529534
}
530535

@@ -549,6 +554,8 @@ static int parse_dir(struct pl_parser *p)
549554
autocreate = AUTO_IMAGE;
550555
} else if (str_in_list(ext, p->mp_opts->archive_exts)) {
551556
autocreate = AUTO_ARCHIVE;
557+
} else if (str_in_list(ext, p->mp_opts->playlist_exts)) {
558+
autocreate = AUTO_PLAYLIST;
552559
}
553560
break;
554561
}

options/options.c

+4
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ static const m_option_t mp_opts[] = {
705705
{"cover-art-whitelist", OPT_STRINGLIST(coverart_whitelist)},
706706
{"video-exts", OPT_STRINGLIST(video_exts)},
707707
{"archive-exts", OPT_STRINGLIST(archive_exts)},
708+
{"playlist-exts", OPT_STRINGLIST(playlist_exts)},
708709

709710
{"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)},
710711
{"", OPT_SUBSTRUCT(subs_shared, mp_subtitle_shared_sub_opts)},
@@ -1041,6 +1042,9 @@ static const struct MPOpts mp_default_opts = {
10411042
.archive_exts = (char *[]){
10421043
"zip", "rar", "7z", "cbz", "cbr", NULL
10431044
},
1045+
.playlist_exts = (char *[]){
1046+
"m3u", "m3u8", "pls", "edl", NULL
1047+
},
10441048

10451049
.sub_auto_exts = (char *[]){
10461050
"ass",

options/options.h

+1
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ typedef struct MPOpts {
333333
char **coverart_whitelist;
334334
char **video_exts;
335335
char **archive_exts;
336+
char **playlist_exts;
336337
bool osd_bar_visible;
337338

338339
int w32_priority;

0 commit comments

Comments
 (0)