summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-10-16 15:14:40 +0300
committerThanos Apollo <[email protected]>2023-10-17 09:24:22 +0300
commitaf7eafc4c4d9106614d998ec553013431e68e749 (patch)
treef4e480a0c454ddf0e71597a5859fe7fc52edc5f2
parentf3196c8ecc11a425014358382811976ec5d68ce3 (diff)
yeetube:(feature) Add yeetube-replay
Replay history entry
-rw-r--r--yeetube.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/yeetube.el b/yeetube.el
index 7ca9729..74fa05b 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -128,6 +128,19 @@ Keywords:
(push (list :url video-url :title video-title) yeetube-history)
(message "Playing: %s" video-title)))
+;;;###autoload
+(defun yeetube-replay ()
+ "Select entry from history to replay.
+
+Select entry title from yeetube-history and play corresponding URL."
+ (interactive)
+ (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))
+ (url (cl-getf selected-entry :url)))
+ (funcall yeetube-player url)
+ (message "Replaying: %s" selected)))
+
(defun yeetube-load-saved-videos ()
"Load saved videos."
(let ((file-path (concat user-emacs-directory "yeetube")))