summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yeetube-mpv.el24
-rw-r--r--yeetube.el9
2 files changed, 25 insertions, 8 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el
index 2c925a4..04f684a 100644
--- a/yeetube-mpv.el
+++ b/yeetube-mpv.el
@@ -32,20 +32,34 @@
:group 'yeetube)
(defcustom yeetube-mpv-enable-torsocks nil
- "Enable torsocks.")
+ "Enable torsocks."
+ :type 'boolean
+ :group 'yeetube)
+
+(defcustom yeetube-mpv-show-status nil
+ "Show mpv status in mode-line."
+ :type 'boolean
+ :group 'yeetube)
+
+(setf (alist-get 'yeetube-mpv-show-status mode-line-misc-info nil t)
+ '(("" yeetube-mpv-status)))
-(defvar yeetube-mpv-path (executable-find "mpv")
- "Path for mpv executable.")
+(defvar yeetube-mpv-command '("mpv" "--no-msg-color" "--term-status-msg=${?=audio==1:A}${?=video==1:V} ${?=pause==yes:Paused}${?=pause==no:Playing} (${percent-pos}%)")
+ "Cons of mpv command and list of args passed to it.")
(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")
+(defvar yeetube-mpv-status nil
+ "Contains a brief status of the mpv process.")
+(put 'yeetube-mpv-status 'risky-local-variable t)
+
(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)))
diff --git a/yeetube.el b/yeetube.el
index bb51a25..1b7bd34 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -210,9 +210,11 @@ Keywords:
(defun yeetube-play ()
"Play video at point in *yeetube* buffer."
(interactive)
- (let ((video-url (yeetube-get-url))
- (video-title (yeetube-get :title)))
- (funcall yeetube-play-function video-url)
+ (let* ((video-url (yeetube-get-url))
+ (video-title (yeetube-get :title))
+ (proc (funcall yeetube-play-function video-url)))
+ (when (processp proc)
+ (process-put proc :now-playing video-title))
(push (list :url video-url :title video-title) yeetube-history)
(message "Playing: %s" video-title)))
@@ -651,6 +653,7 @@ A and B are vectors."
yeetube-content)
tabulated-list-sort-key (cons yeetube-default-sort-column
yeetube-default-sort-ascending))
+ (setq-local yeetube-mpv-show-status t)
(display-line-numbers-mode 0)
(tabulated-list-init-header)
(tabulated-list-print))