My own net-radio
Radio is a lovely contrast to Spotify. You get to hear new music with mixed content and not just the same playlist or music Spotify might think you like.
I have no radio. I don’t even know where I should put it – and I might as well admit, I will be too lazy to even use it.
Before I learnt Python (or at least got into it), I was fiddling around with a setup similar to this, however it didn’t run optimal.
I already have an PIR motion sensor in my kitchen where I normally listen to radio. The PIR sensor already turns on the screen to my magic-mirror dashboard and it also turns on the light if needed. So in time I need to connect the PIR sensor to the radio as well.
I often hear the same handful of radio stations. I listen to a local station in the morning with the news and music. In the afternoon I might here some more upbeat music, whereas in the evening a 3rd station will be used.
I know VLC can play streams from the command line. A quick googling shows there is a python VLC module.
My current thoughts about the project
- The radio needs to take into account the time of the day and play the correct station.
- It should not play constantly. Some logic needs to be made which uses the PIR sensor and stops the radio if there is no movement for x-minutes. Or perhaps gradually turn down the volume to 50%, then 25% and finally all the way down.
First things first. I need to create the radio player. I am thinking it should be controllable via the browser if I ever what to take manual control.
The idea is simple: Flask webserver, VLC’s python plugin, basic webpage and we are half the way.
I start with installing the environment, VLC and pip3 install python-vlc
This is the radio in a nutshell. Download it, play with it, make it better if you ever need a radio.
This is a screenshot of the radio - do the styling your self.

Download Radio app