Use raspdio to listen to web radio stations, while recording/dumping the same1 stream for later use. Control it via http interface. It runs on my Raspberry Pi/raspbian (hence the name), but should run on any *nix that can satisfy the dependencies (porting wouldn't be hard either).
1 only one connection is made. It saves your and the station's bandwith. This was the one of the original motivations for this project.
As I do this in my freest of time, it works, but barely works at the moment. This is my first github project, too. While I normally would not release a project at a stage that ugly, I'm using it to get into git and -hub. It's really super ugly.
- Good old mplayer does the streaming and playback.
- Interface written in pretty basic (< 5) PHP.
- It needs *nixy PHP stuff, like
posix_mkfifo
(and support for FIFOs, of course). - *nixy (or POSIXy?) stuff like
kill
,ps
,tee
. - ts
- ALSA for volume control (
amixer
shell call) - bash to wrap up the piping.
- I run it on lighttpd with PHP-CGI.
- Set up a site in your httpd.
- There's basically two files:
index.php
is the app,stations.php
has your stations; edit it.
- Two directories, make them writable for the httpd's user
dump
for the dumps, (I symlinked this to another parition)fifos
where the app creates some fifos needed for piping business.
- Point your browser to wherever you installed raspdio.
- In the stations overview, click on start. As soon the cache is full enough, you should hear something.
- You can stop playback there, too. Starting a different station will stop the current station, too.
- At the top, there's a volume control bar (measured in dBs, really superugly ATM).
- Debug info is all over the place.
- There's a playlist at the bottom (provided your station sends info), with links to search the song on Google or YouTube.
- All playback is dumped automatically (like some DVRs do) into your dump folder, filenames are formatted
Y-m-d_H-i-s.station.extension
, e.g.2013-03-20_07-42-05.wfmu.mp3
There's the mp3, obviously, and a .txt file with the timestamped playlist. - The
latest.*
symlinks point to the latest dump's files. - All dumps older than 24h are garbage-collected/removed upon (any) station start.
- When I want to save a song, I open the
latest.mp3
from the cifs-mounted1 dumps directory in mp3splt-gtk2, set the split-points3, set the file name4 and save it!
1 Via fstab/cifs-utils. smb://
in KDE copies the whole file to /tmp
, .gvfs
has serious problems in Ubuntu 12. SSHFS is ok, too, but the Raspi seems to struggle with the encryption overhead.
2 No re-encoding!
3 Manually, which can be a drag, but mp3splt handles it quite well. Automatic splitpoints from playlist roadmapped.
4 Automatic file name roadmapped as well.
I'm not sure how legal dumping is. In your country. I buy music; I use the dumps solely for future reference, to remember for future purchase (or concert visit) and usually for obscure stuff that is impossible to find.
- Simultaneous playback/dumping is done by
mplayer -streamdump
ing into a named pipe which is thentee
d into a file and another mplayer process - Raspdio scans your processes for the mplayer process and matches its args to find the pid
- which is used for stopping by
kill
ing the streamdumping mplayer process. Playback continues for a while until the cache of the playback process is empty. - Don't worry about the two playback processes, one handles the caching.
A whole lot.
- Comment the source :)
- Nicer interface. Way nicer.
- Better volume control
- Playlist interface
- Possibility to bookmark songs
- Handle pls/m3u instead of direct links, which may change.
- Better “splitability”
- Automatic cue/split files
- with automatic artist/title info
- DVR/cron functionality
Don't be stupid, support artists and radio stations. Otherwise free. Attribution and feedback welcome, though.