Add retry parameter to dl alias
This commit is contained in:
parent
8dfaabfef0
commit
5ba9060e08
2 changed files with 61 additions and 24 deletions
|
|
@ -22,17 +22,17 @@
|
||||||
interval = "*-*-* 08:00:00";
|
interval = "*-*-* 08:00:00";
|
||||||
randomDelay = "1h";
|
randomDelay = "1h";
|
||||||
commands = [
|
commands = [
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@KitbogaShow/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@KitbogaShow/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@JCS/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@JCS/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@Shane_McGillicuddy/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@Shane_McGillicuddy/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@Coffeezilla/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@Coffeezilla/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@Danny-Gonzalez/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@Danny-Gonzalez/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@rejectconvenience/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@rejectconvenience/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@StuffMadeHere/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@StuffMadeHere/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@AdamSomething/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@AdamSomething/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@_gerg/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@_gerg/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@Yeah_Jaron/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@Yeah_Jaron/videos'"
|
||||||
"dl-yt -n 3 'https://www.youtube.com/@WolfgangsChannel/videos'"
|
"dl-yt -n 3 -r 1 'https://www.youtube.com/@WolfgangsChannel/videos'"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ in
|
||||||
# YouTube single video download
|
# YouTube single video download
|
||||||
download-youtube() {
|
download-youtube() {
|
||||||
local max_downloads=""
|
local max_downloads=""
|
||||||
|
local custom_retries=""
|
||||||
local url=""
|
local url=""
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
|
|
@ -153,6 +154,10 @@ in
|
||||||
max_downloads="$2"
|
max_downloads="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-r|--retries)
|
||||||
|
custom_retries="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
url="$url $1"
|
url="$url $1"
|
||||||
shift
|
shift
|
||||||
|
|
@ -163,11 +168,15 @@ in
|
||||||
url="''${url## }" # Trim leading space
|
url="''${url## }" # Trim leading space
|
||||||
|
|
||||||
if [[ -z "$url" ]]; then
|
if [[ -z "$url" ]]; then
|
||||||
echo "Usage: dl-yt [-n|--max <number>] <url>"
|
echo "Usage: dl-yt [-n|--max <number>] [-r|--retries <number>] <url>"
|
||||||
echo " -n, --max <number> Limit number of videos to process (useful for channels/playlists)"
|
echo " -n, --max <number> Limit number of videos to process (useful for channels/playlists)"
|
||||||
|
echo " -r, --retries <number> Number of retry attempts (0 for no retries, default: 10)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Override MAX_RETRIES if specified
|
||||||
|
[[ -n "$custom_retries" ]] && local MAX_RETRIES="$custom_retries"
|
||||||
|
|
||||||
local cookies_file="$HOME/.config/yt-dlp/cookies-youtube.txt"
|
local cookies_file="$HOME/.config/yt-dlp/cookies-youtube.txt"
|
||||||
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
||||||
local output_template="$DOWNLOAD_DIR/YouTube/%(uploader|)s/%(upload_date>%Y%m%d|)s-%(title)s.%(ext)s"
|
local output_template="$DOWNLOAD_DIR/YouTube/%(uploader|)s/%(upload_date>%Y%m%d|)s-%(title)s.%(ext)s"
|
||||||
|
|
@ -200,6 +209,7 @@ in
|
||||||
# YouTube playlist download
|
# YouTube playlist download
|
||||||
download-youtube-playlist() {
|
download-youtube-playlist() {
|
||||||
local max_downloads=""
|
local max_downloads=""
|
||||||
|
local custom_retries=""
|
||||||
local url=""
|
local url=""
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
|
|
@ -209,6 +219,10 @@ in
|
||||||
max_downloads="$2"
|
max_downloads="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-r|--retries)
|
||||||
|
custom_retries="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
url="$url $1"
|
url="$url $1"
|
||||||
shift
|
shift
|
||||||
|
|
@ -219,11 +233,15 @@ in
|
||||||
url="''${url## }" # Trim leading space
|
url="''${url## }" # Trim leading space
|
||||||
|
|
||||||
if [[ -z "$url" ]]; then
|
if [[ -z "$url" ]]; then
|
||||||
echo "Usage: dl-yt-p [-n|--max <number>] <playlist-url>"
|
echo "Usage: dl-yt-p [-n|--max <number>] [-r|--retries <number>] <playlist-url>"
|
||||||
echo " -n, --max <number> Limit number of videos to download"
|
echo " -n, --max <number> Limit number of videos to download"
|
||||||
|
echo " -r, --retries <number> Number of retry attempts (0 for no retries, default: 10)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Override MAX_RETRIES if specified
|
||||||
|
[[ -n "$custom_retries" ]] && local MAX_RETRIES="$custom_retries"
|
||||||
|
|
||||||
local cookies_file="$HOME/.config/yt-dlp/cookies-youtube.txt"
|
local cookies_file="$HOME/.config/yt-dlp/cookies-youtube.txt"
|
||||||
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
||||||
local output_template="$DOWNLOAD_DIR/YouTube/%(uploader|)s-%(playlist|)s/%(playlist_index|)03d-%(title)s.%(ext)s"
|
local output_template="$DOWNLOAD_DIR/YouTube/%(uploader|)s-%(playlist|)s/%(playlist_index|)03d-%(title)s.%(ext)s"
|
||||||
|
|
@ -256,6 +274,7 @@ in
|
||||||
# Bilibili single video download
|
# Bilibili single video download
|
||||||
download-bilibili() {
|
download-bilibili() {
|
||||||
local max_downloads=""
|
local max_downloads=""
|
||||||
|
local custom_retries=""
|
||||||
local url=""
|
local url=""
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
|
|
@ -265,6 +284,10 @@ in
|
||||||
max_downloads="$2"
|
max_downloads="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-r|--retries)
|
||||||
|
custom_retries="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
url="$url $1"
|
url="$url $1"
|
||||||
shift
|
shift
|
||||||
|
|
@ -275,11 +298,15 @@ in
|
||||||
url="''${url## }" # Trim leading space
|
url="''${url## }" # Trim leading space
|
||||||
|
|
||||||
if [[ -z "$url" ]]; then
|
if [[ -z "$url" ]]; then
|
||||||
echo "Usage: dl-bili [-n|--max <number>] <url>"
|
echo "Usage: dl-bili [-n|--max <number>] [-r|--retries <number>] <url>"
|
||||||
echo " -n, --max <number> Limit number of videos to process (useful for channels/playlists)"
|
echo " -n, --max <number> Limit number of videos to process (useful for channels/playlists)"
|
||||||
|
echo " -r, --retries <number> Number of retry attempts (0 for no retries, default: 10)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Override MAX_RETRIES if specified
|
||||||
|
[[ -n "$custom_retries" ]] && local MAX_RETRIES="$custom_retries"
|
||||||
|
|
||||||
local cookies_file="$HOME/.config/yt-dlp/cookies-bilibili.txt"
|
local cookies_file="$HOME/.config/yt-dlp/cookies-bilibili.txt"
|
||||||
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
||||||
local output_template="$DOWNLOAD_DIR/Bilibili/%(uploader|)s/%(upload_date>%Y%m%d|)s-%(title)s.%(ext)s"
|
local output_template="$DOWNLOAD_DIR/Bilibili/%(uploader|)s/%(upload_date>%Y%m%d|)s-%(title)s.%(ext)s"
|
||||||
|
|
@ -312,6 +339,7 @@ in
|
||||||
# Bilibili playlist/collection download
|
# Bilibili playlist/collection download
|
||||||
download-bilibili-playlist() {
|
download-bilibili-playlist() {
|
||||||
local max_downloads=""
|
local max_downloads=""
|
||||||
|
local custom_retries=""
|
||||||
local url=""
|
local url=""
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
|
|
@ -321,6 +349,10 @@ in
|
||||||
max_downloads="$2"
|
max_downloads="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-r|--retries)
|
||||||
|
custom_retries="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
url="$url $1"
|
url="$url $1"
|
||||||
shift
|
shift
|
||||||
|
|
@ -331,11 +363,15 @@ in
|
||||||
url="''${url## }" # Trim leading space
|
url="''${url## }" # Trim leading space
|
||||||
|
|
||||||
if [[ -z "$url" ]]; then
|
if [[ -z "$url" ]]; then
|
||||||
echo "Usage: dl-bili-p [-n|--max <number>] <playlist-url>"
|
echo "Usage: dl-bili-p [-n|--max <number>] [-r|--retries <number>] <playlist-url>"
|
||||||
echo " -n, --max <number> Limit number of videos to download"
|
echo " -n, --max <number> Limit number of videos to download"
|
||||||
|
echo " -r, --retries <number> Number of retry attempts (0 for no retries, default: 10)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Override MAX_RETRIES if specified
|
||||||
|
[[ -n "$custom_retries" ]] && local MAX_RETRIES="$custom_retries"
|
||||||
|
|
||||||
local cookies_file="$HOME/.config/yt-dlp/cookies-bilibili.txt"
|
local cookies_file="$HOME/.config/yt-dlp/cookies-bilibili.txt"
|
||||||
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
local temp_cookies=$(_setup_temp_cookies "$cookies_file")
|
||||||
local output_template="$DOWNLOAD_DIR/Bilibili/%(uploader|)s-%(playlist|)s/%(playlist_index|)03d-%(title)s.%(ext)s"
|
local output_template="$DOWNLOAD_DIR/Bilibili/%(uploader|)s-%(playlist|)s/%(playlist_index|)03d-%(title)s.%(ext)s"
|
||||||
|
|
@ -371,15 +407,16 @@ in
|
||||||
Video Download Commands:
|
Video Download Commands:
|
||||||
|
|
||||||
YouTube:
|
YouTube:
|
||||||
dl-yt [-n <N>] <url> - Download single YouTube video
|
dl-yt [-n <N>] [-r <R>] <url> - Download single YouTube video
|
||||||
dl-yt-p [-n <N>] <url> - Download YouTube playlist
|
dl-yt-p [-n <N>] [-r <R>] <url> - Download YouTube playlist
|
||||||
|
|
||||||
Bilibili:
|
Bilibili:
|
||||||
dl-bili [-n <N>] <url> - Download single Bilibili video
|
dl-bili [-n <N>] [-r <R>] <url> - Download single Bilibili video
|
||||||
dl-bili-p [-n <N>] <url> - Download Bilibili playlist/collection
|
dl-bili-p [-n <N>] [-r <R>] <url> - Download Bilibili playlist/collection
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-n, --max <number> Limit number of videos to process/download
|
-n, --max <number> Limit number of videos to process/download
|
||||||
|
-r, --retries <number> Number of retry attempts (0 for no retries, default: 10)
|
||||||
|
|
||||||
Other commands:
|
Other commands:
|
||||||
dl-clear-archive - Clear download history (allows re-downloading)
|
dl-clear-archive - Clear download history (allows re-downloading)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue