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:
rpd
to launch the radio daemon that listens on a specific portrpc
to access and control the daemon you just now launchedffmpeg
for music decodinglibao
for music playinglibcurl
for api calls and music downloadingjson-c
for json parsingopenssl
for validating downloaded songs using sha256cd
into the directorymake
Note: you would almost certainly want to also install RPC to access and control the daemon. Follow the instruction there to finish installing rpc
.
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
channel
under [Radio]
: determines the default channel on startup; 999
is the local music channelkbps
under [DoubanFM]
is only applicable for paid users (who have access to 128
and 192
bitrates); leave it blank if you are using the free service[Local]
music_dir
: where to store the downloaded songsdownload_lyrics
: change it to 1 if you wish to download lyrics automatically using lrcdown 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
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:
play
: start playingstop
: stop playingpause
: pause playingtoggle
: toggle between play and pauseskip
: skip to the next songrate
: like the songunrate
: unlike the songban
: dislike the songinfo
: get song informationsetch <channel>
: switch to the given radio channel
<channel
is 999
, use the local music channel<channel>
is an integer, than use the corresponding channel from Douban.fm<channel>
on Jing.fm
setch Adele
starts playing music from Adele#top
: the hottest music right now#rand
: this will start a random channel using a trending search term#psn
: this starts Jing's personal recommendation channel (making use of your like and dislike data)kbps <bitrate>
: on-the-fly switching of music qualitywebpage
: opens the douban music page for the current song using the browser specified in the shell variable $BROWSER
; if the page url is not available e.g. for Jing.fm channels, it will open the search page on douban musicend
: tell RPD to exitThe 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>
.
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.
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.
By default all music is liked
. If you unrate a song, the action would be the same as 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.