Skip to content

Commit 3cc2efb

Browse files
committed
Mention the new supported targets
1 parent 3bfd1a9 commit 3cc2efb

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

src/main.c

+29-20
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int main(int argc, argv_t* argv[]) {
160160
int referer = 0;
161161
int insecure = 0;
162162
int debug = 0;
163-
int disable_autoselect = 0;
163+
int disable_autoselection = 0;
164164

165165
int select_all_medias = 0;
166166
int exists = 0;
@@ -603,6 +603,13 @@ int main(int argc, argv_t* argv[]) {
603603
}
604604

605605
debug = 1;
606+
} else if (strcmp(argument->key, "disable-autoselection") == 0) {
607+
if (disable_autoselection) {
608+
err = M3U8ERR_CLI_DUPLICATE_ARGUMENT;
609+
goto end;
610+
}
611+
612+
disable_autoselection = 1;
606613
} else {
607614
err = M3U8ERR_CLI_ARGUMENT_INVALID;
608615
goto end;
@@ -718,28 +725,30 @@ int main(int argc, argv_t* argv[]) {
718725
goto end;
719726
}
720727
} else {
721-
fprintf(stderr, "+ warning: you did not explicitly select a variant stream; auto selecting the best available\n");
722-
723-
for (index = stream.offset; index-- > 0;) {
724-
struct M3U8StreamItem* const item = &stream.items[index];
725-
struct M3U8VariantStream* const variant_stream = item->item;
728+
if (!disable_autoselection) {
729+
fprintf(stderr, "+ warning: you did not explicitly select a variant stream; autoselecting the best available\n");
726730

727-
if (item->type != M3U8_STREAM_VARIANT_STREAM) {
728-
continue;
731+
for (index = stream.offset; index-- > 0;) {
732+
struct M3U8StreamItem* const item = &stream.items[index];
733+
struct M3U8VariantStream* const variant_stream = item->item;
734+
735+
if (item->type != M3U8_STREAM_VARIANT_STREAM) {
736+
continue;
737+
}
738+
739+
if (variant_stream->tag->type != M3U8_TAG_EXT_X_STREAM_INF) {
740+
continue;
741+
}
742+
743+
selected_streams.items[selected_streams.offset++] = &variant_stream->stream;
744+
745+
break;
729746
}
730747

731-
if (variant_stream->tag->type != M3U8_TAG_EXT_X_STREAM_INF) {
732-
continue;
748+
if (selected_streams.offset == 0) {
749+
err = M3U8ERR_CLI_SELECT_STREAM_NO_AVAILABLE_STREAMS;
750+
goto end;
733751
}
734-
735-
selected_streams.items[selected_streams.offset++] = &variant_stream->stream;
736-
737-
break;
738-
}
739-
740-
if (selected_streams.offset == 0) {
741-
err = M3U8ERR_CLI_SELECT_STREAM_NO_AVAILABLE_STREAMS;
742-
goto end;
743752
}
744753
}
745754

@@ -794,7 +803,7 @@ int main(int argc, argv_t* argv[]) {
794803
No media have been explicitly selected; let's select the ones attached to
795804
that variant stream.
796805
*/
797-
if (selected_medias.offset == 0 && !disable_autoselect) {
806+
if (selected_medias.offset == 0 && !disable_autoselection) {
798807
const size_t offset = selected_streams.offset;
799808

800809
for (index = 0; index < offset; index++) {

src/program_help.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file is auto-generated. Use the ../tools/program_help.h.py tool to regenera
66
#define PROGRAM_HELP_H
77

88
#define PROGRAM_HELP \
9-
"usage: kai [-h] [-v] -u URL [-k] [-A USER_AGENT] [-x URI] [--doh-url URL] [-e URL] [-r COUNT] [--debug] [-S] [--select-media MEDIA] [--select-stream VARIANT_STREAM] [-c CONCURRENCY] -o FILENAME\n" \
9+
"usage: kai [-h] [-v] -u URL [-k] [-A USER_AGENT] [-x URI] [--doh-url URL] [-e URL] [-r COUNT] [--debug] [-S] [--select-media MEDIA] [--select-stream VARIANT_STREAM] [--disable-autoselection] [-c CONCURRENCY] -o FILENAME\n" \
1010
"\n" \
1111
"A command-line utility to download contents from M3U8 playlists.\n" \
1212
"\n" \
@@ -28,6 +28,8 @@ This file is auto-generated. Use the ../tools/program_help.h.py tool to regenera
2828
" --select-media MEDIA Select which media stream to download. By default, no additional media streams are downloaded.\n" \
2929
" --select-stream VARIANT_STREAM\n" \
3030
" Select which variant stream to download. Defaults to the variant stream with the highest bandwidth (bits per second).\n" \
31+
" --disable-autoselection\n" \
32+
" Avoid autoselection of streams based on predefined preferences set by the master playlist.\n" \
3133
" -c CONCURRENCY, --concurrency CONCURRENCY\n" \
3234
" Specify how many media segments should be downloaded simultaneously. Defaults to 1.\n" \
3335
" -o FILENAME, --output FILENAME\n" \

0 commit comments

Comments
 (0)