From c443a9146b70f0b9697e2ee68356ac79a19bd81e Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 6 Apr 2024 20:43:31 +0300 Subject: yeetube: Add support for yeetube-modeline-mode --- yeetube.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'yeetube.el') diff --git a/yeetube.el b/yeetube.el index c4a977f..3eb5ad3 100644 --- a/yeetube.el +++ b/yeetube.el @@ -228,7 +228,7 @@ Keywords: (interactive) (let* ((video-url (yeetube-get-url)) (video-title (yeetube-get :title)) - (proc (funcall yeetube-play-function video-url))) + (proc (funcall yeetube-play-function video-url (when yeetube-mpv-modeline-mode video-title)))) (when (processp proc) (process-put proc :now-playing video-title)) (push (list :url video-url :title video-title) yeetube-history) @@ -243,8 +243,9 @@ Select entry title from `yeetube-history' and play corresponding URL." (let* ((titles (mapcar (lambda (entry) (cl-getf entry :title)) yeetube-history)) (selected (completing-read "Replay: " titles)) (selected-entry (cl-find-if (lambda (entry) (string= selected (cl-getf entry :title))) yeetube-history)) + (title (cl-getf selected-entry :title)) (url (cl-getf selected-entry :url))) - (funcall yeetube-play-function url) + (funcall yeetube-play-function url (when yeetube-mpv-modeline-mode title)) (message "Replaying: %s" selected))) (defun yeetube-load-saved-videos () @@ -274,11 +275,14 @@ Select entry title from `yeetube-history' and play corresponding URL." "Select & Play a saved video." (interactive) (yeetube-load-saved-videos) - (let ((video (completing-read "Select video: " yeetube-saved-videos nil t))) - (funcall yeetube-play-function (cdr (assoc video yeetube-saved-videos))) + (let* ((video (completing-read "Select video: " yeetube-saved-videos nil t)) + (url (cdr (assoc video yeetube-saved-videos))) + (title (car (assoc video yeetube-saved-videos)))) + (funcall yeetube-play-function url (when yeetube-mpv-modeline-mode title)) (message "Playing: %s" (car (assoc video yeetube-saved-videos))))) ;;;###autoload + (defun yeetube-remove-saved-video () "Select video to remove from saved videos." (interactive) @@ -658,12 +662,12 @@ A and B are vectors." "Yeetube mode." :keymap yeetube-mode-map (setf tabulated-list-format - [("Title" 60 t) + [("Title" 50 t) ("Views" 11 yeetube--sort-views) ("Duration" 9 yeetube--sort-duration) ("Date" 13 yeetube--sort-date) ("Channel" 12 t) - ("Thumbnail" 0 nil)] + ("Thumbnail" 20 nil)] tabulated-list-entries (cl-map 'list (lambda (content) @@ -674,7 +678,7 @@ A and B are vectors." :duration 'yeetube-face-duration :date 'yeetube-face-date :channel 'yeetube-face-channel - :image nil))) + :image nil))) yeetube-content) tabulated-list-sort-key (cons yeetube-default-sort-column yeetube-default-sort-ascending)) -- cgit v1.2.3