lingnand / RPD

Stream radio to command line with ease and comfort
rpd.lynnard.me
8 stars 2 forks source link

RPD (Radio Player Daemon)

RPD is a fork from FMD that aims to provide more advanced features

RPD uses a TCP server-client model similar to that in FMD and MPD:

Install

Dependencies

Steps

  1. clone the repo somewhere
  2. cd into the directory
  3. make

Note: you would almost certainly want to also install RPC to access and control the daemon. Follow the instruction there to finish installing rpc.

Configuration

By default, the configuration file resides in ~/.rpd/rpd.conf.

A template config file looks like this

[Radio]
channel = 999

[DoubanFM]
uid = <uid>
uname = <username>
token = <token>
expire = <expire>
kbps = 

[JingFM]
uid = <uid>
atoken = <atoken>
rtoken = <rtoken>

[Output]
driver = alsa
device = default

[Server]
address = 0.0.0.0
port = 10098

[Local]
music_dir = ~/Music
download_lyrics = 0

To simplify the process of obtaining the user ids and tokens for the two services, you should use the rpc-update-conf.sh included in the repository.

Make sure you set the usernames and passwords in the file, and then you can put something like this in your crontab to periodically update the configuration (since the tokens change from time to time)

0 0 */3 * * rpd-update-conf.sh > ~/.rpd/rpd.conf

Commands

To communicate with RPD, the client should make a TCP connection to the designated port in the configuration.

A client can make the following requests:

The response is in JSON format and normally contains all the information about the currently playing song.

Note: if you installed rpc as I recommended before, you can easily use these commands as rpc <command>.

Automatic music download

All played and liked songs will be saved to music_dir in artist/title.<ext> format.

The ID3 tags (for m4a, iTunes-style tags) will be saved along as well.

The cover image, when downloadable, will be downloaded and embedded into the song.

If you've turned on download_lyrics, and have installed lrcdown, then the lyrics will be downloaded as artist/title.lrc in the same directory.

Local channel

The local channel has the id 999. When switching to this channel, RPD retrieves all files of mimetype audio/* within the music_dir and shuffles them to make up its playlist.

Like

By default all music is liked. If you unrate a song, the action would be the same as ban.

Ban

The song will be removed from your disk. In addition, if it's enclosed in some directory that becomes empty, that directory is removed as well.

Related work