From 3c6913a6d4fb0d89f3b40ad552c533473d0271c0 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 1 Jun 2021 03:13:06 +0100 Subject: jao-mpc-add-url, for podcasts --- gnus.org | 22 +++++++++++----------- lib/media/jao-mpc.el | 5 +++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gnus.org b/gnus.org index 61ef7c5..a11bfa0 100644 --- a/gnus.org +++ b/gnus.org @@ -683,17 +683,17 @@ (defun jao-gnus-open-enclosure (&optional playp) (interactive "P") - (gnus-summary-select-article-buffer) - (save-excursion - (goto-char (point-min)) - (when (search-forward "Enclosure:") - (forward-char 2) - (when-let ((url (thing-at-point-url-at-point))) - (message "%s %s ..." (if playp "Playing" "Adding") url) - (if playp (emms-play-url url) (emms-add-url url)) - (when playp - (sit-for 1) - (jao-emms-echo)))))) + (save-window-excursion + (gnus-summary-select-article-buffer) + (save-excursion + (goto-char (point-min)) + (when (search-forward "Enclosure:") + (forward-char 2) + (when-let ((url (thing-at-point-url-at-point))) + (message "%s %s ..." (if playp "Playing" "Adding") url) + (when playp (jao-mpc-clear)) + (jao-mpc-add-url url) + (when playp (jao-mpc-play))))))) #+end_src * Keyboard shortcuts #+BEGIN_SRC emacs-lisp diff --git a/lib/media/jao-mpc.el b/lib/media/jao-mpc.el index 669883c..5f70f15 100644 --- a/lib/media/jao-mpc.el +++ b/lib/media/jao-mpc.el @@ -202,6 +202,11 @@ (interactive) (jao-notify (jao-mpc--current-str))) +;;;###autoload +(defun jao-mpc-add-url (url) + (interactive "sURL: ") + (jao-mpc--cmd (format "add %s" url))) + ;;;###autoload (defun jao-mpc-show-albums () "Show album list." -- cgit v1.2.3