xenodium / ready-player

GNU General Public License v3.0
119 stars 5 forks source link

Feature request: Play-on-select, open in existing buffer #9

Closed claytharrison closed 1 month ago

claytharrison commented 1 month ago

Ready Player is really nice - I livecode music in Emacs and I can see it being really handy for flipping through sample banks. Every other music player for emacs seems to care a lot about playlists and metadata but all I care about is launching tracks from dired.

To that end, it would be great if there were some options to 1) play media as soon as I select it from dired/whatever, 2) reuse an existing buffer it already exists, and 3) not move focus to the ready-player buffer when selecting a track from outside it. I see myself scrolling through dired playing short samples one at a time to find which ones I like and marking them for moving into a "Favorites" folder. Ideally I press RET to play the track and then can just quickly move down to the next and press RET to stop the current track and start the new one.

Of course it would be easy to use open-with to just get mpv to play the tracks outside of Emacs, but I love that ready-player just keeps everything within the Emacs instance.

xenodium commented 1 month ago

Ready Player is really nice

Thanks. Nice to hear it!

I livecode music in Emacs

Cool! Can I watch/hear it somewhere?

1) play media as soon as I select it from dired/whatever

Yep. This one's straightforward. I'll add it soon.

2) reuse an existing buffer it already exists

This one needs more work. I ran into some issue last time I gave it a quick try. I'll revisit.

I press RET to play the track and then can just quickly move down to the next and press RET to stop the current track and start the new one.

This one needs changes to your dired config/binding. I think the default o binding almost gets what you want (opening in another buffer), but you lose focus. You could rebind o to something like:

(defun dired-find-file-other-window-no-switch ()
  "In Dired, visit this file or directory in another window and keep focus."
  (interactive)
  (save-selected-window
    (dired-find-file-other-window)))

I love that ready-player just keeps everything within the Emacs instance.

Nice to hear. I didn't find anything like it, so hey... gave it a try.

ps. Curious, what OS are you using it on?

claytharrison commented 1 month ago

Cool! Can I watch/hear it somewhere?

Sure, we've only got one thing up on youtube so far but more should be coming quite soon if you enjoy this kind of thing: https://www.youtube.com/watch?v=ExSPJZQvBec

You could rebind o to something like

Ah yes that does the trick, thanks! Just need the autoplay and something to kill any currently-playing track when a new one is opened and everything should work fine.

I also started messing around with Doom's popup module to get media buffers to open as popups instead of full windows, since that framework also contains an option for where to keep focus. I got it to work with a .wav buffer from ready-player once but can't reproduce it for some reason. If I can get that working (along with the other things mentioned) this would actually be the ideal interface for my own personal tastes.

Curious, what OS are you using it on?

Just Linux, Pop!_OS 22.04

xenodium commented 1 month ago

more should be coming quite soon if you enjoy this kind of thing

Yeah sure!

Just need the autoplay and something to kill any currently-playing track when a new one is opened and everything should work fine.

Ok, I think I got everything going in the latest. Take it for a spin and see if that works.

There's a new setting ready-player-autoplay also shown in a toggable button. Single-buffer mode is now the default (can be overriden with ready-player-multi-buffer).

This one needs changes to your dired config/binding.

(defun dired-find-file-other-window-no-switch () "In Dired, visit this file or directory in another window and keep focus." (interactive) (save-selected-window (dired-find-file-other-window)))(defun dired-find-file-other-window-no-switch () "In Dired, visit this file or directory in another window and keep focus." (interactive) (save-selected-window (dired-find-file-other-window)))

Actually, peep dired seems to work pretty nicely for this: https://github.com/asok/peep-dired. I forgot I had it bound to P. C-n and C-p do what you'd expect.

2024-07-16-13:01:40-Emacs

xenodium commented 1 month ago

I discovered dired-preview today. May be a better alternative to peep-dired https://github.com/protesilaos/dired-preview

You can see it in use at https://indieweb.social/@xenodium/112796504897011874

xenodium commented 1 month ago

Closing. If not mistaken, all requests here are now implemented in the latest. Please reopen if otherwise.

claytharrison commented 1 month ago

Just finally got around to testing this out yesterday, it all works great. Thanks again!

xenodium commented 1 month ago

Great to hear!