diff options
author | Thanos Apollo <[email protected]> | 2024-02-10 12:08:10 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-02-10 12:08:10 +0200 |
commit | bdb3d532308071cd912bfbf92963c9cabe79de7c (patch) | |
tree | b4e0abc717a5e32f6e265678f2cccc69dc9ea681 /yeetube-mpv.el | |
parent | 28b603bfc57788e25f8016a7771cedf372e5f3b5 (diff) | |
parent | 3172527a6a8f1297587cf1c90eaaf594b1009f68 (diff) |
Version 2.1.2 Release: Merge branch '2.1.2-dev'2.1.2
Diffstat (limited to 'yeetube-mpv.el')
-rw-r--r-- | yeetube-mpv.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el index 474b88f..2c925a4 100644 --- a/yeetube-mpv.el +++ b/yeetube-mpv.el @@ -40,6 +40,17 @@ (defvar yeetube-mpv-torsocks (executable-find "torsocks") "Path to torsocks executable.") +(defvar yeetube-mpv-video-quality "720" + "Video resolution/quality + +Accepted values include: 1080, 720, 480, 360, 240, 144") + +(defun yeetube-mpv-change-video-quality () + (interactive) + (let ((new-value (completing-read (format "Set video quality (current value %s):" yeetube-mpv-video-quality) + '("1080" "720" "480" "360" "240" "144") nil t))) + (setf yeetube-mpv-video-quality new-value))) + (defun yeetube-mpv-toggle-torsocks () "Toggle torsocks." (interactive) @@ -67,6 +78,10 @@ (start-process-shell-command "yeetube" nil command)))) +(defun yeetube-mpv-ytdl-format-video-quality (resolution) + "Return shell quoted argument for ytdlp with RESOLUTION." + (shell-quote-argument (format "bestvideo[height<=?%s]+bestaudio/best" resolution))) + (defun yeetube-mpv-play (input) "Start yeetube process to play INPUT using mpv. @@ -75,7 +90,9 @@ to play local files." (yeetube-mpv-process (concat (when yeetube-mpv-enable-torsocks (concat yeetube-mpv-torsocks " ")) - yeetube-mpv-path " " + yeetube-mpv-path " --ytdl-format=" + (yeetube-mpv-ytdl-format-video-quality yeetube-mpv-video-quality) + " " (shell-quote-argument input) (when yeetube-mpv-disable-video " --no-video"))) (message (if yeetube-mpv-enable-torsocks |