RPD is a fork from FMD that aims to provide more advanced features
- Support for a wide variety of audio formats
- Multi-threaded music streaming
- Support for natural language music search engine Jing.fm in addition to the popular Douban.fm
- Automatic music download/tagging for liked songs
- More commands, including changing bitrates on the fly
- Playing local songs via [local channel](#local channel)
RPD uses a TCP server-client model similar to that in FMD and MPD:
- you run
rpd
to launch the radio daemon that listens on a specific port - then in any terminal you can use
rpc
to access and control the daemon you just now launched
ffmpeg
for music decodinglibao
for music playinglibcurl
for api calls and music downloadingjson-c
for json parsingopenssl
for validating downloaded songs using sha256- mutagen-CLI for manipulating music ID3 tags
- clone the repo somewhere
cd
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 to128
and192
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- if
<channel
is999
, use the local music channel - if
<channel>
is an integer, than use the corresponding channel from Douban.fm - otherwise search for
<channel>
on Jing.fm- e.g.,
setch Adele
starts playing music from Adele - there are also some special channels for Jing.fm
#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)
- e.g.,
- if
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 exit
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>
.
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.
- RPC: RPD client
- rpclrc: lyrics display
- RPD-Alfred: Alfred extension interfacing RPC