From 28982277941c0be70df8e6e8e5c9f3ee4b69600a Mon Sep 17 00:00:00 2001 From: mlvzk Date: Tue, 2 Jul 2019 22:30:52 +0200 Subject: [PATCH] youtube: add quality=low|high aliases --- service/youtube/youtube.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/service/youtube/youtube.go b/service/youtube/youtube.go index 21c9166..753e3bb 100644 --- a/service/youtube/youtube.go +++ b/service/youtube/youtube.go @@ -148,16 +148,17 @@ func (s Youtube) Download(meta, options map[string]string) (io.Reader, error) { videoFormat ytdl.Format videoFormatFound bool ) - if quality == "best" { + switch quality { + case "worst", "low": + videoFormat, videoFormatFound = findWorstVideo(formats) + case "best", "high": videoFormat, videoFormatFound = findBestVideo(formats) - } else if quality == "medium" { + default: videoFormat, videoFormatFound = findMediumVideo(formats) if !videoFormatFound { // fallback to best if medium not found videoFormat, videoFormatFound = findBestVideo(formats) } - } else { - videoFormat, videoFormatFound = findWorstVideo(formats) } if !audioFormatFound || !videoFormatFound {