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 From 447005142a254516ad51f85efc023e2b9dc0e92c Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 11 Apr 2024 16:22:25 +0300 Subject: [fix] yeetube-play: Use 2nd argument only when yeetube-mpv-modeline - Pass information for yeetube-mpv-modeline as a second argument only when it's enabled. This way it should not break current users configuration with different media players. We could write this differently to hardcode yeetube-mpv-play, but I would like to make it possible for others to make 3rd party media players to be used with yeetube & yeetube-mpv-modeline. --- yeetube-mpv.el | 7 ++++++- yeetube.el | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'yeetube.el') diff --git a/yeetube-mpv.el b/yeetube-mpv.el index 4bab5e9..2e8325a 100644 --- a/yeetube-mpv.el +++ b/yeetube-mpv.el @@ -93,6 +93,8 @@ Accepted values include: 1080, 720, 480, 360, 240, 144") (defun yeetube-mpv-play (input &optional info) "Start yeetube process to play INPUT using mpv. +INFO: Information to display with `yeetube-mpv-modeline-mode' + This function is not specific to just playing urls. Feel free to use to play local files." (let ((yeetube-mpv-path (executable-find "mpv"))) @@ -110,7 +112,10 @@ to play local files." (setf yeetube-mpv-currently-playing (format "[%s]" info)))) (define-minor-mode yeetube-mpv-modeline-mode - "Minor mode for showing currently playing information on the modeline." + "Minor mode for showing currently playing information on the modeline. + +To use this mode, you should set `yeetube-play-function' to +`yeetube-mpv-play'." :global t :group 'yeetube :lighter nil diff --git a/yeetube.el b/yeetube.el index 3eb5ad3..838cfc1 100644 --- a/yeetube.el +++ b/yeetube.el @@ -228,7 +228,8 @@ Keywords: (interactive) (let* ((video-url (yeetube-get-url)) (video-title (yeetube-get :title)) - (proc (funcall yeetube-play-function video-url (when yeetube-mpv-modeline-mode video-title)))) + (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) -- cgit v1.2.3 From 06f24b6f58ae7d67b5201084562bb0b9926bf9b2 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Thu, 11 Apr 2024 16:28:45 +0300 Subject: Version bump: 2.1.6 --- yeetube.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yeetube.el') diff --git a/yeetube.el b/yeetube.el index 838cfc1..8c49b83 100644 --- a/yeetube.el +++ b/yeetube.el @@ -5,7 +5,7 @@ ;; Author: Thanos Apollo ;; Keywords: extensions youtube videos ;; URL: https://thanosapollo.org/projects/yeetube/ -;; Version: 2.1.5 +;; Version: 2.1.6 ;; Package-Requires: ((emacs "27.2") (compat "29.1.4.2")) -- cgit v1.2.3