fix dl while loop, add some params

This commit is contained in:
talon 2023-06-18 21:50:25 -06:00 committed by secretspecter
parent 0b100f23ac
commit bbb7487c60

16
dl.ps1
View file

@ -1,18 +1,22 @@
param(
$url = "",
$out = "~/Videos/Downloads/",
$namepattern = "%(title)s.%(ext)s"
[string]$url = "",
[validatescript({ Test-Path $_ -PathType Container })]
[system.io.fileinfo]$out = "~/Videos/Downloads/",
[string]$namepattern = "%(title)s",
[int]$wait = 60 * 10
)
$ytdlp_options = "--live-from-start --wait-for-video 3600 --sponsorblock-remove all --output $out$namepattern $url"
$ytdlp_options = "--live-from-start --sponsorblock-remove all"
$ytdlp_options += " --wait-for-video $wait"
$ytdlp_options += " --output $out$namepattern.%(ext)s"
if ($url) {
Start-Process yt-dlp -ArgumentList $ytdlp_options
Start-Process yt-dlp -ArgumentList "$ytdlp_options $url"
}
else {
while ($true) {
$url = Read-host URL
if (!$url) { break }
Start-Process yt-dlp -ArgumentList $ytdlp_options
Start-Process yt-dlp -ArgumentList "$ytdlp_options $url"
}
}