summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-10-15 12:46:49 +0300
committerThanos Apollo <[email protected]>2023-10-17 09:24:22 +0300
commit5f60251c567730b554f87374119b5fc2eef8c426 (patch)
tree17442120cc8b7472dc4410dd98aa665fed23ee4c
parentbf696e589431ebef3936c8f8764c501f2863d8a1 (diff)
yeetube:(play) push url & title to yeetube-history
- Keep track of played urls with video-titles by pushing them to yeetube-history.
-rw-r--r--yeetube.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/yeetube.el b/yeetube.el
index ecf3ba8..2769dff 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -105,16 +105,18 @@ You can change the value to an invidious instance.")
(defun yeetube-get-url ()
"Get video url."
- (let ((video-url (concat yeetube-url
- (yeetube-get :videoid))))
+ (let ((video-url (concat yeetube-url (yeetube-get :videoid))))
video-url))
;;;###autoload
(defun yeetube-play ()
"Play video at point in *yeetube* buffer."
(interactive)
- (funcall yeetube-player (yeetube-get-url))
- (message "Playing: %s" (yeetube-get :title)))
+ (let ((video-url (yeetube-get-url))
+ (video-title (yeetube-get :title)))
+ (funcall yeetube-player video-url)
+ (push (list :url video-url :title video-title) yeetube-history)
+ (message "Playing: %s" video-title)))
(defun yeetube-load-saved-videos ()
"Load saved videos."
@@ -226,12 +228,12 @@ then for item."
;; This should fix some of the common issues.
(defun yeetube---fix-title (title)
"Adjust TITLE."
- (mapc (lambda (replacement)
- (setf title (replace-regexp-in-string (car replacement) (cdr replacement) title)))
- yeetube--title-replacements)
- (if yeetube-buffer-display-emojis
- title
- (yeetube-buffer-strip-emojis title)))
+ (mapc (lambda (replacement)
+ (setf title (replace-regexp-in-string (car replacement) (cdr replacement) title)))
+ yeetube--title-replacements)
+ (if yeetube-buffer-display-emojis
+ title
+ (yeetube-buffer-strip-emojis title)))
(defun yeetube-get-content ()
"Get content from youtube."