I am building a Alarm Clock Radio. One of its features is to be able to play internet radio stations.
I wasn't quite sure what features would be required in a streaming player. So, I wrote a python script to play the streams. I used with this for a while until it seemed to do everything I wanted. Eventually, I will add the commands in the python script to the Alarm Clock GUI.
Parts:
Raspberry Pi 3
HiBerry AMP2
1 or 2 Speakers
Step 1. Set up Raspberry Pi 3
For easy access from my laptop, I enabled the following:
OpenSSH
avahi-daemon
On-board Wi-Fi
Step 2. HiBerry AMP2
Step 3. Internet Radio Basics
Copy music files
Create directory /home/pi/radio
Create directory /home/pi/Stations/playlists
Step 4. Add several scripts to Raspberry Pi
cd to the /home/pi/radio directory and run the command:
$ sudo wget "https://raw.githubusercontent.com/dumbo25/Internet-Radio-Player/master/streamPlayer.py"
cd to /home/pi/Stations and run the commands:
$ sudo wget "https://raw.githubusercontent.com/dumbo25/Internet-Radio-Player/master/m3uCheck.py"
$ sudo wget "https://github.com/dumbo25/Internet-Radio-Player/blob/master/m3uGet.sh"
From /home/pi/Stations, run m3uGet.sh. You may need to make it executable. This will pull a bunch of streaming stations.
Next, run m3uCheck.py. Many of the stations from the above no longer work. Next, go through and listen to each station and decide if you want it to be in your list of stations. The scripts contain directions in the comments on how to mark a station.
Step 5. Here are my favorite stations
$ cd ~/.
$ cd Stations/playlists
$ wget https://raw.githubusercontent.com/dumbo25/Internet-Radio-Player/master/all_stations.m3u
Step 6. Check if it all works
To play internet stations, change to /home/pi/radio and run the stream player script using:
$ cd ~/.
$ cd radio
$ python3 streamPlayer.py
Common commands:
Copy file from Raspberry Pi 3 to laptop. Open a terminal window on MacBook laptop. Navigate to whatever directory you want to use as backup for the script and run the command:
$ scp pi@♣hostname♣.local:/home/pi/radio/streamPlayer.py .
References
IceCast: http://dir.xiph.org/by_genre/Pop
Internet Radio: https://www.internet-radio.com/