karthink / elfeed-tube

Youtube integration for Elfeed, the feed reader for Emacs
The Unlicense
249 stars 11 forks source link

How do I use elfeed as usual? #15

Closed sethidden closed 1 year ago

sethidden commented 1 year ago

Intro

Hello. I'm very sorry for this tiny meta-issue, but I was wondering how do people normally use this package?

The README mentions (https://github.com/karthink/elfeed-tube#step-ii-use-elfeed-as-usual) "use elfeed as usual", but I'm not sure if I'm using it as intended, or perhaps my config makes certain features work improperly

How I elfeed-tube (probably improper)

Anyways, here's how I use elfeed-tube:

  1. M-x elfeed (I use evil-collection)
  2. Move in the *elfeed-search* buffer to some RSS entry that interests me (but don't press enter - just move the cursor to it)
  3. M-x elfeed-tube-mpv-follow-mode - this results in "this only works in elfeed-entry" message
  4. Now that we've ran elfeed-tube-mpv-follow-mode, the M-x elfeed-tube-mpv command is available
  5. Press RET to enter some RSS entry's elfeed-entry buffer
  6. Run elfeed-tube-mpv, and mpv plays the video

It seems to me as if I'm doing something wrong. Running elfeed-tube-mpv-follow-mode just so elfeed-tube-mpv becomes available to run seems fishy

For some reason I always assumed that in *elfeed-search* buffer, if I press RET while on an entry, and that entry's link happens to be a video, elfeed-tube will open mpv automatically, and if not, it will open *elfeed-entry* for regular reading. I assume this package was designed with a different flow in mind

Ideal use case

  1. M-x elfeed to enter *elfeed-search*
  2. Pick some YT RSS feed entry then press RET to enter *elfeed-search* buffer
  3. M-x SomeMysteriousFunction to start mpv and play a video

Relevant config excerpts


  (use-package evil
    :straight t
    :init 
    (setq evil-want-integration t)
    (setq evil-want-keybinding nil)
    :config
    ;(evil-set-leader 'normal (kbd "SPC"))
    (evil-mode 1))

  (use-package evil-collection
    :straight t
    :after evil
    :config 
    (evil-collection-init))

  (use-package elfeed
    :straight t
    :init
    (setq elfeed-feeds
      '("https://www.youtube.com/feeds/videos.xml?channel_id=UClOGLGPOqlAiLmOvXW5lKbw" ; Mandalore Gaming
        "https://www.youtube.com/feeds/videos.xml?channel_id=UCsvn_Po0SmunchJYOWpOxMg")))
  (use-package elfeed-tube
  :straight t 
  :after elfeed
  :demand t
  :config
  (elfeed-tube-setup)

  :bind (:map elfeed-show-mode-map
     ("F" . elfeed-tube-fetch)
     ([remap save-buffer] . elfeed-tube-save)
     :map elfeed-search-mode-map
     ("F" . elfeed-tube-fetch)
     ([remap save-buffer] . elfeed-tube-save)))

(use-package elfeed-tube-mpv
  :straight t ;; or :straight t
  :bind (:map elfeed-show-mode-map
              ("C-c C-f" . elfeed-tube-mpv-follow-mode)
              ("C-c C-w" . elfeed-tube-mpv-where)))
karthink commented 1 year ago

@sethidden the main purpose of elfeed-tube is to present a textual interface to your Youtube subscriptions: when you open an elfeed entry from a youtube feed, you should see video metadata (duration, description, thumbnail) and transcripts when available.

So the "ideal use case" looks something like:

  1. M-x elfeed to enter *elfeed-search*
  2. Pick some YT RSS feed entry then press RET to enter *elfeed-entry* buffer
  3. You should now see the video description, transcript etc.

If things don't work this way, it's a bug, so please let me know. (Note that video descriptions haven't been available for a few weeks now, this is an issue with the Invidious API that I'm waiting on. Just added a workaround for video descriptions.)


mpv integration

For some reason I always assumed that in *elfeed-search* buffer, if I press RET while on an entry, and that entry's link happens to be a video, elfeed-tube will open mpv automatically, and if not, it will open *elfeed-entry* for regular reading. I assume this package was designed with a different flow in mind

If you just want to play the video associated with a youtube feed entry, you don't need the elfeed-tube-mpv command, mpv.el or even elfeed-tube, this package. The following is enough:

(defun elfeed-mpv-url ()
    "Visit the current entry in mpv."
    (interactive)
    (let ((browse-url-browser-function
           #'browse-url-mpv))
      (pcase major-mode
        ('elfeed-search-mode (elfeed-search-browse-url))
        ('elfeed-show-mode (elfeed-show-visit)))))

(defun browse-url-mpv (url &optional _)
  (start-process "mpv" nil "mpv"
                 (shell-quote-wildcard-pattern url)))

The bonus mpv features provided by elfeed-tube are primarily for making the transcripts "live", so that you can skip to the current video location in the elfeed entry, or seek in the video to the current cursor location in the transcript. If you are not interested in this feature you never need to call elfeed-tube-mpv or elfeed-tube-mpv-follow-mode.

  1. Now that we've ran elfeed-tube-mpv-follow-mode, the M-x elfeed-tube-mpv command is available

This is a bug! elfeed-tube-mpv should be autoloaded and always available, I just fixed it.

Thanks for raising this issue, I suspect the README needs to be more accessible. Let me know if you have more questions.

sethidden commented 1 year ago

the main purpose of elfeed-tube is to present a textual interface to your Youtube subscriptions Ah, that clears it up :) I was confused as to what is meant to do what.

I used the snippet you've provided and it's working perfectly

Since you cleared up all my doubts, I'll close the issue :)