From 69a2d1588cc5f3fd09a93f69d80c97248b522c1c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Fri, 17 Jan 2025 06:41:02 +0200 Subject: [fix] play: Play entry when point at thumbnail. * Adjust yeetube-play to get the id when point is at thumbnail. --- yeetube.el | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'yeetube.el') diff --git a/yeetube.el b/yeetube.el index 62f2b9a..c47d886 100644 --- a/yeetube.el +++ b/yeetube.el @@ -210,16 +210,19 @@ videos from.") (defun yeetube-play () "Play video at point in *yeetube* buffer." (interactive) - (let* ((id (tabulated-list-get-id)) - (entry-content (cadr (assoc id yeetube-content))) - (video-url (yeetube-get-url id)) - (video-title (aref entry-content (if yeetube-display-thumbnails-p 1 0))) - (proc (apply yeetube-play-function video-url - (when yeetube-mpv-modeline-mode (list video-title))))) - (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))) + (save-excursion + ;; When point is on thumbnail, id will be nil. + (and (null (tabulated-list-get-id)) (end-of-line)) + (let* ((id (tabulated-list-get-id)) + (entry-content (cadr (assoc id yeetube-content))) + (video-url (yeetube-get-url id)) + (video-title (aref entry-content (if yeetube-display-thumbnails-p 1 0))) + (proc (apply yeetube-play-function video-url + (when yeetube-mpv-modeline-mode (list video-title))))) + (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)))) ;;;###autoload (defun yeetube-replay () -- cgit v1.2.3