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( param(
$url = "", [string]$url = "",
$out = "~/Videos/Downloads/", [validatescript({ Test-Path $_ -PathType Container })]
$namepattern = "%(title)s.%(ext)s" [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) { if ($url) {
Start-Process yt-dlp -ArgumentList $ytdlp_options Start-Process yt-dlp -ArgumentList "$ytdlp_options $url"
} }
else { else {
while ($true) { while ($true) {
$url = Read-host URL $url = Read-host URL
if (!$url) { break } if (!$url) { break }
Start-Process yt-dlp -ArgumentList $ytdlp_options Start-Process yt-dlp -ArgumentList "$ytdlp_options $url"
} }
} }