summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2025-01-17 06:41:02 +0200
committerThanos Apollo <[email protected]>2025-01-17 06:41:02 +0200
commit69a2d1588cc5f3fd09a93f69d80c97248b522c1c (patch)
treed6bb4ced48e796d8281d68e2c5cbe72dca53d204
parentb8877e61b58dfabcc30044680d0975b3c6b12052 (diff)
[fix] play: Play entry when point at thumbnail.HEADmaster
* Adjust yeetube-play to get the id when point is at thumbnail.
-rw-r--r--yeetube.el23
1 files changed, 13 insertions, 10 deletions
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 ()