minor
This commit is contained in:
parent
102af8e078
commit
f320d1d494
2 changed files with 17 additions and 2 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
programs.yt-dlp-custom = {
|
programs.yt-dlp-custom = {
|
||||||
enable = true;
|
enable = true;
|
||||||
downloadDir = "/home/yanlin/Downloads";
|
downloadDir = "/home/yanlin/Media";
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,15 +204,17 @@ description=$description
|
||||||
ABSMETA
|
ABSMETA
|
||||||
|
|
||||||
local thumb_file=""
|
local thumb_file=""
|
||||||
|
local thumb_ext=""
|
||||||
for ext in jpg webp png; do
|
for ext in jpg webp png; do
|
||||||
if [[ -f "$dir/$name_noext.$ext" ]]; then
|
if [[ -f "$dir/$name_noext.$ext" ]]; then
|
||||||
thumb_file="$dir/$name_noext.$ext"
|
thumb_file="$dir/$name_noext.$ext"
|
||||||
|
thumb_ext="$ext"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$thumb_file" ]]; then
|
if [[ -n "$thumb_file" ]]; then
|
||||||
mv "$thumb_file" "$dir/cover.jpg" 2>/dev/null
|
mv "$thumb_file" "$dir/cover.$thumb_ext" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,11 +229,16 @@ ABSMETA
|
||||||
local days_filter=""
|
local days_filter=""
|
||||||
local audio_only=false
|
local audio_only=false
|
||||||
local max_resolution=""
|
local max_resolution=""
|
||||||
|
local custom_download_dir=""
|
||||||
local url=""
|
local url=""
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-d|--dir)
|
||||||
|
custom_download_dir="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-n|--count)
|
-n|--count)
|
||||||
max_downloads="$2"
|
max_downloads="$2"
|
||||||
shift 2
|
shift 2
|
||||||
|
|
@ -285,6 +292,7 @@ ABSMETA
|
||||||
echo " youtube|bilibili Platform to download from"
|
echo " youtube|bilibili Platform to download from"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
|
echo " -d, --dir <path> Override download directory"
|
||||||
echo " -n, --count <number> Limit number of videos to process/download"
|
echo " -n, --count <number> Limit number of videos to process/download"
|
||||||
echo " -r, --retries <number> Number of retry attempts (0 for no retries, default: 10)"
|
echo " -r, --retries <number> Number of retry attempts (0 for no retries, default: 10)"
|
||||||
echo " --min <minutes> Minimum video duration in minutes"
|
echo " --min <minutes> Minimum video duration in minutes"
|
||||||
|
|
@ -302,12 +310,19 @@ ABSMETA
|
||||||
echo " dlv bilibili -n 10 <url> - Download first 10 videos"
|
echo " dlv bilibili -n 10 <url> - Download first 10 videos"
|
||||||
echo " dlv youtube -a <url> - Download audio only"
|
echo " dlv youtube -a <url> - Download audio only"
|
||||||
echo " dlv youtube --res 720 <url> - Download max 720p video"
|
echo " dlv youtube --res 720 <url> - Download max 720p video"
|
||||||
|
echo " dlv youtube -d /mnt/media <url> - Download to custom directory"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Override MAX_RETRIES if specified
|
# Override MAX_RETRIES if specified
|
||||||
[[ -n "$custom_retries" ]] && local MAX_RETRIES="$custom_retries"
|
[[ -n "$custom_retries" ]] && local MAX_RETRIES="$custom_retries"
|
||||||
|
|
||||||
|
# Override download directory if specified
|
||||||
|
local DOWNLOAD_DIR="$DOWNLOAD_DIR"
|
||||||
|
if [[ -n "$custom_download_dir" ]]; then
|
||||||
|
DOWNLOAD_DIR="''${custom_download_dir/#\~/$HOME}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Platform-specific configuration
|
# Platform-specific configuration
|
||||||
local cookies_file platform_name platform_flags
|
local cookies_file platform_name platform_flags
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue