From 518e1df27c0827e62a72e2f53a4915f5874bba2c Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Tue, 29 Oct 2024 12:52:29 +0100 Subject: [PATCH] Resolution limit --- src/bin/invyt | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) 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) + } + } } +