PowerShell/Scripts/Stream-Video.ps1

24 lines
616 B
PowerShell

param(
[string]$url = "",
[string]$record = "~/Videos/Streamed/{title}.ts",
[int]$retryinterval = 30,
[string]$quality = "best",
[switch]$norecord
)
if ($url) {
if (-not (Get-Command "streamlink" -ErrorAction SilentlyContinue)) {
Write-Host "There's no streamlink to work with!"
exit
}
$streamlink_opts = "--default-stream $quality"
$streamlink_opts += " --retry-streams $retryinterval"
if ($record -and -not $norecord) {
$streamlink_opts += " --record $record"
}
Write-Host "streamlink $streamlink_opts $url"
Start-Process streamlink -ArgumentList "$streamlink_opts $url"
}