Skip to content

Commit

Permalink
Update to GCC 14.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartatz committed Jun 6, 2024
1 parent ab39526 commit 4c2c71d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/m3u8download.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ static int m3u8download_pollqeue(
}
}

(*options->progress_callback)(qeue->offset, current);
if (options->progress_callback != NULL) {
(*options->progress_callback)(qeue->offset, current);
}

while (running) {
CURLMcode mc = curl_multi_perform(curl_multi, &running);
Expand Down Expand Up @@ -387,7 +389,10 @@ static int m3u8download_pollqeue(
curl_multi_add_handle(curl_multi, msg->easy_handle);
} else {
current++;
(*options->progress_callback)(qeue->offset, current);

if (options->progress_callback != NULL) {
(*options->progress_callback)(qeue->offset, current);
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ int main(int argc, argv_t* argv[]) {
int insecure = 0;
int debug = 0;
int disable_autoselection = 0;
int disable_progress = 0;

int select_all_medias = 0;
int exists = 0;
Expand Down Expand Up @@ -610,6 +611,15 @@ int main(int argc, argv_t* argv[]) {
}

disable_autoselection = 1;
} else if (strcmp(argument->key, "disable-progress-meter") == 0) {
if (disable_progress) {
err = M3U8ERR_CLI_DUPLICATE_ARGUMENT;
goto end;
}

download_options.progress_callback = NULL;

disable_progress = 1;
} else {
err = M3U8ERR_CLI_ARGUMENT_INVALID;
goto end;
Expand Down
4 changes: 3 additions & 1 deletion src/program_help.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This file is auto-generated. Use the ../tools/program_help.h.py tool to regenera
#define PROGRAM_HELP_H

#define PROGRAM_HELP \
"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" \
"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] [--disable-progress-meter] [-c CONCURRENCY] -o FILENAME\n" \
"\n" \
"A command-line utility to download contents from M3U8 playlists.\n" \
"\n" \
Expand All @@ -30,6 +30,8 @@ This file is auto-generated. Use the ../tools/program_help.h.py tool to regenera
" Select which variant stream to download. Defaults to the variant stream with the highest bandwidth (bits per second).\n" \
" --disable-autoselection\n" \
" Avoid autoselection of streams based on predefined preferences set by the master playlist.\n" \
" --disable-progress-meter\n" \
" Disable showing download progress meter.\n" \
" -c CONCURRENCY, --concurrency CONCURRENCY\n" \
" Specify how many media segments should be downloaded simultaneously. Defaults to 1.\n" \
" -o FILENAME, --output FILENAME\n" \
Expand Down
7 changes: 7 additions & 0 deletions tools/program_help.h.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
help = "Avoid autoselection of streams based on predefined preferences set by the master playlist."
)

parser.add_argument(
"--disable-progress-meter",
required = False,
action = "store_true",
help = "Disable showing download progress meter."
)

parser.add_argument(
"-c",
"--concurrency",
Expand Down

0 comments on commit 4c2c71d

Please sign in to comment.