aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube-mpv.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-03-19 22:04:49 +0200
committerThanos Apollo <[email protected]>2024-03-19 22:04:49 +0200
commita1cfbb926052291ca23628fedaa58c315b9cdca8 (patch)
tree84d6f5582a64f4115d292170e1ba6a8fec6b1165 /yeetube-mpv.el
parent5fa23846a66e7a57c0b9bb9894227f4cce3ebe30 (diff)
parentbb38d60adcc12b002917fe7a141d74fe1945ae3f (diff)
Release version 2.1.5: Merge branch '2.1.5-dev'2.1.5
- Make thumbnail fetching async - Improve scraping funcs - Add playlist functionality - Add mpv commands for forward/backward
Diffstat (limited to 'yeetube-mpv.el')
-rw-r--r--yeetube-mpv.el52
1 files changed, 34 insertions, 18 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el
index 2c925a4..5070fd5 100644
--- a/yeetube-mpv.el
+++ b/yeetube-mpv.el
@@ -32,20 +32,19 @@
:group 'yeetube)
(defcustom yeetube-mpv-enable-torsocks nil
- "Enable torsocks.")
-
-(defvar yeetube-mpv-path (executable-find "mpv")
- "Path for mpv executable.")
+ "Enable torsocks."
+ :type 'boolean
+ :group 'yeetube)
(defvar yeetube-mpv-torsocks (executable-find "torsocks")
"Path to torsocks executable.")
(defvar yeetube-mpv-video-quality "720"
- "Video resolution/quality
-
+ "Video resolution/quality.
Accepted values include: 1080, 720, 480, 360, 240, 144")
(defun yeetube-mpv-change-video-quality ()
+ "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)))
@@ -87,17 +86,18 @@ Accepted values include: 1080, 720, 480, 360, 240, 144")
This function is not specific to just playing urls. Feel free to use
to play local files."
- (yeetube-mpv-process
- (concat (when yeetube-mpv-enable-torsocks
- (concat yeetube-mpv-torsocks " "))
- 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
- "yeetube: Starting mpv process (using torsocks)"
- "yeetube: Starting mpv process")))
+ (let ((yeetube-mpv-path (executable-find "mpv")))
+ (yeetube-mpv-process
+ (concat (when yeetube-mpv-enable-torsocks
+ (concat yeetube-mpv-torsocks " "))
+ 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
+ "yeetube: Starting mpv process (using torsocks)"
+ "yeetube: Starting mpv process"))))
(defun yeetube-mpv-toggle-no-video-flag ()
"Toggle no video flag for mpv player."
@@ -109,7 +109,7 @@ to play local files."
(message "yeetube: mpv disabled video")))
(defun yeetube-mpv-send-keypress (key)
- "Send KEY to yeetube-mpv-process."
+ "Send KEY to `yeetube-mpv-process'."
(interactive "sKey: ")
(process-send-string "yeetube" key))
@@ -131,5 +131,21 @@ to play local files."
(yeetube-mpv-send-keypress "_")
(message "yeetube: toggle video"))
+(defun yeetube-mpv-forward ()
+ "Forward video."
+ (interactive)
+ (yeetube-mpv-send-keypress ""))
+
+(defun yeetube-mpv-backward ()
+ "Go backwards in video."
+ (interactive)
+ (yeetube-mpv-send-keypress ""))
+
+(defun yeetube-mpv-quit ()
+ "Quit mpv."
+ (interactive)
+ (yeetube-mpv-send-keypress "q")
+ (message "yeetube: quit"))
+
(provide 'yeetube-mpv)
;;; yeetube-mpv.el ends here