diff --git a/src/bin/invyt b/src/bin/invyt index 8895f1a..cba4b20 100755 --- a/src/bin/invyt +++ b/src/bin/invyt @@ -36,10 +36,25 @@ def main [ url: string } } -def "main download" [url: string] { - yt-dlp --embed-chapters --embed-metadata --embed-subs (parse_url $url) +def "main download" [url: string, --max-res(-m): string] { + match ($max_res | is-empty) { + true => { + yt-dlp --embed-chapters --embed-metadata --embed-subs (parse_url $url) + } + false => { + yt-dlp --embed-chapters --embed-metadata --embed-subs -f $'bestvideo[height<=($max_res)]+bestaudio' (parse_url $url) + } + } } -def "main dl" [url: string] { - yt-dlp --embed-chapters --embed-metadata --embed-subs (parse_url $url) +def "main dl" [url: string, --max-res(-m): string] { + match ($max_res | is-empty) { + true => { + yt-dlp --embed-chapters --embed-metadata --embed-subs (parse_url $url) + } + false => { + yt-dlp --embed-chapters --embed-metadata --embed-subs -f $'bestvideo[height<=($max_res)]+bestaudio' (parse_url $url) + } + } } +