aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube-mpv.el
diff options
context:
space:
mode:
Diffstat (limited to 'yeetube-mpv.el')
-rw-r--r--yeetube-mpv.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el
index f1655ff..474b88f 100644
--- a/yeetube-mpv.el
+++ b/yeetube-mpv.el
@@ -31,9 +31,24 @@
:type 'boolean
:group 'yeetube)
+(defcustom yeetube-mpv-enable-torsocks nil
+ "Enable torsocks.")
+
(defvar yeetube-mpv-path (executable-find "mpv")
"Path for mpv executable.")
+(defvar yeetube-mpv-torsocks (executable-find "torsocks")
+ "Path to torsocks executable.")
+
+(defun yeetube-mpv-toggle-torsocks ()
+ "Toggle torsocks."
+ (interactive)
+ (pcase yeetube-mpv-torsocks
+ ('t (setf yeetube-mpv-torsocks nil)
+ (message "yeetube: Torsocks disabled"))
+ ('nil (setf yeetube-mpv-torsocks t)
+ (message "yeetube: Torsocks enabled"))))
+
(defun yeetube-mpv-check ()
"Check if mpv and yt-dlp is installed."
(unless (and (executable-find "mpv")
@@ -58,10 +73,14 @@
This function is not specific to just playing urls. Feel free to use
to play local files."
(yeetube-mpv-process
- (concat yeetube-mpv-path " "
+ (concat (when yeetube-mpv-enable-torsocks
+ (concat yeetube-mpv-torsocks " "))
+ yeetube-mpv-path " "
(shell-quote-argument input)
(when yeetube-mpv-disable-video " --no-video")))
- (message "yeetube: starting mpv process"))
+ (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."