PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 321 forks source link

Feature Request - Caching songs for unreliable connections? #695

Closed ijustlovemath closed 4 months ago

ijustlovemath commented 4 years ago

Subject of the issue

I live in a rural area with spotty internet, and recently thought it might be a fun project to create a local database (simple filesystem backed one, or SQLite blobs for more complexity) for caching songs played by pianobar, maybe 50 or 100 or some customizable number for each station.

The way I imagine it working is:

Does this sound like a feature you might consider pulling in, if I developed it? I'm looking for a personal project right now, and I've used this program every day for 5+ years, so I figure it's a small way to give back.

If not, would it be because of technical reasons? Project vision differences? Pandora EULA violations?

Lemme know what you think!

Your environment

Steps to reproduce

not relevant

Expected behaviour

Not relevant

Actual behaviour

Not relevant

PromyLOPh commented 4 years ago

I don’t like the way pianobar currently handles playback all by itself. It’s just a huge mess of threads, queues and mutex locks and – as you’ve noticed – still does not work for everyone.

My idea was to completely move playback to an external process like mpv, mpd, … pianobar would spawn a wrapper, which receives the playback URL (maybe artist and title as well). That command would then communicate with mpv via mpv’s RPC and send pianobar status information (mainly track total/elapsed time). And pianobar would forward play, pause and skip commands, which would be sent to mpv.

Caching would nicely fit into that, although I would not enable it by default. Are you up for that?

As a side-note: You can already increase the in-memory audio buffer via the config option buffer_seconds = 100000.

ijustlovemath commented 4 years ago

So I take it that would involve proper bindings to the underlying mpv library. Sounds like it might possibly be a huge project to take on as far as testing + regressions go, but I can look into it and comment back!

Does buffer_seconds allow you to buffer multiple songs?

PromyLOPh commented 4 years ago

No, not the library and mpv was just an example. I meant that you literally run mpv <stream url> and then control the process through its RPC. The same can probably done with mplayer, mpd and many more. But I’d do this outside of pianobar (i.e. a wrapper), so people can plug in their favorite music player easily without touching pianobar itself.

edit: No buffer_seconds only applies to the current song.