From 4c2c71d1cc2b776ad812ef1a92be524cae74d628 Mon Sep 17 00:00:00 2001 From: Kartatz <105828205+Kartatz@users.noreply.github.com> Date: Thu, 6 Jun 2024 00:57:10 -0300 Subject: [PATCH] Update to GCC 14.1.0 --- src/m3u8download.c | 9 +++++++-- src/main.c | 10 ++++++++++ src/program_help.h | 4 +++- tools/program_help.h.py | 7 +++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/m3u8download.c b/src/m3u8download.c index 86a6c44..fd0d1be 100644 --- a/src/m3u8download.c +++ b/src/m3u8download.c @@ -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); @@ -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); + } } } diff --git a/src/main.c b/src/main.c index 13340e6..ee3c993 100644 --- a/src/main.c +++ b/src/main.c @@ -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; @@ -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; diff --git a/src/program_help.h b/src/program_help.h index f0eb4e5..555bd37 100644 --- a/src/program_help.h +++ b/src/program_help.h @@ -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" \ @@ -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" \ diff --git a/tools/program_help.h.py b/tools/program_help.h.py index fe09a8b..583dd8d 100644 --- a/tools/program_help.h.py +++ b/tools/program_help.h.py @@ -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",