coderholic / pyradio

Curses based internet radio player
www.coderholic.com/pyradio
MIT License
961 stars 129 forks source link

Headless mode #155

Closed danboid closed 2 years ago

danboid commented 2 years ago

I have got a TV box running Armbian that I'd like to turn into an internet radio device. pyradio is very close to being ideal for my purposes but it doesn't seem to have a headless mode yet, which is what I want so that I can use pyradio without having a display attached to my TV box and I'd be able to use it using a infrared remote, pushing buttons to trigger commands to control pyradio.

I'd like to see pyradio gain a new --headless option or similar that would not open the ncurses UI but instead start playing a random station in the background unless the user specifies a specific station. The only headless commands I think I'll need are start playing (random station), skip to random station, adjust volume and stop/quit.

s-n-g commented 2 years ago

Hi @danboid

So, here's the thing... pyradio just has to be in the foreground for it to function. If put in the background, playback just stops working

Furthermore, it is a tui application; not opening the ncurses UI is impossible, it would mean rewriting the whole thing from scratch...

Having said that, if you think you can run it in a terminal application or a virtual terminal (do you run X?), then we could talk about creating an interface of some kind to control it remotely.

I think I could make it listen to a socket, or read input from a file, or something, instead of wating for keyboard input, but not have it running in the background or without its tui

danboid commented 2 years ago

Aha! I thought there might be some such catch but not to worry, I'll easily be able to write want I want with mplayer and a few lines of shell script so feel free to close this if adding this feature is too much work which sounds like its the case. I was unable to find a ready made solution, pyradio was about the closest to fitting the bill but custom script time it is.

I'll update this ticket when I've created my simple headless streaming thing with a link to its repo.

s-n-g commented 2 years ago

ok then, I'll just close this one for now

Do post the solution you come up with and reopen the issue to have us all informed :)

danboid commented 2 years ago

I will let you know.

What is the largest, recently tested and up-to-date list of internet radio stations in txt/m3u/csv/ods whatever format that you know of? I noticed there is a large list in https://github.com/coderholic/pyradio/issues/39 but it's quite outdated and lots of its links are broken. As a last resort I can filter the working ones from that file if you don't know of a better source?

s-n-g commented 2 years ago

Yeah, that's the one I have as well... Quite outdated, but enough to experiment with... Sorry I cannot be of any more help...

s-n-g commented 2 years ago

So silly of me! You can also use this:

curl -L http://de1.api.radio-browser.info/json/stations | json_reformat |less

or this to get the json data in a file

curl -L http://de1.api.radio-browser.info/json/stations > radiobrowser.json

Then you can parse the file (tell me if you need help to do that)

danboid commented 2 years ago

@s-n-g

I've 'finished' my project:

https://github.com/danboid/TVBIRR