diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000000..e69de29bb2 diff --git a/404.html b/404.html new file mode 100644 index 0000000000..fae31b60ed --- /dev/null +++ b/404.html @@ -0,0 +1 @@ +
To run multiple instances of owntone on a server, you should copy /etc/owntone.conf
to /etc/owntone-zone.conf
(for each zone
) and modify the following to be unique across all instances:
the three port settings (general
-> websocket_port
, library
-> port
, and mpd
-> port
)
the database paths (general
-> db_path
, db_backup_path
, and db_cache_path
)
the service name (library
-> name
).
you probably also want to disable local output (set audio
-> type = "disabled"
).
Then run owntone -c /etc/owntone-zone.conf
to run owntone with the new zone configuration.
Owntone has a systemd
template which lets you run this automatically on systems that use systemd. You can start or enable the service for a zone
by sudo systemctl start owntone@zone
and check that it is running with sudo systemctl status owntone@zone
. Use sudo systemctl enable ownton@zone
to get the service to start on reboot.
ALSA is one of the main output configuration options for local audio; when using ALSA you will typically let the system select the soundcard on your machine as the default
device/sound card - a mixer associated with the ALSA device is used for volume control. However if your machine has multiple sound cards and your system chooses the wrong playback device, you will need to manually select the card and mixer to complete the OwnTone configuration.
ALSA devices can be addressed in a number ways but traditionally we have referred to them using the hardware prefix, card number and optionally device number with something like hw:0
or hw:0,1
. In ALSA configuration terms card X, device Y
is known as hw:X,Y
.
ALSA has other prefixes for each card and most importantly plughw
. The plughw
performs transparent sample format and sample rate conversions and maybe a better choice for many users rather than hw:
which would fail when provided unsupported audio formats/sample rates.
Alternative ALSA names can be used to refer to physical ALSA devices and can be useful in a number of ways:
The ALSA device information required for configuration the server can be deterined using aplay
, as described in the rest of this document, but OwnTone can also assist; when configured to log at INFO
level the following information is provided during startup:
laudio: Available ALSA playback mixer(s) on hw:0 CARD=Intel (HDA Intel): 'Master' 'Headphone' 'Speaker' 'PCM' 'Mic' 'Beep'
+laudio: Available ALSA playback mixer(s) on hw:1 CARD=E30 (E30): 'E30 '
+laudio: Available ALSA playback mixer(s) on hw:2 CARD=Seri (Plantronics Blackwire 3210 Seri): 'Sidetone' 'Headset'
+
CARD=
string is the alternate ALSA name for the device and can be used in place of the traditional hw:x
name. On this machine the server reports that it can see the onboard HDA Intel sound card and two additional sound cards: a Topping E30 DAC and a Plantronics Headset which are both USB devices. We can address the first ALSA device as hw:0
or hw:CARD=Intel
or hw:Intel
or plughw:Intel
, the second ALSA device as hw:1
or hw:E30
and so forth. The latter 2 devices being on USB will mean that hw:1
may not always refer to hw:E30
and thus in such a case using the alternate name is useful.
OwnTone can support a single ALSA device or multiple ALSA devices.
# example audio section for server for a single soundcard
+audio {
+ nickname = "Computer"
+ type = "alsa"
+
+ card = "hw:1" # defaults to 'default'
+ mixer = "Analogue" # defaults to 'PCM' or 'Master'
+ mixer_device = "hw:1" # defaults to same as 'card' value
+}
+
Multiple devices can be made available to OwnTone using seperate alsa { .. }
sections.
audio {
+ type = "alsa"
+}
+
+alsa "hw:1" {
+ nickname = "Computer"
+ mixer = "Analogue"
+ mixer_device = "hw:1"
+}
+
+alsa "hw:2" {
+ nickname = "Second ALSA device"
+}
+
NB: When introducing alsa { .. }
section(s) the ALSA specific configuration in the audio { .. }
section will be ignored.
If there is only one sound card, verify if the default
sound device is correct for playback, we will use the aplay
utility.
# generate some audio if you don't have a wav file to hand
+$ sox -n -c 2 -r 44100 -b 16 -C 128 /tmp/sine441.wav synth 30 sin 500-100 fade h 0.2 30 0.2
+
+$ aplay -Ddefault /tmp/sine441.wav
+
If you can hear music played then you are good to use default
for the server configuration. If you can not hear anything from the aplay
firstly verify (using alsamixer
) that the sound card is not muted. If the card is not muted AND there is no sound you can try the options below to determine the card and mixer for configuring the server.
As shown above, OwnTone can help, consider the information that logged:
laudio: Available ALSA playback mixer(s) on hw:0 CARD=Intel (HDA Intel): 'Master' 'Headphone' 'Speaker' 'PCM' 'Mic' 'Beep'
+laudio: Available ALSA playback mixer(s) on hw:1 CARD=E30 (E30): 'E30 '
+laudio: Available ALSA playback mixer(s) on hw:2 CARD=Seri (Plantronics Blackwire 3210 Seri): 'Sidetone' 'Headset'
+
Using the information above, we can see 3 soundcards that we could use with OwnTone with the first soundcard having a number of seperate mixer devices (volume control) for headphone and the interal speakers - we'll configure the server to use both these and also the E30 device. The server configuration for theese multiple outputs would be:
# using ALSA device alias where possible
+
+alsa "hw:Intel" {
+ nickname = "Computer - Speaker"
+ mixer = "Speaker"
+}
+
+alsa "hw:Intel" {
+ nickname = "Computer - Headphones"
+ mixer = "Headphone"
+}
+
+alsa "plughw:E30" {
+ # this E30 device only support S32_LE so we can use the 'plughw' prefix to
+ # add transparent conversion support of more common S16/S24_LE formats
+
+ nickname = "E30 DAC"
+ mixer = "E30 "
+ mixer_device = "hw:E30"
+}
+
NB: it is troublesome to use hw
or plughw
ALSA addressing when running OwnTone on a machine with pulseaudio
and if you wish to use refer to ALSA devices directly that you stop pulseaudio
.
The example below is how I determined the correct sound card and mixer values for a Raspberry Pi that has an additional DAC card (hat) mounted. Of course using the log output from the server would have given the same results.
Use aplay -l
to list all the sound cards and their order as known to the system - you can have multiple card X, device Y
entries; some cards can also have multiple playback devices such as the RPI's onboard soundcard which feeds both headphone (card 0, device 0) and HDMI (card 0, device 1).
$ aplay -l
+**** List of PLAYBACK Hardware Devices ****
+card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
+ Subdevices: 6/7
+ Subdevice #0: subdevice #0
+ Subdevice #1: subdevice #1
+ Subdevice #2: subdevice #2
+ Subdevice #3: subdevice #3
+ Subdevice #4: subdevice #4
+ Subdevice #5: subdevice #5
+ Subdevice #6: subdevice #6
+card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
+ Subdevices: 1/1
+ Subdevice #0: subdevice #0
+card 1: IQaudIODAC [IQaudIODAC], device 0: IQaudIO DAC HiFi pcm512x-hifi-0 []
+ Subdevices: 1/1
+ Subdevice #0: subdevice #0
+
On this machine we see the second sound card installed, an IQaudIODAC dac hat, and identified as card 1 device 0
. This is the playback device we want to be used by the server.
hw:1,0
is the IQaudIODAC that we want to use - we verify audiable playback through that sound card using aplay -Dhw:1 /tmp/sine441.wav
. If the card has only one device, we can simply refer to the sound card using hw:X
so in this case where the IQaudIODAC only has one device, we can refer to this card as hw:1
or hw:1,0
.
Use aplay -L
to get more information about the PCM devices defined on the system.
$ aplay -L
+null
+ Discard all samples (playback) or generate zero samples (capture)
+default:CARD=ALSA
+ bcm2835 ALSA, bcm2835 ALSA
+ Default Audio Device
+sysdefault:CARD=ALSA
+ bcm2835 ALSA, bcm2835 ALSA
+ Default Audio Device
+dmix:CARD=ALSA,DEV=0
+ bcm2835 ALSA, bcm2835 ALSA
+ Direct sample mixing device
+dmix:CARD=ALSA,DEV=1
+ bcm2835 ALSA, bcm2835 IEC958/HDMI
+ Direct sample mixing device
+dsnoop:CARD=ALSA,DEV=0
+ bcm2835 ALSA, bcm2835 ALSA
+ Direct sample snooping device
+dsnoop:CARD=ALSA,DEV=1
+ bcm2835 ALSA, bcm2835 IEC958/HDMI
+ Direct sample snooping device
+hw:CARD=ALSA,DEV=0
+ bcm2835 ALSA, bcm2835 ALSA
+ Direct hardware device without any conversions
+hw:CARD=ALSA,DEV=1
+ bcm2835 ALSA, bcm2835 IEC958/HDMI
+ Direct hardware device without any conversions
+plughw:CARD=ALSA,DEV=0
+ bcm2835 ALSA, bcm2835 ALSA
+ Hardware device with all software conversions
+plughw:CARD=ALSA,DEV=1
+ bcm2835 ALSA, bcm2835 IEC958/HDMI
+ Hardware device with all software conversions
+default:CARD=IQaudIODAC
+ IQaudIODAC,
+ Default Audio Device
+sysdefault:CARD=IQaudIODAC
+ IQaudIODAC,
+ Default Audio Device
+dmix:CARD=IQaudIODAC,DEV=0
+ IQaudIODAC,
+ Direct sample mixing device
+dsnoop:CARD=IQaudIODAC,DEV=0
+ IQaudIODAC,
+ Direct sample snooping device
+hw:CARD=IQaudIODAC,DEV=0
+ IQaudIODAC,
+ Direct hardware device without any conversions
+plughw:CARD=IQaudIODAC,DEV=0
+ IQaudIODAC,
+ Hardware device with all software conversions
+
For the server configuration, we will use:
audio {
+ nickname = "Computer"
+ type = "alsa"
+ card="hw:1"
+ # mixer=TBD
+ # mixer_device=TBD
+}
+
Once you have the card number (determined from aplay -l
) we can inspect/confirm the name of the mixer that can be used for playback (it may NOT be PCM
as expected by the server). In this example, the card 1
is of interest and thus we use -c 1
with the following command:
$ amixer -c 1
+Simple mixer control 'DSP Program',0
+ Capabilities: enum
+ Items: 'FIR interpolation with de-emphasis' 'Low latency IIR with de-emphasis' 'High attenuation with de-emphasis' 'Fixed process flow' 'Ringing-less low latency FIR'
+ Item0: 'Ringing-less low latency FIR'
+Simple mixer control 'Analogue',0
+ Capabilities: pvolume
+ Playback channels: Front Left - Front Right
+ Limits: Playback 0 - 1
+ Mono:
+ Front Left: Playback 1 [100%] [0.00dB]
+ Front Right: Playback 1 [100%] [0.00dB]
+Simple mixer control 'Analogue Playback Boost',0
+ Capabilities: volume
+ Playback channels: Front Left - Front Right
+ Capture channels: Front Left - Front Right
+ Limits: 0 - 1
+ Front Left: 0 [0%] [0.00dB]
+ Front Right: 0 [0%] [0.00dB]
+...
+
This card has multiple controls but we want to find a mixer control listed with a pvolume
(playback) capability - in this case that mixer value required for the server configuration is called Analogue
.
For the server configuration, we will use:
audio {
+ nickname = "Computer"
+ type = "alsa"
+ card="hw:1"
+ mixer="Analogue"
+ # mixer_device=TBD
+}
+
This is the name of the underlying physical device used for the mixer - it is typically the same value as the value of card
in which case a value is not required by the server configuration. An example of when you want to change explicitly configure this is if you need to use a dmix
device (see below).
Some devices such as various RPI DAC boards (IQaudio DAC, Allo Boss DAC...) cannot have multiple streams openned at the same time/cannot play multiple sound files at the same time. This results in Device or resource busy
errors. You can confirm if your sound card has this problem by using the example below once have determined the names/cards information as above.
Using our hw:1
device we try:
# generate some audio
+$ sox -n -c 2 -r 44100 -b 16 -C 128 /tmp/sine441.wav synth 30 sin 500-100 fade h 0.2 30 0.2
+
+# attempt to play 2 files at the same time
+$ aplay -v -Dhw:1 /tmp/sine441.wav &
+Playing WAVE '/tmp/sine441.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
+Hardware PCM card 1 'IQaudIODAC' device 0 subdevice 0
+Its setup is:
+ stream : PLAYBACK
+ access : RW_INTERLEAVED
+ format : S16_LE
+ subformat : STD
+ channels : 2
+ rate : 44100
+ exact rate : 44100 (44100/1)
+ msbits : 16
+ buffer_size : 22052
+ period_size : 5513
+ period_time : 125011
+ tstamp_mode : NONE
+ tstamp_type : MONOTONIC
+ period_step : 1
+ avail_min : 5513
+ period_event : 0
+ start_threshold : 22052
+ stop_threshold : 22052
+ silence_threshold: 0
+ silence_size : 0
+ boundary : 1445199872
+ appl_ptr : 0
+ hw_ptr : 0
+$ aplay -v -Dhw:1 /tmp/sine441.wav
+aplay: main:788: audio open error: Device or resource busy
+
In this instance this device cannot open multiple streams - OwnTone can handle this situation transparently with some audio being truncated from the end of the current file as the server prepares to play the following track. If this handling is causing you problems you may wish to use ALSA's dmix
functionally which provides a software mixing module. We will need to define a dmix
component and configure the server to use that as it's sound card.
The downside to the dmix
approach will be the need to fix a samplerate (48000 being the default) for this software mixing module meaning any files that have a mismatched samplerate will be resampled.
A dmix
device can be defined in /etc/asound.conf
or ~/.asoundrc
for the same user running OwnTone. We will need to know the underlying physical soundcard to be used: in our examples above, hw:1,0
/ card 1, device 0
representing our IQaudIODAC as per output of aplay -l
. We also take the buffer_size
and period_size
from the output of playing a sound file via aplay -v
.
# use 'dac' as the name of the device: "aplay -Ddac ...."
+pcm.!dac {
+ type plug
+ slave.pcm "dmixer"
+ hint.description "IQAudio DAC s/w dmix enabled device"
+}
+
+pcm.dmixer {
+ type dmix
+ ipc_key 1024 # need to be uniq value
+ ipc_key_add_uid false # multiple concurrent different users
+ ipc_perm 0666 # multi-user sharing permissions
+
+ slave {
+ pcm "hw:1,0" # points at the underlying device - could also simply be hw:1
+ period_time 0
+ period_size 4096 # from the output of aplay -v
+ buffer_size 22052 # from the output of aplay -v
+ rate 44100 # locked in sample rate for resampling on dmix device
+ }
+ hint.description "IQAudio DAC s/w dmix device"
+}
+
+ctl.dmixer {
+ type hw
+ card 1 # underlying device
+ device 0
+}
+
Running aplay -L
we will see our newly defined devices dac
and dmixer
$ aplay -L
+null
+ Discard all samples (playback) or generate zero samples (capture)
+dac
+ IQAudio DAC s/w dmix enabled device
+dmixer
+ IQAudio DAC s/w dmix device
+default:CARD=ALSA
+ bcm2835 ALSA, bcm2835 ALSA
+ Default Audio Device
+...
+
At this point we are able to rerun the concurrent aplay
commands (adding -Ddac
to specify the playback device to use) to verify ALSA configuration.
If there is only one card on the machine you may use pcm.!default
instead of pcm.!dac
- there is less configuration to be done later since many ALSA applications will use the device called default
by default. Furthermore on RPI you can explicitly disable the onboard sound card to leave us with only the IQaudIODAC board enabled (won't affect HDMI sound output) by commenting out #dtparam=audio=on
in /boot/config.txt
and rebooting.
We will use the newly defined card named dac
which uses the underlying hw:1
device as per /etc/asound.conf
or ~/.asoundrc
configuration. Note that the mixer_device
is now required and must refer to the real device (see the slave.pcm
value) and not the named device (ie dac
) that we created and are using for the card
configuration value.
For the final server configuration, we will use:
audio {
+ nickname = "Computer"
+ type = "alsa"
+ card="dac"
+ mixer="Analogue"
+ mixer_device="hw:1"
+}
+
There exists an ALSA equalizer plugin. On debian
(incl Raspberry Pi) systems you can install this plugin by apt install libasound2-plugin-equal
; this is not currently available on Fedora (FC31) but can be easily built from source after installing the dependant ladspa
package.
Once installed the user must setup a virtual device and use this device in the server configuration.
If you wish to use your hw:0
device for output:
# /etc/asound.conf
+ctl.equal {
+ type equal;
+
+ # library /usr/lib64/ladspa/caps.so
+}
+
+pcm.equal {
+ type plug;
+ slave.pcm {
+ type equal;
+
+ ## must be plughw:x,y and not hw:x,y
+ slave.pcm "plughw:0,0";
+
+ # library /usr/lib64/ladspa/caps.so
+ }
+ hint.description "equalised device"
+}
+
and in owntone.conf
alsa "equal" {
+ nickname = "Equalised Output"
+ # adjust accordingly for mixer with pvolume capability
+ mixer = "PCM"
+ mixer_device = "hw:0"
+}
+
Using the web UI and on the outputs selection you should see an output called Equalised Output
which you should select and set the volume.
When starting playback for any audio tracks you should hopefully hear the output. In a terminal, run alsamixer -Dequal
and you'll see the eqaliser - to test that this is all working, go and drop the upper frequencies and boosting the bass frequencies and give it a second - if this changes the sound profile from your speakers, well done, its done and you can adjust the equalizer as you desire.
Note however, the equalizer appears to require a plughw
device which means you cannnot use this equalizer with a dmix
output chain.
Failed to open configured mixer element
when selecting output deviceErrors in log Invalid CTL
or Failed to attach mixer
when playing/adjusting volume
mixer
value is wrong. Verify name of mixer
value in server config against the names from all devices capable of playback using amixer -c <card number>
. Assume the device is card 1:
(IFS=$'\n'
+ CARD=1
+ for i in $(amixer -c ${CARD} scontrols | awk -F\' '{ print $2 }'); do
+ amixer -c ${CARD} sget "$i" | grep Capabilities | grep -q pvolume && echo $i
+ done
+)
+
Look at the names output and choose the one that fits. The outputs can be something like:
No sound during playback - valid mixer/verified by aplay
Check that the mixer is not muted or volume set to 0. Using the value of mixer
as per server config and unmute or set volume to max. Assume the device is card 1 and mixer = Analogue
:
amixer -c 1 set Analogue unmute ## some mixers can not be muted resulting in "invalid command"
+amixer -c 1 set Analogue 100%
+
An example of a device with volume turned all the way down - notice the Playback
values are 0
[0%]`:
Server stops playing after moving to new track in paly queue, Error in log Could not open playback device
The log contains these log lines:
[2019-06-19 20:52:51] [ LOG] laudio: open '/dev/snd/pcmC0D0p' failed (-16)[2019-06-19 20:52:51] [ LOG] laudio: Could not open playback device: Device or resource busy
+[2019-06-19 20:52:51] [ LOG] laudio: Device 'hw' does not support quality (48000/16/2), falling back to default
+[2019-06-19 20:52:51] [ LOG] laudio: open '/dev/snd/pcmC0D0p' failed (-16)[2019-06-19 20:52:51] [ LOG] laudio: Could not open playback device: Device or resource busy
+[2019-06-19 20:52:51] [ LOG] laudio: ALSA device failed setting fallback quality[2019-06-19 20:52:51] [ LOG] player: The ALSA device 'Computer' FAILED
+
If you have a RPI with a DAC hat with a pcm512x
chip will affect you. This is because the server wants to open the audio device for the next audio track whilst current track is still playing but the hardware does not allow this - see the comments above regarding determining concurrrent playback.
This error will occur for output hardware that do not support concurrent device open and the server plays 2 files of different bitrate (44.1khz and 48khz) back to back.
If you observe the error, you will need to use the dmix
configuration as mentioned above.
You have the choice of running Pulseaudio either in system mode or user mode. For headless servers, i.e. systems without desktop users, system mode is recommended.
If there is a desktop user logged in most of the time, a setup with network access via localhost only for daemons is a more appropriate solution, since the normal user administration (with, e.g., pulseaudio -k
) works as advertised. Also, the user specific configuration for pulseaudio is preserved across sessions as expected.
Credit: Rob Pope
This guide was written based on headless Debian Jessie platforms. Most of the instructions will require that you are root.
If you see a "Connection refused" error when starting the server, then you will probably need to setup Pulseaudio to run in system mode [1]. This means that the Pulseaudio daemon will be started during boot and be available to all users.
How to start Pulseaudio depends on your distribution, but in many cases you will need to add a pulseaudio.service file to /etc/systemd/system with the following content:
# systemd service file for Pulseaudio running in system mode
+[Unit]
+Description=Pulseaudio sound server
+Before=sound.target
+
+[Service]
+ExecStart=/usr/bin/pulseaudio --system --disallow-exit
+
+[Install]
+WantedBy=multi-user.target
+
If you want Bluetooth support, you must also configure Pulseaudio to load the Bluetooth module. First install it (Debian: apt install pulseaudio-module-bluetooth
) and then add the following to /etc/pulse/system.pa:
#### Enable Bluetooth
+.ifexists module-bluetooth-discover.so
+load-module module-bluetooth-discover
+.endif
+
Now you need to make sure that Pulseaudio can communicate with the Bluetooth daemon through D-Bus. On Raspbian this is already enabled, and you can skip this step. Otherwise do one of the following:
adduser pulse bluetooth
<policy context="default"\>
to "allow"Phew, almost done with Pulseaudio! Now you should:
systemctl enable pulseaudio
pactl list modules short
Add the user the server is running as (typically "owntone") to the "pulse-access" group:
Now (re)start the server.
To connect with the device, run bluetoothctl
and then:
power on
+agent on
+scan on
+**Note MAC address of BT Speaker**
+pair [MAC address]
+**Type Pin if prompted**
+trust [MAC address]
+connect [MAC address]
+
Now the speaker should appear. You can also verify that Pulseaudio has detected the speaker with pactl list sinks short
.
Credit: wolfmanx and this blog
Edit the file ~/.pulse/default.pa
, adding the following line at the end:
In the audio
section of /etc/owntone.conf
, set server
to localhost
:
[1] Note that Pulseaudio will warn against system mode. However, in this use case it is actually the solution recommended by the Pulseaudio folks themselves.
Radio streams have many different ways in how metadata is sent. Many should just work as expected, but a few may require some tweaking. If you are not seeing expected title, track, artist, artwork in clients or web UI, the following may help.
First, understand what and how the particular stream is sending information. ffprobe is a command that can be used to interegrate most of the stream information. ffprobe <http://stream.url>
should give you some useful output, look at the Metadata section, below is an example.
Metadata:
+ icy-br : 320
+ icy-description : DJ-mixed blend of modern and classic rock, electronica, world music, and more. Always 100% commercial-free
+ icy-genre : Eclectic
+ icy-name : Radio Paradise (320k aac)
+ icy-pub : 1
+ icy-url : https://radioparadise.com
+ StreamTitle : Depeche Mode - Strangelove
+ StreamUrl : http://img.radioparadise.com/covers/l/B000002LCI.jpg
+
In the example above, all tags are populated with correct information, no modifications to the server configuration should be needed. Note that StreamUrl points to the artwork image file.
Below is another example that will require some tweaks to the server, Notice icy-name
is blank and StreamUrl
doesn't point to an image.
Metadata:
+ icy-br : 127
+ icy-pub : 0
+ icy-description : Unspecified description
+ icy-url :
+ icy-genre : various
+ icy-name :
+ StreamTitle : Pour Some Sugar On Me - Def Leppard
+ StreamUrl : https://radio.stream.domain/api9/eventdata/49790578
+
In the above, first fix is the blank name, second is the image artwork.
Set the name with an EXTINF tag in the m3u playlist file:
The format is basically #EXTINF:<length>, <Artist Name> - <Artist Title>
. Length is -1 since it's a stream, <Artist Name>
was left blank since StreamTitle
is accurate in the Metadata but <Artist Title>
was set to My Radio Stream Name
since icy-name
was blank.
If StreamUrl
does not point directly to an artwork file then the link may be to a json file that contains an artwork link. If so, you can make the server download the file automatically and search for an artwork link, and also track duration.
Try to download the file, e.g. with curl "https://radio.stream.domain/api9/eventdata/49790578"
. Let's assume you get something like this:
{
+ "eventId": 49793707,
+ "eventStart": "2020-05-08 16:23:03",
+ "eventFinish": "2020-05-08 16:27:21",
+ "eventDuration": 254,
+ "eventType": "Song",
+ "eventSongTitle": "Pour Some Sugar On Me",
+ "eventSongArtist": "Def Leppard",
+ "eventImageUrl": "https://radio.stream.domain/artist/1-1/320x320/562.jpg?ver=1465083491",
+ "eventImageUrlSmall": "https://radio.stream.domain/artist/1-1/160x160/562.jpg?ver=1465083491",
+ "eventAppleMusicUrl": "https://geo.itunes.apple.com/dk/album/530707298?i=530707313"
+}
+
In this case, you would need to tell the server to look for "eventDuration" and "eventImageUrl" (or just "duration" and "url"). You can do that like this:
curl -X PUT "http://localhost:3689/api/settings/misc/streamurl_keywords_length" --data "{\"name\":\"streamurl_keywords_length\",\"value\":\"duration\"}"
+curl -X PUT "http://localhost:3689/api/settings/misc/streamurl_keywords_artwork_url" --data "{\"name\":\"streamurl_keywords_artwork_url\",\"value\":\"url\"}
+
If you want multiple search phrases then comma separate, e.g. "duration,length".
If your radio station publishes metadata via another method than the above, e.g. just on their web site, then you will have to write a script that pulls the metadata and then pushes it to the server. To update metadata for the currently playing radio station use something like this JSON API request:
curl -X PUT "http://localhost:3689/api/queue/items/now_playing?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg"
+
If your radio station is not returning any artwork links, you can also just make a static artwork by placing a png/jpg in the same directory as the m3u, and with the same name, e.g. My Radio Stream.jpg
for My Radio Stream.m3u
.
It is possible to access a shared library over the internet from a DAAP client like iTunes. You must have remote access to the host machine.
First log in to the host and forward port 3689 to your local machine. You now need to broadcast the daap service to iTunes on your local machine. On macOS the command is:
The ffid
key is required but its value does not matter.
Your library will now appear as 'iTunesServer' in iTunes.
You can also access your library remotely using something like Zerotier. See this guide for details.
OwnTone has support for PNG and JPEG artwork which is either:
For media in your library, OwnTone will try to locate album and artist artwork (group artwork) by the following procedure:
{artwork,cover,Folder} are the default, you can add other base names in the configuration file. Here you can also enable/disable support for individual file artwork (instead of using the same artwork for all tracks in an entire album).
For playlists in your library, say /foo/bar.m3u, then for any http streams in the list, OwnTone will look for /foo/bar.{jpg,png}.
You can use symlinks for the artwork files.
OwnTone caches artwork in a separate cache file. The default path is /var/cache/owntone/cache.db
and can be configured in the configuration file. The cache.db file can be deleted without losing the library and pairing informations.
This document contains instructions for building OwnTone from the git tree. If you just want to build from a release tarball, you don't need the build tools (git, autotools, autoconf, automake, gawk, gperf, gettext, bison and flex), and you can skip the autoreconf step.
If you are the lucky kind, this should get you all the required tools and libraries:
sudo apt-get install \
+ build-essential git autotools-dev autoconf automake libtool gettext gawk \
+ gperf bison flex libconfuse-dev libunistring-dev libsqlite3-dev \
+ libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev \
+ libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev \
+ libevent-dev libplist-dev libsodium-dev libjson-c-dev libwebsockets-dev \
+ libcurl4-openssl-dev libprotobuf-c-dev
+
Note that OwnTone will also work with other versions and flavours of libgcrypt and libcurl, so the above are just suggestions.
The following features require extra packages, and that you add a configure argument when you run ./configure:
Feature | Configure argument | Packages |
---|---|---|
Chromecast | --enable-chromecast | libgnutls*-dev |
Pulseaudio | --with-pulseaudio | libpulse-dev |
These features can be disabled saving you package dependencies:
Feature | Configure argument | Packages |
---|---|---|
Spotify (built-in) | --disable-spotify | libprotobuf-c-dev |
Player web UI | --disable-webinterface | libwebsockets-dev |
Live web UI | --without-libwebsockets | libwebsockets-dev |
Then run the following (adding configure arguments for optional features):
git clone https://github.com/owntone/owntone-server.git
+cd owntone-server
+autoreconf -i
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user
+make
+sudo make install
+
Using --enable-install-user
means that make install
will also add system user and group for owntone.
With the above configure arguments, a systemd service file will be installed to /etc/systemd/system/owntone.service
so that the server will start on boot. Use --disable-install-systemd
if you don't want that.
Now edit /etc/owntone.conf
. Note the guide at the top highlighting which settings that normally require modification.
Start the server with sudo systemctl start owntone
and check that it is running with sudo systemctl status owntone
.
See the Documentation for usage information.
If you haven't already enabled the free RPM fusion packages do that, since you will need ffmpeg. You can google how to do that. Then run:
sudo dnf install \
+ git automake autoconf gettext-devel gperf gawk libtool bison flex \
+ sqlite-devel libconfuse-devel libunistring-devel mxml-devel libevent-devel \
+ avahi-devel libgcrypt-devel zlib-devel alsa-lib-devel ffmpeg-devel \
+ libplist-devel libsodium-devel json-c-devel libwebsockets-devel \
+ libcurl-devel protobuf-c-devel
+
Clone the OwnTone repo:
Then run the following:
autoreconf -i
+./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user
+make
+sudo make install
+
Using --enable-install-user
means that make install
will also add system user and group for owntone.
With the above configure arguments, a systemd service file will be installed to /etc/systemd/system/owntone.service
so that the server will start on boot. Use --disable-install-systemd
if you don't want that.
Now edit /etc/owntone.conf
. Note the guide at the top highlighting which settings that normally require modification.
Start the server with sudo systemctl start owntone
and check that it is running with sudo systemctl status owntone
.
See the Documentation for usage information.
There is a script in the 'scripts' folder that will at least attempt to do all the work for you. And should the script not work for you, you can still look through it and use it as an installation guide.
This workflow file used for building OwnTone via Github actions includes all the steps that you need to execute: .github/workflows/macos.yml
Caution: 1) this approach may be out of date, consider using the Homebrew method above since it is continuously tested. 2) macports requires many downloads and lots of time to install (and sometimes build) ports... you'll want a decent network connection and some patience!
Install macports (which requires Xcode): https://www.macports.org/install.php
sudo port install \
+ autoconf automake libtool pkgconfig git gperf bison flex libgcrypt \
+ libunistring libconfuse ffmpeg libevent json-c libwebsockets curl \
+ libplist libsodium protobuf-c
+
Download, configure, build and install the Mini-XML library: http://www.msweet.org/projects.php/Mini-XML
Download, configure, build and install the libinotify library: https://github.com/libinotify-kqueue/libinotify-kqueue
Add the following to .bashrc
:
# add /usr/local to pkg-config path
+export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig
+# libunistring doesn't support pkg-config, set overrides
+export LIBUNISTRING_CFLAGS=-I/opt/local/include
+export LIBUNISTRING_LIBS="-L/opt/local/lib -lunistring"
+
Optional features require the following additional ports:
Feature | Configure argument | Ports |
---|---|---|
Chromecast | --enable-chromecast | gnutls |
Pulseaudio | --with-pulseaudio | pulseaudio |
Clone the OwnTone repo:
Finally, configure, build and install, adding configure arguments for optional features:
Note: if for some reason you've installed the avahi port, you need to add --without-avahi
to configure above.
Edit /usr/local/etc/owntone.conf
and change the uid
to a nice system daemon (eg: unknown), and run the following:
sudo mkdir -p /usr/local/var/run
+sudo mkdir -p /usr/local/var/log # or change logfile in conf
+sudo chown unknown /usr/local/var/cache/owntone # or change conf
+
Run OwnTone:
Verify it's running (you need to Ctrl+C to stop dns-sd):
Required tools:
autoreconf -i
at the top of the source tree to generate the build system.Libraries:
If using binary packages, remember that you need the development packages to build OwnTone (usually named -dev or -devel).
sqlite3 needs to be built with support for the unlock notify API; this isn't always the case in binary packages, so you may need to rebuild sqlite3 to enable the unlock notify API (you can check for the presence of the sqlite3_unlock_notify symbol in the sqlite3 library). Refer to the sqlite3 documentation, look for SQLITE_ENABLE_UNLOCK_NOTIFY
.
Start by generating the build system by running autoreconf -i
. This will generate the configure script and Makefile.in
.
To display the configure options run ./configure --help
.
Support for Spotify is optional. Use --disable-spotify
to disable this feature.
Support for LastFM scrobbling is optional. Use --enable-lastfm
to enable this feature.
Support for the MPD protocol is optional. Use --disable-mpd
to disable this feature.
Support for Chromecast devices is optional. Use --enable-chromecast
to enable this feature.
The player web interface is optional. Use --disable-webinterface
to disable this feature. If enabled, sudo make install
will install the prebuild html, js, css files. The prebuild files are:
htdocs/index.html
htdocs/player/*
The source for the player web interface is located under the web-src
folder and requires nodejs >= 6.0 to be built. In the web-src
folder run npm install
to install all dependencies for the player web interface. After that run npm run build
. This will build the web interface and update the htdocs
folder. (See Web interface for more informations)
Building with libwebsockets is required if you want the web interface. It will be enabled if the library is present (with headers). Use --without-libwebsockets
to disable.
Building with Pulseaudio is optional. It will be enabled if the library is present (with headers). Use --without-pulseaudio
to disable.
Recommended build settings:
After configure run the usual make, and if that went well, sudo make install
.
With the above configure arguments, a systemd service file will be installed to /etc/systemd/system/owntone.service
so that the server will start on boot. Use --disable-install-systemd
if you don't want that.
Using --enable-install-user
means that make install
will also add a system user and group for owntone.
After installation:
/etc/owntone.conf
apt install avahi-daemon
)OwnTone will drop privileges to any user you specify in the configuration file if it's started as root.
This user must have read permission to your library and read/write permissions to the database location ($localstatedir/cache/owntone
by default).
OwnTone is meant to be run as system wide daemon, but for development purposes you may want to run it isolated to your regular user.
The following description assumes that you want all runtime data stored in $HOME/owntone_data
and the source in $HOME/projects/owntone-server
.
Prepare directories for runtime data:
Copy one or more mp3 file to test with to owntone_data/media
.
Checkout OwnTone and configure build:
cd $HOME/projects
+git clone https://github.com/owntone/owntone-server.git
+cd owntone-server
+autoreconf -vi
+./configure --prefix=$HOME/owntone_data/usr --sysconfdir=$HOME/owntone_data/etc --localstatedir=$HOME/owntone_data/var
+
Build and install runtime:
Edit owntone_data/etc/owntone.conf
, find the following configuration settings and set them to these values:
Run the server:
(you can also use the copy of the binary in$HOME/owntone_data/usr/sbin
) You can choose between:
mpc
Here is an example of how to use curl with DAAP/DACP. Say you have a playlist with a radio station, and you want to make a script that starts playback of that station:
sqlite3 [your OwnTone db]
. Use select id,title from files
to get the id of the radio station, and use select id,title from playlists
to get the id of the playlist.curl "http://localhost:3689/login?pairing-guid=0x1&request-session-id=50"
+curl "http://localhost:3689/ctrl-int/1/playspec?database-spec='dmap.persistentid:0x1'&container-spec='dmap.persistentid:0x[PLAYLIST-ID]'&container-item-spec='dmap.containeritemid:0x[FILE ID]'&session-id=50"
+curl "http://localhost:3689/logout?session-id=50"
+
You can - to some extent - use clients for MPD to control OwnTone.
By default OwnTone listens on port 6600 for MPD clients. You can change this in the configuration file.
Currently only a subset of the commands offered by MPD (see MPD protocol documentation) are supported.
Due to some differences between OwnTone and MPD not all commands will act the same way they would running MPD:
The following table shows what is working for a selection of MPD clients:
Client | Type | Status |
---|---|---|
mpc | CLI | Working commands: mpc, add, crop, current, del (ranges are not yet supported), play, next, prev (behaves like cdprev), pause, toggle, cdprev, seek, clear, outputs, enable, disable, playlist, ls, load, volume, repeat, random, single, search, find, list, update (initiates an init-rescan, the path argument is not supported) |
ympd | Web | Everything except "add stream" should work |
Remote gets a list of output devices from the server; this list includes any and all devices on the network we know of that advertise AirPlay: AirPort Express, Apple TV, ... It also includes the local audio output, that is, the sound card on the server (even if there is no soundcard).
OwnTone remembers your selection and the individual volume for each output device; selected devices will be automatically re-selected, except if they return online during playback.
If Remote doesn't connect to OwnTone after you entered the pairing code something went wrong. Check the log file to see the error message. Here are some common reasons:
You did not enter the correct pairing code
You will see an error in the log about pairing failure with a HTTP response code that is not 0.
Solution: Try again.
No response from Remote, possibly a network issue
If you see an error in the log with either:
it means that OwnTone could not establish a connection to Remote. This might be a network issue, your router may not be allowing multicast between the Remote device and the host OwnTone is running on.
Solution 1: Sometimes it resolves the issue if you force Remote to quit, restart it and do the pairing proces again. Another trick is to establish some other connection (eg SSH) from the iPod/iPhone/iPad to the host.
Solution 2: Check your router settings if you can whitelist multicast addresses under IGMP settings. For Apple Bonjour, setting a multicast address of 224.0.0.251 and a netmask of 255.255.255.255 should work.
Otherwise try using avahi-browse for troubleshooting:
avahi-browse -r -k _touch-remote._tcp
+ ath0 IPv4 59eff13ea2f98dbbef6c162f9df71b784a3ef9a3 _touch-remote._tcp local
+= ath0 IPv4 59eff13ea2f98dbbef6c162f9df71b784a3ef9a3 _touch-remote._tcp local
+ hostname = [Foobar.local]
+ address = [192.168.1.1]
+ port = [49160]
+ txt = ["DvTy=iPod touch" "RemN=Remote" "txtvers=1" "RemV=10000" "Pair=FAEA410630AEC05E" "DvNm=Foobar"]
+
Hit Ctrl-C to terminate avahi-browse.
To check for network issues you can try to connect to address and port with telnet.
OwnTone supports these kinds of clients:
Like iTunes, you can control OwnTone with Remote and stream your music to AirPlay devices.
A single OwnTone instance can handle several clients concurrently, regardless of the protocol.
By default all clients on 192.168.* (and the ipv6 equivalent) are allowed to connect without authentication. You can change that in the configuration file.
Here is a list of working and non-working DAAP and Remote clients. The list is probably obsolete when you read it :-)
Client | Developer | Type | Platform | Working (vers.) |
---|---|---|---|---|
iTunes | Apple | DAAP | Win | Yes (12.10.1) |
Apple Music | Apple | DAAP | MacOS | Yes |
Rhythmbox | Gnome | DAAP | Linux | Yes |
Diapente | diapente | DAAP | Android | Yes |
WinAmp DAAPClient | WardFamily | DAAP | WinAmp | Yes |
Amarok w/DAAP plugin | KDE | DAAP | Linux/Win | Yes (2.8.0) |
Banshee | DAAP | Linux/Win/OSX | No (2.6.2) | |
jtunes4 | DAAP | Java | No | |
Firefly Client | (DAAP) | Java | No | |
Remote | Apple | Remote | iOS | Yes (4.3) |
Retune | SquallyDoc | Remote | Android | Yes (3.5.23) |
TunesRemote+ | Melloware | Remote | Android | Yes (2.5.3) |
Remote for iTunes | Hyperfine | Remote | Android | Yes |
Remote for Windows Phone | Komodex | Remote | Windows Phone | Yes (2.2.1.0) |
TunesRemote SE | Remote | Java | Yes (r108) | |
rtRemote for Windows | bizmodeller | Remote | Windows | Yes (1.2.0.67) |
Mobile friendly player web interface for OwnTone build with Vue.js, Bulma.
You can find the web interface at http://owntone.local:3689 or alternatively at http://SERVER_ADDRESS:3689.
Use the web interface to control playback, trigger manual library rescans, pair with remotes, select speakers, authenticate with Spotify, etc.
You can find OwnTone's web interface at http://owntone.local:3689 or alternatively at http://SERVER_ADDRESS:3689.
The source is located in the web-src
folder.
The web interface is built with Vite, makes use of Prettier for code formatting and ESLint for code linting (the project was set up following the guide ESLint and Prettier with Vite and Vue.js 3
# install dependencies
+npm install
+
+# Serve with hot reload at localhost:3000
+# (assumes that OwnTone server is running on localhost:3689)
+npm run serve
+
+# Serve with hot reload at localhost:3000
+# (with remote OwnTone server reachable under owntone.local:3689)
+VITE_OWNTONE_URL=http://owntone.local:3689 npm run serve
+
+# Build for production with minification (will update web interface
+# in "../htdocs")
+npm run build
+
+# Format code
+npm run format
+
+# Lint code (and fix errors that can be automatically fixed)
+npm run lint
+
After running npm run serve
the web interface is reachable at localhost:3000. By default it expects owntone to be running at localhost:3689 and proxies all JSON API calls to this location.
If the server is running at a different location you have to set the env variable VITE_OWNTONE_URL
.
After installation (see Installation) do the following:
/etc/owntone.conf
) to suit your needs/etc/init.d/owntone restart
)OwnTone is an open source (audio) media server for GNU/Linux, FreeBSD and MacOS.
It allows sharing and streaming your media library to iTunes (DAAP1), Roku (RSP), AirPlay devices (multiroom), Chromecast and also supports local playback.
You can control OwnTone via its web interface, Apple Remote (and compatible DAAP/DACP clients), MPD clients or via its JSON API.
Besides serving your local music, podcast and audiobook media files, OwnTone supports internet radios and Spotify (requires Spotify premium account).
Prior to version 28, OwnTone was called forked-daapd, which again was a rewrite of mt-daapd (Firefly Media Server).
OwnTone is written in C with a web interface written in Vue.js.
Supports multiple different clients:
Supports music and audiobook files, podcast files and RSS and internet radio
(You can find more screenshots from OwnTone's web interface here)
Before you continue, make sure you know what version of OwnTone you have, and what features it was built with (e.g. Spotify support).
How to find out? Go to the web interface and check. No web interface? Then check the top of OwnTone's log file (usually /var/log/owntone.log).
Note that you are viewing a snapshot of the instructions that may or may not match the version of OwnTone that you are using.
If you are looking for help on building OwnTone (not using it), then please see the documentation on Building from Source.
You can find source and documentation, also for older versions, here:
DAAP stands for Digital Audio Access Protocol which is the protocol used by iTunes and friends to share/stream media libraries over the network. ↩
You can compile and run OwnTone on pretty much any Linux- or BSD-platform. The instructions are here.
Apt repositories, images and precompiled binaries are available for some platforms. These can save you some work and make it easier to stay up to date:
Platform | How to get |
---|---|
RPi w/Raspberry Pi OS | Add OwnTone repository to apt sources, see: OwnTone server (iTunes server) - Raspberry Pi Forums |
Debian/Ubuntu amd64 | Download .deb as artifact from Github workflow (requires that you are logged in) |
OpenWrt | Run opkg install libwebsockets-full owntone |
Docker | See linuxserver/docker-daapd |
OwnTone is not in the official Debian repositories due to lack of Debian maintainer and Debian policy difficulties concerning the web UI, see this issue.
You can have OwnTone scrobble the music you listen to. To set up scrobbling go to the web interface and authorize OwnTone with your LastFM credentials.
OwnTone will not store your LastFM username/password, only the session key. The session key does not expire.
OwnTone has built-in support for playback of the tracks in your Spotify library.
You must have a Spotify premium account. If you normally log into Spotify with your Facebook account you must first go to Spotify's web site where you can get the Spotify username and password that matches your account.
You must also make sure that your browser can reach OwnTone's web interface via the address http://owntone.local:3689. Try it right now! That is where Spotify's OAuth page will redirect your browser with the token that OwnTone needs, so it must work. The address is announced by the server via mDNS, but if that for some reason doesn't work then configure it via router or .hosts file. You can remove it again after completing the login.
To authorize OwnTone, open the web interface, locate Settings > Online Services and then click the Authorize button. You will then be sent to Spotify's authorization service, which will send you back to the web interface after you have given the authorization.
Spotify no longer automatically notifies clients about library updates, so you have to trigger updates manually. You can for instance set up a cron job that runs /usr/bin/curl http://localhost:3689/api/update
To logout and remove Spotify tracks + credentials make a request to http://owntone.local:3689/api/spotify-logout.
Limitations: You will not be able to do any playlist management through OwnTone - use a Spotify client for that. You also can only listen to your music by letting OwnTone do the playback - so that means you can't stream to DAAP clients (e.g. iTunes) and RSP clients.
You can also use OwnTone with one of the various incarnations of librespot. This adds librespot as a selectable metaspeaker in Spotify's client, and when you start playback, librespot can be configured to start writing audio to a pipe that you have added to your library. This will be detected by OwnTone that then starts playback. You can also have a pipe for metadata and playback events, e.g. volume changes.
The easiest way of accomplishing this may be with Spocon, since it requires minimal configuration. After installing, create two pipes (with mkfifo) and set the configuration in the player section:
# Audio output device (MIXER, PIPE, STDOUT)
+output = "PIPE"
+# Output raw (signed) PCM to this file (`player.output` must be PIPE)
+pipe = "/srv/music/spotify"
+# Output metadata in Shairport Sync format (https://github.com/mikebrady/shairport-sync-metadata-reader)
+metadataPipe = "/srv/music/spotify.metadata"
+
Available API endpoints:
JSON-Object model:
Method | Endpoint | Description |
---|---|---|
GET | /api/player | Get player status |
PUT | /api/player/play, /api/player/pause, /api/player/stop, /api/player/toggle | Start, pause or stop playback |
PUT | /api/player/next, /api/player/previous | Skip forward or backward |
PUT | /api/player/shuffle | Set shuffle mode |
PUT | /api/player/consume | Set consume mode |
PUT | /api/player/repeat | Set repeat mode |
PUT | /api/player/volume | Set master volume or volume for a specific output |
PUT | /api/player/seek | Seek to a position in the currently playing track |
Endpoint
Response
Key | Type | Value |
---|---|---|
state | string | play , pause or stop |
repeat | string | off , all or single |
consume | boolean | true if consume mode is enabled |
shuffle | boolean | true if shuffle mode is enabled |
volume | integer | Master volume in percent (0 - 100) |
item_id | integer | The current playing queue item id |
item_length_ms | integer | Total length in milliseconds of the current queue item |
item_progress_ms | integer | Progress into the current queue item in milliseconds |
Example
{
+ "state": "pause",
+ "repeat": "off",
+ "consume": false,
+ "shuffle": false,
+ "volume": 50,
+ "item_id": 269,
+ "item_length_ms": 278093,
+ "item_progress_ms": 3674
+}
+
Start or resume, pause, stop playback.
Endpoint
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Skip forward or backward
Endpoint
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Enable or disable shuffle mode
Endpoint
Query parameters
Parameter | Value |
---|---|
state | The new shuffle state, should be either true or false |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Enable or disable consume mode
Endpoint
Query parameters
Parameter | Value |
---|---|
state | The new consume state, should be either true or false |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Change repeat mode
Endpoint
Query parameters
Parameter | Value |
---|---|
state | The new repeat mode, should be either off , all or single |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Change master volume or volume of a specific output.
Endpoint
Query parameters
Parameter | Value |
---|---|
volume | The new volume (0 - 100) |
step | The increase or decrease volume by the given amount (-100 - 100) |
output_id | (Optional) If an output id is given, only the volume of this output will be changed. If parameter is omited, the master volume will be changed. |
Either volume
or step
must be present as query parameter
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Seek to a position in the currently playing track.
Endpoint
Query parameters
Parameter | Value |
---|---|
position_ms | The new position in milliseconds to seek to |
seek_ms | A relative amount of milliseconds to seek to |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Seek to position:
Relative seeking (skip 30 seconds backwards):
Method | Endpoint | Description |
---|---|---|
GET | /api/outputs | Get a list of available outputs |
PUT | /api/outputs/set | Set enabled outputs |
GET | /api/outputs/{id} | Get an output |
PUT | /api/outputs/{id} | Change an output setting |
PUT | /api/outputs/{id}/toggle | Enable or disable an output, depending on the current state |
Endpoint
Response
Key | Type | Value |
---|---|---|
outputs | array | Array of output objects |
output
object
Key | Type | Value |
---|---|---|
id | string | Output id |
name | string | Output name |
type | string | Type of the output: AirPlay , Chromecast , ALSA , Pulseaudio , fifo |
selected | boolean | true if output is enabled |
has_password | boolean | true if output is password protected |
requires_auth | boolean | true if output requires authentication |
needs_auth_key | boolean | true if output requires an authorization key (device verification) |
volume | integer | Volume in percent (0 - 100) |
Example
{
+ "outputs": [
+ {
+ "id": "123456789012345",
+ "name": "kitchen",
+ "type": "AirPlay",
+ "selected": true,
+ "has_password": false,
+ "requires_auth": false,
+ "needs_auth_key": false,
+ "volume": 0
+ },
+ {
+ "id": "0",
+ "name": "Computer",
+ "type": "ALSA",
+ "selected": true,
+ "has_password": false,
+ "requires_auth": false,
+ "needs_auth_key": false,
+ "volume": 19
+ },
+ {
+ "id": "100",
+ "name": "daapd-fifo",
+ "type": "fifo",
+ "selected": false,
+ "has_password": false,
+ "requires_auth": false,
+ "needs_auth_key": false,
+ "volume": 0
+ }
+ ]
+}
+
Set the enabled outputs by passing an array of output ids. The server enables all outputs with the given ids and disables the remaining outputs.
Endpoint
Body parameters
Parameter | Type | Value |
---|---|---|
outputs | array | Array of output ids |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT "http://localhost:3689/api/outputs/set" --data "{\"outputs\":[\"198018693182577\",\"0\"]}"
+
Get an output
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Output id |
Response
On success returns the HTTP 200 OK
success status response code. With the response body holding the output
object.
Example
{
+ "id": "0",
+ "name": "Computer",
+ "type": "ALSA",
+ "selected": true,
+ "has_password": false,
+ "requires_auth": false,
+ "needs_auth_key": false,
+ "volume": 3
+}
+
Enable or disable an output and change its volume.
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Output id |
Body parameters
Parameter | Type | Value |
---|---|---|
selected | boolean | (Optional) true to enable and false to disable the output |
volume | integer | (Optional) Volume in percent (0 - 100) |
pin | string | (Optional) PIN for device verification |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Enable or disable an output, depending on its current state
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Output id |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Method | Endpoint | Description |
---|---|---|
GET | /api/queue | Get a list of queue items |
PUT | /api/queue/clear | Remove all items from the queue |
POST | /api/queue/items/add | Add items to the queue |
PUT | /api/queue/items/{id}|now_playing | Updating a queue item in the queue |
DELETE | /api/queue/items/{id} | Remove a queue item from the queue |
Lists the items in the current queue
Endpoint
Query parameters
Parameter | Value |
---|---|
id | (Optional) If a queue item id is given, only the item with the id will be returend. Use id=now_playing to get the currently playing item. |
start | (Optional) If a start and an end position is given, only the items from start (included) to end (excluded) will be returned. If only a start position is given, only the item at this position will be returned. |
end | (Optional) See start parameter |
Response
Key | Type | Value |
---|---|---|
version | integer | Version number of the current queue |
count | integer | Number of items in the current queue |
items | array | Array of queue item objects |
Example
{
+ "version": 833,
+ "count": 20,
+ "items": [
+ {
+ "id": 12122,
+ "position": 0,
+ "track_id": 10749,
+ "title": "Angels",
+ "artist": "The xx",
+ "artist_sort": "xx, The",
+ "album": "Coexist",
+ "album_sort": "Coexist",
+ "albumartist": "The xx",
+ "albumartist_sort": "xx, The",
+ "genre": "Indie Rock",
+ "year": 2012,
+ "track_number": 1,
+ "disc_number": 1,
+ "length_ms": 171735,
+ "media_kind": "music",
+ "data_kind": "file",
+ "path": "/music/srv/The xx/Coexist/01 Angels.mp3",
+ "uri": "library:track:10749"
+ },
+ ...
+ ]
+}
+
Remove all items form the current queue
Endpoint
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Add tracks, playlists artists or albums to the current queue
Endpoint
Query parameters
Parameter | Value |
---|---|
uris | Comma seperated list of resource identifiers (track , playlist , artist or album object uri ) |
expression | A smart playlist query expression identifying the tracks that will be added to the queue. |
position | (Optional) If a position is given, new items are inserted starting from this position into the queue. |
playback | (Optional) If the playback parameter is set to start , playback will be started after adding the new items. |
playback_from_position | (Optional) If the playback parameter is set to start , playback will be started with the queue item at the position given in playback_from_position . |
clear | (Optional) If the clear parameter is set to true , the queue will be cleared before adding the new items. |
shuffle | (Optional) If the shuffle parameter is set to true , the shuffle mode is activated. If it is set to something else, the shuffle mode is deactivated. To leave the shuffle mode untouched the parameter should be ommited. |
limit | (Optional) Maximum number of tracks to add |
Either the uris
or the expression
parameter must be set. If both are set the uris
parameter takes presedence and the expression
parameter will be ignored.
Response
On success returns the HTTP 200 OK
success status response code.
Key | Type | Value |
---|---|---|
count | integer | number of tracks added to the queue |
Example
Add new items by uri:
curl -X POST "http://localhost:3689/api/queue/items/add?uris=library:playlist:68,library:artist:2932599850102967727"
+
Add new items by query language:
Clear current queue, add 10 new random tracks of genre
Pop and start playback
curl -X POST "http://localhost:3689/api/queue/items/add?limit=10&clear=true&playback=start&expression=genre+is+%22Pop%22+order+by+random+desc"
+
Update or move a queue item in the current queue
Endpoint
orPath parameters
Parameter | Value |
---|---|
id | Queue item id |
(or use now_playing to update the currenly playing track)
Query parameters
Parameter | Value |
---|---|
new_position | The new position for the queue item in the current queue. |
title | New track title |
album | New album title |
artist | New artist |
album_artist | New album artist |
composer | New composer |
genre | New genre |
artwork_url | New URL to track artwork |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT "http://localhost:3689/api/queue/items/3?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg"
+
curl -X PUT "http://localhost:3689/api/queue/items/now_playing?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg"
+
Remove a queue item from the current queue
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Queue item id |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Method | Endpoint | Description |
---|---|---|
GET | /api/library | Get library information |
GET | /api/library/playlists | Get a list of playlists |
GET | /api/library/playlists/{id} | Get a playlist |
PUT | /api/library/playlists/{id} | Update a playlist attribute |
DELETE | /api/library/playlists/{id} | Delete a playlist |
GET | /api/library/playlists/{id}/tracks | Get list of tracks for a playlist |
PUT | /api/library/playlists/{id}/tracks | Update play count of tracks for a playlist |
GET | /api/library/playlists/{id}/playlists | Get list of playlists for a playlist folder |
GET | /api/library/artists | Get a list of artists |
GET | /api/library/artists/{id} | Get an artist |
GET | /api/library/artists/{id}/albums | Get list of albums for an artist |
GET | /api/library/albums | Get a list of albums |
GET | /api/library/albums/{id} | Get an album |
GET | /api/library/albums/{id}/tracks | Get list of tracks for an album |
GET | /api/library/tracks/{id} | Get a track |
GET | /api/library/tracks/{id}/playlists | Get list of playlists for a track |
PUT | /api/library/tracks | Update multiple track properties |
PUT | /api/library/tracks/{id} | Update single track properties |
GET | /api/library/genres | Get list of genres |
GET | /api/library/count | Get count of tracks, artists and albums |
GET | /api/library/files | Get list of directories in the local library |
POST | /api/library/add | Add an item to the library |
PUT | /api/update | Trigger a library rescan |
PUT | /api/rescan | Trigger a library metadata rescan |
PUT | /api/library/backup | Request library backup db |
List some library stats
Endpoint
Response
Key | Type | Value |
---|---|---|
songs | integer | Array of playlist objects |
db_playtime | integer | Total playtime of all songs in the library |
artists | integer | Number of album artists in the library |
albums | integer | Number of albums in the library |
started_at | string | Server startup time (timestamp in ISO 8601 format) |
updated_at | string | Last library update (timestamp in ISO 8601 format) |
updating | boolean | true if library rescan is in progress |
Example
{
+ "songs": 217,
+ "db_playtime": 66811,
+ "artists": 9,
+ "albums": 19,
+ "started_at": "2018-11-19T19:06:08Z",
+ "updated_at": "2018-11-19T19:06:16Z",
+ "updating": false
+}
+
Lists all playlists in your library (does not return playlist folders)
Endpoint
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first playlist to return |
limit | (Optional) Maximum number of playlists to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of playlist objects |
total | integer | Total number of playlists in the library |
offset | integer | Requested offset of the first playlist |
limit | integer | Requested maximum number of playlists |
Example
{
+ "items": [
+ {
+ "id": 1,
+ "name": "radio",
+ "path": "/music/srv/radio.m3u",
+ "smart_playlist": false,
+ "uri": "library:playlist:1"
+ },
+ ...
+ ],
+ "total": 20,
+ "offset": 0,
+ "limit": -1
+}
+
Get a specific playlists in your library
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Playlist id |
Response
On success returns the HTTP 200 OK
success status response code. With the response body holding the playlist
object.
Example
{
+ "id": 1,
+ "name": "radio",
+ "path": "/music/srv/radio.m3u",
+ "smart_playlist": false,
+ "uri": "library:playlist:1"
+}
+
Update attributes of a specific playlists in your library
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Playlist id |
Query parameters
Parameter | Value |
---|---|
query_limit | For RSS feeds, this sets how many podcasts to retrieve |
Example
Delete a playlist, e.g. a RSS feed
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Playlist id |
Example
Lists the tracks in a playlists
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Playlist id |
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first track to return |
limit | (Optional) Maximum number of tracks to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of track objects |
total | integer | Total number of tracks in the playlist |
offset | integer | Requested offset of the first track |
limit | integer | Requested maximum number of tracks |
Example
{
+ "items": [
+ {
+ "id": 10766,
+ "title": "Solange wir tanzen",
+ "artist": "Heinrich",
+ "artist_sort": "Heinrich",
+ "album": "Solange wir tanzen",
+ "album_sort": "Solange wir tanzen",
+ "albumartist": "Heinrich",
+ "albumartist_sort": "Heinrich",
+ "genre": "Electronica",
+ "year": 2014,
+ "track_number": 1,
+ "disc_number": 1,
+ "length_ms": 223085,
+ "play_count": 2,
+ "skip_count": 1,
+ "time_played": "2018-02-23T10:31:20Z",
+ "media_kind": "music",
+ "data_kind": "file",
+ "path": "/music/srv/Heinrich/Solange wir tanzen/01 Solange wir tanzen.mp3",
+ "uri": "library:track:10766"
+ },
+ ...
+ ],
+ "total": 20,
+ "offset": 0,
+ "limit": -1
+}
+
Updates the play count for tracks in a playlists
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Playlist id |
Query parameters
Parameter | Value |
---|---|
play_count | Either increment , played or reset . increment will increment play_count and update time_played , played will be like increment but only where play_count is 0, reset will set play_count and skip_count to zero and delete time_played and time_skipped |
Example
Lists the playlists in a playlist folder
Note: The root playlist folder has id
0.
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Playlist id |
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first playlist to return |
limit | (Optional) Maximum number of playlist to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of playlist objects |
total | integer | Total number of playlists in the playlist folder |
offset | integer | Requested offset of the first playlist |
limit | integer | Requested maximum number of playlist |
Example
{
+ "items": [
+ {
+ "id": 11,
+ "name": "Spotify",
+ "path": "spotify:playlistfolder",
+ "parent_id": "0",
+ "smart_playlist": false,
+ "folder": true,
+ "uri": "library:playlist:11"
+ },
+ {
+ "id": 8,
+ "name": "bytefm",
+ "path": "/srv/music/Playlists/bytefm.m3u",
+ "parent_id": "0",
+ "smart_playlist": false,
+ "folder": false,
+ "uri": "library:playlist:8"
+ }
+ ],
+ "total": 2,
+ "offset": 0,
+ "limit": -1
+}
+
Lists the artists in your library
Endpoint
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first artist to return |
limit | (Optional) Maximum number of artists to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of artist objects |
total | integer | Total number of artists in the library |
offset | integer | Requested offset of the first artist |
limit | integer | Requested maximum number of artists |
Example
{
+ "items": [
+ {
+ "id": "3815427709949443149",
+ "name": "ABAY",
+ "name_sort": "ABAY",
+ "album_count": 1,
+ "track_count": 10,
+ "length_ms": 2951554,
+ "uri": "library:artist:3815427709949443149"
+ },
+ ...
+ ],
+ "total": 20,
+ "offset": 0,
+ "limit": -1
+}
+
Get a specific artist in your library
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Artist id |
Response
On success returns the HTTP 200 OK
success status response code. With the response body holding the artist
object.
Example
{
+ "id": "3815427709949443149",
+ "name": "ABAY",
+ "name_sort": "ABAY",
+ "album_count": 1,
+ "track_count": 10,
+ "length_ms": 2951554,
+ "uri": "library:artist:3815427709949443149"
+}
+
Lists the albums of an artist
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Artist id |
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first album to return |
limit | (Optional) Maximum number of albums to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of album objects |
total | integer | Total number of albums of this artist |
offset | integer | Requested offset of the first album |
limit | integer | Requested maximum number of albums |
Example
{
+ "items": [
+ {
+ "id": "8009851123233197743",
+ "name": "Add Violence",
+ "name_sort": "Add Violence",
+ "artist": "Nine Inch Nails",
+ "artist_id": "32561671101664759",
+ "track_count": 5,
+ "length_ms": 1634961,
+ "uri": "library:album:8009851123233197743"
+ },
+ ...
+ ],
+ "total": 20,
+ "offset": 0,
+ "limit": -1
+}
+
Lists the albums in your library
Endpoint
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first album to return |
limit | (Optional) Maximum number of albums to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of album objects |
total | integer | Total number of albums in the library |
offset | integer | Requested offset of the first albums |
limit | integer | Requested maximum number of albums |
Example
{
+ "items": [
+ {
+ "id": "8009851123233197743",
+ "name": "Add Violence",
+ "name_sort": "Add Violence",
+ "artist": "Nine Inch Nails",
+ "artist_id": "32561671101664759",
+ "track_count": 5,
+ "length_ms": 1634961,
+ "uri": "library:album:8009851123233197743"
+ },
+ ...
+ ],
+ "total": 20,
+ "offset": 0,
+ "limit": -1
+}
+
Get a specific album in your library
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Album id |
Response
On success returns the HTTP 200 OK
success status response code. With the response body holding the album
object.
Example
{
+ "id": "8009851123233197743",
+ "name": "Add Violence",
+ "name_sort": "Add Violence",
+ "artist": "Nine Inch Nails",
+ "artist_id": "32561671101664759",
+ "track_count": 5,
+ "length_ms": 1634961,
+ "uri": "library:album:8009851123233197743"
+}
+
Lists the tracks in an album
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Album id |
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first track to return |
limit | (Optional) Maximum number of tracks to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of track objects |
total | integer | Total number of tracks |
offset | integer | Requested offset of the first track |
limit | integer | Requested maximum number of tracks |
Example
{
+ "items": [
+ {
+ "id": 10766,
+ "title": "Solange wir tanzen",
+ "artist": "Heinrich",
+ "artist_sort": "Heinrich",
+ "album": "Solange wir tanzen",
+ "album_sort": "Solange wir tanzen",
+ "albumartist": "Heinrich",
+ "albumartist_sort": "Heinrich",
+ "genre": "Electronica",
+ "year": 2014,
+ "track_number": 1,
+ "disc_number": 1,
+ "length_ms": 223085,
+ "play_count": 2,
+ "last_time_played": "2018-02-23T10:31:20Z",
+ "media_kind": "music",
+ "data_kind": "file",
+ "path": "/music/srv/Heinrich/Solange wir tanzen/01 Solange wir tanzen.mp3",
+ "uri": "library:track:10766"
+ },
+ ...
+ ],
+ "total": 20,
+ "offset": 0,
+ "limit": -1
+}
+
Get a specific track in your library
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Track id |
Response
On success returns the HTTP 200 OK
success status response code. With the response body holding the track
object.
Example
{
+ "id": 1,
+ "title": "Pardon Me",
+ "title_sort": "Pardon Me",
+ "artist": "Incubus",
+ "artist_sort": "Incubus",
+ "album": "Make Yourself",
+ "album_sort": "Make Yourself",
+ "album_id": "6683985628074308431",
+ "album_artist": "Incubus",
+ "album_artist_sort": "Incubus",
+ "album_artist_id": "4833612337650426236",
+ "composer": "Alex Katunich/Brandon Boyd/Chris Kilmore/Jose Antonio Pasillas II/Mike Einziger",
+ "genre": "Alternative Rock",
+ "year": 2001,
+ "track_number": 12,
+ "disc_number": 1,
+ "length_ms": 223170,
+ "rating": 0,
+ "usermark": 0,
+ "play_count": 0,
+ "skip_count": 0,
+ "time_added": "2019-01-20T11:58:29Z",
+ "date_released": "2001-05-27",
+ "seek_ms": 0,
+ "media_kind": "music",
+ "data_kind": "file",
+ "path": "/music/srv/Incubus/Make Yourself/12 Pardon Me.mp3",
+ "uri": "library:track:1",
+ "artwork_url": "/artwork/item/1"
+}
+
Get the list of playlists that contain a track (does not return smart playlists)
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Track id |
Query parameters
Parameter | Value |
---|---|
offset | (Optional) Offset of the first playlist to return |
limit | (Optional) Maximum number of playlist to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of playlist objects |
total | integer | Total number of playlists |
offset | integer | Requested offset of the first playlist |
limit | integer | Requested maximum number of playlists |
Example
{
+ "items": [
+ {
+ "id": 1,
+ "name": "playlist",
+ "path": "/music/srv/playlist.m3u",
+ "smart_playlist": false,
+ "uri": "library:playlist:1"
+ },
+ ...
+ ],
+ "total": 2,
+ "offset": 0,
+ "limit": -1
+}
+
Change properties of one or more tracks (supported properties are "rating", "play_count" and "usermark")
Endpoint
Body parameters
Parameter | Type | Value |
---|---|---|
tracks | array | Array of track objects |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT -d '{ "tracks": [ { "id": 1, "rating": 100, "usermark": 4 }, { "id": 2, "usermark": 3 } ] }' "http://localhost:3689/api/library/tracks"
+
Endpoint
Path parameters
Parameter | Value |
---|---|
id | Track id |
Query parameters
Parameter | Value |
---|---|
rating | The new rating (0 - 100) |
play_count | Either increment or reset . increment will increment play_count and update time_played , reset will set play_count and skip_count to zero and delete time_played and time_skipped |
usermark | The new usermark (>= 0) |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Get list of genres
Endpoint
ResponseKey | Type | Value |
---|---|---|
items | array | Array of browse-info objects |
total | integer | Total number of genres in the library |
offset | integer | Requested offset of the first genre |
limit | integer | Requested maximum number of genres |
Example
{
+ "items": [
+ {
+ "name": "Classical"
+ },
+ {
+ "name": "Drum & Bass"
+ },
+ {
+ "name": "Pop"
+ },
+ {
+ "name": "Rock/Pop"
+ },
+ {
+ "name": "'90s Alternative"
+ }
+ ],
+ "total": 5,
+ "offset": 0,
+ "limit": -1
+}
+
Lists the albums in a genre
Endpoint
Query parameters
Parameter | Value |
---|---|
genre | genre name (uri encoded and html esc seq for chars: '/&) |
offset | (Optional) Offset of the first album to return |
limit | (Optional) Maximum number of albums to return |
Response
Key | Type | Value |
---|---|---|
items | array | Array of album objects |
total | integer | Total number of albums in the library |
offset | integer | Requested offset of the first albums |
limit | integer | Requested maximum number of albums |
Example
curl -X GET "http://localhost:3689/api/search?type=albums&expression=genre+is+\"Pop\""
+curl -X GET "http://localhost:3689/api/search?type=albums&expression=genre+is+\"Rock%2FPop\"" # Rock/Pop
+curl -X GET "http://localhost:3689/api/search?type=albums&expression=genre+is+\"Drum%20%26%20Bass\"" # Drum & Bass
+curl -X GET "http://localhost:3689/api/search?type=albums&expression=genre+is+\"%2790s%20Alternative\"" # '90 Alternative
+
{
+ "albums": {
+ "items": [
+ {
+ "id": "320189328729146437",
+ "name": "Best Ever",
+ "name_sort": "Best Ever",
+ "artist": "ABC",
+ "artist_id": "8760559201889050080",
+ "track_count": 1,
+ "length_ms": 3631,
+ "uri": "library:album:320189328729146437"
+ },
+ {
+ "id": "7964595866631625723",
+ "name": "Greatest Hits",
+ "name_sort": "Greatest Hits",
+ "artist": "Marvin Gaye",
+ "artist_id": "5261930703203735930",
+ "track_count": 2,
+ "length_ms": 7262,
+ "uri": "library:album:7964595866631625723"
+ },
+ {
+ "id": "3844610748145176456",
+ "name": "The Very Best of Etta",
+ "name_sort": "Very Best of Etta",
+ "artist": "Etta James",
+ "artist_id": "2627182178555864595",
+ "track_count": 1,
+ "length_ms": 177926,
+ "uri": "library:album:3844610748145176456"
+ }
+ ],
+ "total": 3,
+ "offset": 0,
+ "limit": -1
+ }
+}
+
Get information about the number of tracks, artists and albums and the total playtime
Endpoint
Query parameters
Parameter | Value |
---|---|
expression | (Optional) The smart playlist query expression, if this parameter is omitted returns the information for the whole library |
Response
Key | Type | Value |
---|---|---|
tracks | integer | Number of tracks matching the expression |
artists | integer | Number of artists matching the expression |
albums | integer | Number of albums matching the expression |
db_playtime | integer | Total playtime in milliseconds of all tracks matching the expression |
Example
List the local directories and the directory contents (tracks and playlists)
Endpoint
Query parameters
Parameter | Value |
---|---|
directory | (Optional) A path to a directory in your local library. |
Response
Key | Type | Value |
---|---|---|
directories | array | Array of directory objects containing the sub directories |
tracks | object | paging object containing track objects that matches the directory |
playlists | object | paging object containing playlist objects that matches the directory |
Example
{
+ "directories": [
+ {
+ "path": "/music/srv/Audiobooks"
+ },
+ {
+ "path": "/music/srv/Music"
+ },
+ {
+ "path": "/music/srv/Playlists"
+ },
+ {
+ "path": "/music/srv/Podcasts"
+ }
+ ],
+ "tracks": {
+ "items": [
+ {
+ "id": 1,
+ "title": "input.pipe",
+ "artist": "Unknown artist",
+ "artist_sort": "Unknown artist",
+ "album": "Unknown album",
+ "album_sort": "Unknown album",
+ "album_id": "4201163758598356043",
+ "album_artist": "Unknown artist",
+ "album_artist_sort": "Unknown artist",
+ "album_artist_id": "4187901437947843388",
+ "genre": "Unknown genre",
+ "year": 0,
+ "track_number": 0,
+ "disc_number": 0,
+ "length_ms": 0,
+ "play_count": 0,
+ "skip_count": 0,
+ "time_added": "2018-11-24T08:41:35Z",
+ "seek_ms": 0,
+ "media_kind": "music",
+ "data_kind": "pipe",
+ "path": "/music/srv/input.pipe",
+ "uri": "library:track:1",
+ "artwork_url": "/artwork/item/1"
+ }
+ ],
+ "total": 1,
+ "offset": 0,
+ "limit": -1
+ },
+ "playlists": {
+ "items": [
+ {
+ "id": 8,
+ "name": "radio",
+ "path": "/music/srv/radio.m3u",
+ "smart_playlist": true,
+ "uri": "library:playlist:8"
+ }
+ ],
+ "total": 1,
+ "offset": 0,
+ "limit": -1
+ }
+}
+
This endpoint currently only supports addind RSS feeds.
Endpoint
Query parameters
Parameter | Value |
---|---|
url | URL of the RSS to add |
Response
On success returns the HTTP 200 OK
success status response code.
Example
Trigger a library rescan
Endpoint
Response
On success returns the HTTP 204 No Content
success status response code.
Example
{
+ "songs": 217,
+ "db_playtime": 66811,
+ "artists": 9,
+ "albums": 19,
+ "started_at": "2018-11-19T19:06:08Z",
+ "updated_at": "2018-11-19T19:06:16Z",
+ "updating": false
+}
+
Trigger a library metadata rescan even if files have not been updated. Maintenence method.
Endpoint
Response
On success returns the HTTP 204 No Content
success status response code.
Example
Request a library backup - configuration must be enabled and point to a valid writable path. Maintenance method.
Endpoint
Response
On success returns the HTTP 200 OK
success status response code. If backups are not enabled returns HTTP 503 Service Unavailable
response code. Otherwise a HTTP 500 Internal Server Error
response is returned.
Example
Method | Endpoint | Description |
---|---|---|
GET | /api/search | Search for playlists, artists, albums, tracks,genres by a simple search term |
GET | /api/search | Search by complex query expression |
Search for playlists, artists, albums, tracks, genres that include the given query in their title (case insensitive matching).
Endpoint
Query parameters
Parameter | Value |
---|---|
query | The search keyword |
type | Comma separated list of the result types (playlist , artist , album , track , genre ) |
media_kind | (Optional) Filter results by media kind (music , movie , podcast , audiobook , musicvideo , tvshow ). Filter only applies to artist, album and track result types. |
offset | (Optional) Offset of the first item to return for each type |
limit | (Optional) Maximum number of items to return for each type |
Response
Key | Type | Value |
---|---|---|
tracks | object | paging object containing track objects that matches the query |
artists | object | paging object containing artist objects that matches the query |
albums | object | paging object containing album objects that matches the query |
playlists | object | paging object containing playlist objects that matches the query |
Example
Search for all tracks, artists, albums and playlists that contain "the" in their title and return the first two results for each type:
curl -X GET "http://localhost:3689/api/search?type=tracks,artists,albums,playlists&query=the&offset=0&limit=2"
+
{
+ "tracks": {
+ "items": [
+ {
+ "id": 35,
+ "title": "Another Love",
+ "artist": "Tom Odell",
+ "artist_sort": "Tom Odell",
+ "album": "Es is was es is",
+ "album_sort": "Es is was es is",
+ "album_id": "6494853621007413058",
+ "album_artist": "Various artists",
+ "album_artist_sort": "Various artists",
+ "album_artist_id": "8395563705718003786",
+ "genre": "Singer/Songwriter",
+ "year": 2013,
+ "track_number": 7,
+ "disc_number": 1,
+ "length_ms": 251030,
+ "play_count": 0,
+ "media_kind": "music",
+ "data_kind": "file",
+ "path": "/music/srv/Compilations/Es is was es is/07 Another Love.m4a",
+ "uri": "library:track:35"
+ },
+ {
+ "id": 215,
+ "title": "Away From the Sun",
+ "artist": "3 Doors Down",
+ "artist_sort": "3 Doors Down",
+ "album": "Away From the Sun",
+ "album_sort": "Away From the Sun",
+ "album_id": "8264078270267374619",
+ "album_artist": "3 Doors Down",
+ "album_artist_sort": "3 Doors Down",
+ "album_artist_id": "5030128490104968038",
+ "genre": "Rock",
+ "year": 2002,
+ "track_number": 2,
+ "disc_number": 1,
+ "length_ms": 233278,
+ "play_count": 0,
+ "media_kind": "music",
+ "data_kind": "file",
+ "path": "/music/srv/Away From the Sun/02 Away From the Sun.mp3",
+ "uri": "library:track:215"
+ }
+ ],
+ "total": 14,
+ "offset": 0,
+ "limit": 2
+ },
+ "artists": {
+ "items": [
+ {
+ "id": "8737690491750445895",
+ "name": "The xx",
+ "name_sort": "xx, The",
+ "album_count": 2,
+ "track_count": 25,
+ "length_ms": 5229196,
+ "uri": "library:artist:8737690491750445895"
+ }
+ ],
+ "total": 1,
+ "offset": 0,
+ "limit": 2
+ },
+ "albums": {
+ "items": [
+ {
+ "id": "8264078270267374619",
+ "name": "Away From the Sun",
+ "name_sort": "Away From the Sun",
+ "artist": "3 Doors Down",
+ "artist_id": "5030128490104968038",
+ "track_count": 12,
+ "length_ms": 2818174,
+ "uri": "library:album:8264078270267374619"
+ },
+ {
+ "id": "6835720495312674468",
+ "name": "The Better Life",
+ "name_sort": "Better Life",
+ "artist": "3 Doors Down",
+ "artist_id": "5030128490104968038",
+ "track_count": 11,
+ "length_ms": 2393332,
+ "uri": "library:album:6835720495312674468"
+ }
+ ],
+ "total": 3,
+ "offset": 0,
+ "limit": 2
+ },
+ "playlists": {
+ "items": [],
+ "total": 0,
+ "offset": 0,
+ "limit": 2
+ }
+}
+
Search for artists, albums, tracks by a smart playlist query expression (see README_SMARTPL.md for the expression syntax).
Endpoint
Query parameters
Parameter | Value |
---|---|
expression | The smart playlist query expression |
type | Comma separated list of the result types (artist , album , track |
offset | (Optional) Offset of the first item to return for each type |
limit | (Optional) Maximum number of items to return for each type |
Response
Key | Type | Value |
---|---|---|
tracks | object | paging object containing track objects that matches the query |
artists | object | paging object containing artist objects that matches the query |
albums | object | paging object containing album objects that matches the query |
Example
Search for music tracks ordered descending by the time added to the library and limit result to 2 items:
curl -X GET "http://localhost:3689/api/search?type=tracks&expression=media_kind+is+music+order+by+time_added+desc&offset=0&limit=2"
+
Method | Endpoint | Description |
---|---|---|
GET | /api/config | Get configuration information |
Endpoint
Response
Key | Type | Value |
---|---|---|
version | string | Server version |
websocket_port | integer | Port number for the websocket (or 0 if websocket is disabled) |
buildoptions | array | Array of strings indicating which features are supported by the server |
Example
{
+ "websocket_port": 3688,
+ "version": "25.0",
+ "buildoptions": [
+ "ffmpeg",
+ "iTunes XML",
+ "Spotify",
+ "LastFM",
+ "MPD",
+ "Device verification",
+ "Websockets",
+ "ALSA"
+ ]
+}
+
Method | Endpoint | Description |
---|---|---|
GET | /api/settings | Get all available categories |
GET | /api/settings/{category-name} | Get all available options for a category |
GET | /api/settings/{category-name}/{option-name} | Get a single setting option |
PUT | /api/settings/{category-name}/{option-name} | Change the value of a setting option |
DELETE | /api/settings/{category-name}/{option-name} | Reset a setting option to its default |
List all settings categories with their options
Endpoint
Response
Key | Type | Value |
---|---|---|
categories | array | Array of settings category objects |
Example
{
+ "categories": [
+ {
+ "name": "webinterface",
+ "options": [
+ {
+ "name": "show_composer_now_playing",
+ "type": 1,
+ "value": true
+ },
+ {
+ "name": "show_composer_for_genre",
+ "type": 2,
+ "value": "classical"
+ }
+ ]
+ }
+ ]
+}
+
Get a settings category with their options
Endpoint
Response
Returns a settings category object
Example
{
+ "name": "webinterface",
+ "options": [
+ {
+ "name": "show_composer_now_playing",
+ "type": 1,
+ "value": true
+ },
+ {
+ "name": "show_composer_for_genre",
+ "type": 2,
+ "value": "classical"
+ }
+ ]
+}
+
Get a single settings option
Endpoint
Response
Returns a settings option object
Example
Get a single settings option
Endpoint
Request
Key | Type | Value |
---|---|---|
name | string | Option name |
value | (integer / boolean / string) | New option value |
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT "http://localhost:3689/api/settings/webinterface/show_composer_now_playing" --data "{\"name\":\"show_composer_now_playing\",\"value\":true}"
+
Delete a single settings option (thus resetting it to default)
Endpoint
Response
On success returns the HTTP 204 No Content
success status response code.
Example
If the server was built with websocket support it exposes a websocket at localhost:3688
to inform clients of changes (e. g. player state or library updates). The port depends on the server configuration and can be read using the /api/config
endpoint.
After connecting to the websocket, the client should send a message containing the event types it is interested in. After that the server will send a message each time one of the events occurred.
Message
Key | Type | Value |
---|---|---|
notify | array | Array of event types |
Event types
Type | Description |
---|---|
update | Library update started or finished |
database | Library database changed (new/modified/deleted tracks) |
outputs | An output was enabled or disabled |
player | Player state changes |
options | Playback option changes (shuffle, repeat, consume mode) |
volume | Volume changes |
queue | Queue changes |
Example
curl --include \
+ --no-buffer \
+ --header "Connection: Upgrade" \
+ --header "Upgrade: websocket" \
+ --header "Host: localhost:3688" \
+ --header "Origin: http://localhost:3688" \
+ --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
+ --header "Sec-WebSocket-Version: 13" \
+ --header "Sec-WebSocket-Protocol: notify" \
+ http://localhost:3688/ \
+ --data "{ \"notify\": [ \"player\" ] }"
+
queue item
object¶Key | Type | Value |
---|---|---|
id | string | Item id |
position | integer | Position in the queue (starting with zero) |
track_id | string | Track id |
title | string | Title |
artist | string | Track artist name |
artist_sort | string | Track artist sort name |
album | string | Album name |
album_sort | string | Album sort name |
album_id | string | Album id |
album_artist | string | Album artist name |
album_artist_sort | string | Album artist sort name |
album_artist_id | string | Album artist id |
composer | string | Composer (optional) |
genre | string | Genre |
year | integer | Release year |
track_number | integer | Track number |
disc_number | integer | Disc number |
length_ms | integer | Track length in milliseconds |
media_kind | string | Media type of this track: music , movie , podcast , audiobook , musicvideo , tvshow |
data_kind | string | Data type of this track: file , url , spotify , pipe |
path | string | Path |
uri | string | Resource identifier |
artwork_url | string | (optional) Artwork url |
type | string | file (codec) type (ie mp3/flac/...) |
bitrate | string | file bitrate (ie 192/128/...) |
samplerate | string | file sample rate (ie 44100/48000/...) |
channel | string | file channel (ie mono/stereo/xx ch)) |
playlist
object¶Key | Type | Value |
---|---|---|
id | string | Playlist id |
name | string | Playlist name |
path | string | Path |
parent_id | integer | Playlist id of the parent (folder) playlist |
type | string | Type of this playlist: special , folder , smart , plain |
smart_playlist | boolean | true if playlist is a smart playlist |
folder | boolean | true if it is a playlist folder |
uri | string | Resource identifier |
artist
object¶Key | Type | Value |
---|---|---|
id | string | Artist id |
name | string | Artist name |
name_sort | string | Artist sort name |
album_count | integer | Number of albums |
track_count | integer | Number of tracks |
length_ms | integer | Total length of tracks in milliseconds |
uri | string | Resource identifier |
artwork_url | string | (optional) Artwork url |
album
object¶Key | Type | Value |
---|---|---|
id | string | Album id |
name | string | Album name |
name_sort | string | Album sort name |
artist_id | string | Album artist id |
artist | string | Album artist name |
track_count | integer | Number of tracks |
length_ms | integer | Total length of tracks in milliseconds |
uri | string | Resource identifier |
artwork_url | string | (optional) Artwork url |
track
object¶Key | Type | Value |
---|---|---|
id | integer | Track id |
title | string | Title |
title_sort | string | Sort title |
artist | string | Track artist name |
artist_sort | string | Track artist sort name |
album | string | Album name |
album_sort | string | Album sort name |
album_id | string | Album id |
album_artist | string | Album artist name |
album_artist_sort | string | Album artist sort name |
album_artist_id | string | Album artist id |
composer | string | Track composer |
genre | string | Genre |
comment | string | Comment |
year | integer | Release year |
track_number | integer | Track number |
disc_number | integer | Disc number |
length_ms | integer | Track length in milliseconds |
rating | integer | Track rating (ranges from 0 to 100) |
play_count | integer | How many times the track was played |
skip_count | integer | How many times the track was skipped |
time_played | string | Timestamp in ISO 8601 format |
time_skipped | string | Timestamp in ISO 8601 format |
time_added | string | Timestamp in ISO 8601 format |
date_released | string | Date in the format yyyy-mm-dd |
seek_ms | integer | Resume point in milliseconds (available only for podcasts and audiobooks) |
media_kind | string | Media type of this track: music , movie , podcast , audiobook , musicvideo , tvshow |
data_kind | string | Data type of this track: file , url , spotify , pipe |
path | string | Path |
uri | string | Resource identifier |
artwork_url | string | (optional) Artwork url |
usermark | integer | User review marking of track (ranges from 0) |
paging
object¶Key | Type | Value |
---|---|---|
items | array | Array of result objects |
total | integer | Total number of items |
offset | integer | Requested offset of the first item |
limit | integer | Requested maximum number of items |
browse-info
object¶Key | Type | Value |
---|---|---|
name | string | Name (depends on the type of the query) |
name_sort | string | Sort name |
artist_count | integer | Number of artists |
album_count | integer | Number of albums |
track_count | integer | Number of tracks |
time_played | string | Timestamp in ISO 8601 format |
time_added | string | Timestamp in ISO 8601 format |
directory
object¶Key | Type | Value |
---|---|---|
path | string | Directory path |
category
object¶Key | Type | Value |
---|---|---|
name | string | Category name |
options | array | Array of option in this category |
option
object¶Key | Type | Value |
---|---|---|
name | string | Option name |
type | integer | The type of the value for this option (0 : integer, 1 : boolean, 2 : string) |
value | (integer / boolean / string) | Current value for this option |
Artwork urls in queue item
, artist
, album
and track
objects can be either relative urls or absolute urls to the artwork image. Absolute artwork urls are pointing to external artwork images (e. g. for radio streams that provide artwork metadata), while relative artwork urls are served from the server.
It is possible to add the query parameters maxwidth
and/or maxheight
to relative artwork urls, in order to get a smaller image (the server only scales down never up).
Note that even if a relative artwork url attribute is present, it is not guaranteed to exist.
The library is scanned in bulk mode at startup, but the server will be available even while this scan is in progress. You can follow the progress of the scan in the log file or via the web interface. When the scan is complete you will see the log message: "Bulk library scan completed in X sec".
The very first scan will take longer than subsequent startup scans, since every file gets analyzed. At the following startups the server looks for changed files and only analyzis those.
Updates to the library are reflected in real time after the initial scan, so you do not need to manually start rescans. The directories are monitored for changes and rescanned on the fly. Note that if you have your library on a network mount then real time updating may not work. Read below about what to do in that case.
If you change any of the directory settings in the library section of the configuration file a rescan is required before the new setting will take effect. You can do this by using "Update library" from the web interface.
Symlinks are supported and dereferenced, but it is best to use them for directories only.
Files starting with . (dot) and _ (underscore) are ignored.
Some programs, like for instance Shairport-sync, can be configured to output audio to a named pipe. If this pipe is placed in the library, OwnTone will automatically detect that it is there, and when there is audio being written to it, playback of the audio will be autostarted (and stopped).
Using this feature, OwnTone can act as an AirPlay multiroom "router": You can have an AirPlay source (e.g. your iPhone) send audio Shairport-sync, which forwards it to OwnTone through the pipe, which then plays it on whatever speakers you have selected (through Remote).
The format of the audio being written to the pipe must be PCM16.
You can also start playback of pipes manually. You will find them in remotes listed under "Unknown artist" and "Unknown album". The track title will be the name of the pipe.
Shairport-sync can write metadata to a pipe, and OwnTone can read this. This requires that the metadata pipe has the same filename as the audio pipe plus a ".metadata" suffix. Say Shairport-sync is configured to write audio to "/foo/bar/pipe", then the metadata pipe should be "/foo/bar/pipe.metadata".
Most network filesharing protocols do not offer notifications when the library is changed. So that means OwnTone cannot update its database in real time. Instead you can schedule a cron job to update the database.
The first step in doing this is to add two entries to the 'directories' configuration item in owntone.conf:
Now you can make a cron job that runs this command:
When OwnTone detects a file with filename ending .init-rescan it will perform a bulk scan similar to the startup scan.
Alternatively, you can force a metadata scan of the library even if the files have not changed by creating a filename ending .meta-rescan
.
OwnTone should support pretty much all audio formats. It relies on libav (or ffmpeg) to extract metadata and decode the files on the fly when the client doesn't support the format.
Formats are attributed a code, so any new format will need to be explicitely added. Currently supported:
If you place a file with the filename ending .full-rescan in your library, you can trigger a full rescan of your library. This will clear all music and playlists from OwnTone's database and initiate a fresh bulk scan. Pairing and speaker information will be kept. Only use this for troubleshooting, it is not necessary during normal operation.
OwnTone will discover the AirPlay devices available on your network. For devices that are password-protected, the device's AirPlay name and password must be given in the configuration file. See the sample configuration file for the syntax.
If your Apple TV requires device verification (always required by Apple TV4 with tvOS 10.2) then you can do that through Settings > Remotes & Outputs in the web interface: Select the device and then enter the PIN that the Apple TV displays.
If your speaker is silent when you start playback, and there is no obvious error message in the log, you can try disabling ipv6 in the config. Some speakers announce that they support ipv6, but in fact don't (at least not with forked- daapd).
If the speaker becomes unselected when you start playback, and you in the log see "ANNOUNCE request failed in session startup: 400 Bad Request", then try the Apple Home app > Allow Speakers & TV Access > Anyone On the Same Network (or Everyone).
OwnTone will discover Chromecast devices available on your network, and you can then select the device as a speaker. There is no configuration required.
In the config file, you can select ALSA for local audio. This is the default.
When using ALSA, the server will try to syncronize playback with AirPlay. You can adjust the syncronization in the config file.
For most setups the default values in the config file should work. If they don't, there is help here
In the config file, you can select Pulseaudio for local audio. In addition to local audio, Pulseaudio also supports an array of other targets, e.g. Bluetooth or DLNA. However, Pulseaudio does require some setup, so here is a separate page with some help on that: Pulse audio
Note that if you select Pulseaudio the "card" setting in the config file has no effect. Instead all soundcards detected by Pulseaudio will be listed as speakers by OwnTone.
You can adjust the latency of Pulseaudio playback in the config file.
You can listen to audio being played by OwnTone by opening this network stream address in pretty much any music player:
http://owntone.local:3689/stream.mp3 or http://SERVER_ADDRESS:3689/stream.mp3
This is currently the only way of listening to your audio on iOS devices, since Apple does not allow AirPlay receiver apps, and because Apple Home Sharing cannot be supported by OwnTone. So what you can do instead is install a music player app like VLC, connect to the stream and control playback with Remote.
In the speaker selection list, clicking on the icon should start the stream playing in the background on browsers that support that.
Note that MP3 encoding must be supported by ffmpeg/libav for this to work. If it is not available you will see a message in the log file. In Debian/Ubuntu you get MP3 encoding support by installing the package "libavcodec-extra".
OwnTone supports M3U and PLS playlists. Just drop your playlist somewhere in your library with an .m3u or .pls extension and it will pick it up.
From the web interface, and some mpd clients, you can also create and modify playlists by saving the current queue. Click the "Save" button. Note that this requires that allow_modifying_stored_playlists
is enabled in the configuration file, and that the server has write access to default_playlist_directory
.
If the playlist contains an http URL it will be added as an internet radio station, and the URL will be probed for Shoutcast (ICY) metadata. If the radio station provides artwork, OwnTone will download it during playback and send it to any remotes or AirPlay devices requesting it.
Instead of downloading M3U's from your radio stations, you can also make an empty M3U file and insert links in it to the M3U's of your radio stations.
Radio streams can only be played by OwnTone, so that means they will not be available to play in DAAP clients like iTunes.
The server can import playlists from iTunes Music Library XML files. By default, metadata from our parsers is preferred over what's in the iTunes DB; use itunes_overrides = true if you prefer iTunes' metadata.
OwnTone has support for smart playlists. How to create a smart playlist is documented in Smart playlists.
If you're not satisfied with internet radio metadata that OwnTone shows, then you can read about tweaking it in Radio streams.
OwnTone is an open source (audio) media server for GNU/Linux, FreeBSD and MacOS.
It allows sharing and streaming your media library to iTunes (DAAP1), Roku (RSP), AirPlay devices (multiroom), Chromecast and also supports local playback.
You can control OwnTone via its web interface, Apple Remote (and compatible DAAP/DACP clients), MPD clients or via its JSON API.
Besides serving your local music, podcast and audiobook media files, OwnTone supports internet radios and Spotify (requires Spotify premium account).
Prior to version 28, OwnTone was called forked-daapd, which again was a rewrite of mt-daapd (Firefly Media Server).
OwnTone is written in C with a web interface written in Vue.js.
"},{"location":"#features","title":"Features","text":"Supports multiple different clients:
Supports music and audiobook files, podcast files and RSS and internet radio
(You can find more screenshots from OwnTone's web interface here)
"},{"location":"#looking-for-help","title":"Looking for help?","text":"Before you continue, make sure you know what version of OwnTone you have, and what features it was built with (e.g. Spotify support).
How to find out? Go to the web interface and check. No web interface? Then check the top of OwnTone's log file (usually /var/log/owntone.log).
Note that you are viewing a snapshot of the instructions that may or may not match the version of OwnTone that you are using.
If you are looking for help on building OwnTone (not using it), then please see the documentation on Building from Source.
"},{"location":"#references","title":"References","text":"You can find source and documentation, also for older versions, here:
DAAP stands for Digital Audio Access Protocol which is the protocol used by iTunes and friends to share/stream media libraries over the network.\u00a0\u21a9
OwnTone has support for PNG and JPEG artwork which is either:
For media in your library, OwnTone will try to locate album and artist artwork (group artwork) by the following procedure:
{artwork,cover,Folder} are the default, you can add other base names in the configuration file. Here you can also enable/disable support for individual file artwork (instead of using the same artwork for all tracks in an entire album).
For playlists in your library, say /foo/bar.m3u, then for any http streams in the list, OwnTone will look for /foo/bar.{jpg,png}.
You can use symlinks for the artwork files.
OwnTone caches artwork in a separate cache file. The default path is /var/cache/owntone/cache.db
and can be configured in the configuration file. The cache.db file can be deleted without losing the library and pairing informations.
This document contains instructions for building OwnTone from the git tree. If you just want to build from a release tarball, you don't need the build tools (git, autotools, autoconf, automake, gawk, gperf, gettext, bison and flex), and you can skip the autoreconf step.
"},{"location":"building/#quick-version-for-debianubuntu-users","title":"Quick version for Debian/Ubuntu users","text":"If you are the lucky kind, this should get you all the required tools and libraries:
sudo apt-get install \\\nbuild-essential git autotools-dev autoconf automake libtool gettext gawk \\\ngperf bison flex libconfuse-dev libunistring-dev libsqlite3-dev \\\nlibavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev \\\nlibasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev \\\nlibevent-dev libplist-dev libsodium-dev libjson-c-dev libwebsockets-dev \\\nlibcurl4-openssl-dev libprotobuf-c-dev\n
Note that OwnTone will also work with other versions and flavours of libgcrypt and libcurl, so the above are just suggestions.
The following features require extra packages, and that you add a configure argument when you run ./configure:
Feature Configure argument Packages Chromecast--enable-chromecast
libgnutls*-dev Pulseaudio --with-pulseaudio
libpulse-dev These features can be disabled saving you package dependencies:
Feature Configure argument Packages Spotify (built-in)--disable-spotify
libprotobuf-c-dev Player web UI --disable-webinterface
libwebsockets-dev Live web UI --without-libwebsockets
libwebsockets-dev Then run the following (adding configure arguments for optional features):
git clone https://github.com/owntone/owntone-server.git\ncd owntone-server\nautoreconf -i\n./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user\nmake\nsudo make install\n
Using --enable-install-user
means that make install
will also add system user and group for owntone.
With the above configure arguments, a systemd service file will be installed to /etc/systemd/system/owntone.service
so that the server will start on boot. Use --disable-install-systemd
if you don't want that.
Now edit /etc/owntone.conf
. Note the guide at the top highlighting which settings that normally require modification.
Start the server with sudo systemctl start owntone
and check that it is running with sudo systemctl status owntone
.
See the Documentation for usage information.
"},{"location":"building/#quick-version-for-fedora","title":"Quick version for Fedora","text":"If you haven't already enabled the free RPM fusion packages do that, since you will need ffmpeg. You can google how to do that. Then run:
sudo dnf install \\\ngit automake autoconf gettext-devel gperf gawk libtool bison flex \\\nsqlite-devel libconfuse-devel libunistring-devel mxml-devel libevent-devel \\\navahi-devel libgcrypt-devel zlib-devel alsa-lib-devel ffmpeg-devel \\\nlibplist-devel libsodium-devel json-c-devel libwebsockets-devel \\\nlibcurl-devel protobuf-c-devel\n
Clone the OwnTone repo:
git clone https://github.com/owntone/owntone-server.git\ncd owntone-server\n
Then run the following:
autoreconf -i\n./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user\nmake\nsudo make install\n
Using --enable-install-user
means that make install
will also add system user and group for owntone.
With the above configure arguments, a systemd service file will be installed to /etc/systemd/system/owntone.service
so that the server will start on boot. Use --disable-install-systemd
if you don't want that.
Now edit /etc/owntone.conf
. Note the guide at the top highlighting which settings that normally require modification.
Start the server with sudo systemctl start owntone
and check that it is running with sudo systemctl status owntone
.
See the Documentation for usage information.
"},{"location":"building/#quick-version-for-freebsd","title":"Quick version for FreeBSD","text":"There is a script in the 'scripts' folder that will at least attempt to do all the work for you. And should the script not work for you, you can still look through it and use it as an installation guide.
"},{"location":"building/#quick-version-for-macos-using-homebrew","title":"Quick version for macOS (using Homebrew)","text":"This workflow file used for building OwnTone via Github actions includes all the steps that you need to execute: .github/workflows/macos.yml
"},{"location":"building/#quick-version-for-macos-using-macports","title":"\"Quick\" version for macOS (using macports)","text":"Caution: 1) this approach may be out of date, consider using the Homebrew method above since it is continuously tested. 2) macports requires many downloads and lots of time to install (and sometimes build) ports... you'll want a decent network connection and some patience!
Install macports (which requires Xcode): https://www.macports.org/install.php
sudo port install \\\nautoconf automake libtool pkgconfig git gperf bison flex libgcrypt \\\nlibunistring libconfuse ffmpeg libevent json-c libwebsockets curl \\\nlibplist libsodium protobuf-c\n
Download, configure, build and install the Mini-XML library: http://www.msweet.org/projects.php/Mini-XML
Download, configure, build and install the libinotify library: https://github.com/libinotify-kqueue/libinotify-kqueue
Add the following to .bashrc
:
# add /usr/local to pkg-config path\nexport PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig\n# libunistring doesn't support pkg-config, set overrides\nexport LIBUNISTRING_CFLAGS=-I/opt/local/include\nexport LIBUNISTRING_LIBS=\"-L/opt/local/lib -lunistring\"\n
Optional features require the following additional ports:
Feature Configure argument Ports Chromecast--enable-chromecast
gnutls Pulseaudio --with-pulseaudio
pulseaudio Clone the OwnTone repo:
git clone https://github.com/owntone/owntone-server.git\ncd owntone-server\n
Finally, configure, build and install, adding configure arguments for optional features:
autoreconf -i\n./configure\nmake\nsudo make install\n
Note: if for some reason you've installed the avahi port, you need to add --without-avahi
to configure above.
Edit /usr/local/etc/owntone.conf
and change the uid
to a nice system daemon (eg: unknown), and run the following:
sudo mkdir -p /usr/local/var/run\nsudo mkdir -p /usr/local/var/log # or change logfile in conf\nsudo chown unknown /usr/local/var/cache/owntone # or change conf\n
Run OwnTone:
sudo /usr/local/sbin/owntone\n
Verify it's running (you need to Ctrl+C to stop dns-sd):
dns-sd -B _daap._tcp\n
"},{"location":"building/#long-version-requirements","title":"Long version - requirements","text":"Required tools:
autoreconf -i
at the top of the source tree to generate the build system.Libraries:
If using binary packages, remember that you need the development packages to build OwnTone (usually named -dev or -devel).
sqlite3 needs to be built with support for the unlock notify API; this isn't always the case in binary packages, so you may need to rebuild sqlite3 to enable the unlock notify API (you can check for the presence of the sqlite3_unlock_notify symbol in the sqlite3 library). Refer to the sqlite3 documentation, look for SQLITE_ENABLE_UNLOCK_NOTIFY
.
Start by generating the build system by running autoreconf -i
. This will generate the configure script and Makefile.in
.
To display the configure options run ./configure --help
.
Support for Spotify is optional. Use --disable-spotify
to disable this feature.
Support for LastFM scrobbling is optional. Use --enable-lastfm
to enable this feature.
Support for the MPD protocol is optional. Use --disable-mpd
to disable this feature.
Support for Chromecast devices is optional. Use --enable-chromecast
to enable this feature.
The player web interface is optional. Use --disable-webinterface
to disable this feature. If enabled, sudo make install
will install the prebuild html, js, css files. The prebuild files are:
htdocs/index.html
htdocs/player/*
The source for the player web interface is located under the web-src
folder and requires nodejs >= 6.0 to be built. In the web-src
folder run npm install
to install all dependencies for the player web interface. After that run npm run build
. This will build the web interface and update the htdocs
folder. (See Web interface for more informations)
Building with libwebsockets is required if you want the web interface. It will be enabled if the library is present (with headers). Use --without-libwebsockets
to disable.
Building with Pulseaudio is optional. It will be enabled if the library is present (with headers). Use --without-pulseaudio
to disable.
Recommended build settings:
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user\n
After configure run the usual make, and if that went well, sudo make install
.
With the above configure arguments, a systemd service file will be installed to /etc/systemd/system/owntone.service
so that the server will start on boot. Use --disable-install-systemd
if you don't want that.
Using --enable-install-user
means that make install
will also add a system user and group for owntone.
After installation:
/etc/owntone.conf
apt install avahi-daemon
)OwnTone will drop privileges to any user you specify in the configuration file if it's started as root.
This user must have read permission to your library and read/write permissions to the database location ($localstatedir/cache/owntone
by default).
OwnTone is meant to be run as system wide daemon, but for development purposes you may want to run it isolated to your regular user.
The following description assumes that you want all runtime data stored in $HOME/owntone_data
and the source in $HOME/projects/owntone-server
.
Prepare directories for runtime data:
mkdir -p $HOME/owntone_data/etc\nmkdir -p $HOME/owntone_data/media\n
Copy one or more mp3 file to test with to owntone_data/media
.
Checkout OwnTone and configure build:
cd $HOME/projects\ngit clone https://github.com/owntone/owntone-server.git\ncd owntone-server\nautoreconf -vi\n./configure --prefix=$HOME/owntone_data/usr --sysconfdir=$HOME/owntone_data/etc --localstatedir=$HOME/owntone_data/var\n
Build and install runtime:
make install\n
Edit owntone_data/etc/owntone.conf
, find the following configuration settings and set them to these values:
uid = ${USER}\n loglevel = \"debug\"\n directories = { \"${HOME}/owntone_data/media\" }\n
Run the server:
./src/owntone -f\n
(you can also use the copy of the binary in $HOME/owntone_data/usr/sbin
)"},{"location":"getting-started/","title":"Getting started","text":"After installation (see Installation) do the following:
/etc/owntone.conf
) to suit your needs/etc/init.d/owntone restart
)You can compile and run OwnTone on pretty much any Linux- or BSD-platform. The instructions are here.
Apt repositories, images and precompiled binaries are available for some platforms. These can save you some work and make it easier to stay up to date:
Platform How to get RPi w/Raspberry Pi OS Add OwnTone repository to apt sources, see:OwnTone server (iTunes server) - Raspberry Pi Forums Debian/Ubuntu amd64 Download .deb as artifact from Github workflow(requires that you are logged in) OpenWrt Runopkg install libwebsockets-full owntone
Docker See linuxserver/docker-daapd OwnTone is not in the official Debian repositories due to lack of Debian maintainer and Debian policy difficulties concerning the web UI, see this issue.
"},{"location":"json-api/","title":"OwnTone API Endpoint Reference","text":"Available API endpoints:
JSON-Object model:
Endpoint
GET /api/player\n
Response
Key Type Value state stringplay
, pause
or stop
repeat string off
, all
or single
consume boolean true
if consume mode is enabled shuffle boolean true
if shuffle mode is enabled volume integer Master volume in percent (0 - 100) item_id integer The current playing queue item id
item_length_ms integer Total length in milliseconds of the current queue item item_progress_ms integer Progress into the current queue item in milliseconds Example
curl -X GET \"http://localhost:3689/api/player\"\n
{\n\"state\": \"pause\",\n\"repeat\": \"off\",\n\"consume\": false,\n\"shuffle\": false,\n\"volume\": 50,\n\"item_id\": 269,\n\"item_length_ms\": 278093,\n\"item_progress_ms\": 3674\n}\n
"},{"location":"json-api/#control-playback","title":"Control playback","text":"Start or resume, pause, stop playback.
Endpoint
PUT /api/player/play\n
PUT /api/player/pause\n
PUT /api/player/stop\n
PUT /api/player/toggle\n
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/player/play\"\n
curl -X PUT \"http://localhost:3689/api/player/pause\"\n
curl -X PUT \"http://localhost:3689/api/player/stop\"\n
curl -X PUT \"http://localhost:3689/api/player/toggle\"\n
"},{"location":"json-api/#skip-tracks","title":"Skip tracks","text":"Skip forward or backward
Endpoint
PUT /api/player/next\n
PUT /api/player/previous\n
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/player/next\"\n
curl -X PUT \"http://localhost:3689/api/player/previous\"\n
"},{"location":"json-api/#set-shuffle-mode","title":"Set shuffle mode","text":"Enable or disable shuffle mode
Endpoint
PUT /api/player/shuffle\n
Query parameters
Parameter Value state The new shuffle state, should be eithertrue
or false
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/player/shuffle?state=true\"\n
"},{"location":"json-api/#set-consume-mode","title":"Set consume mode","text":"Enable or disable consume mode
Endpoint
PUT /api/player/consume\n
Query parameters
Parameter Value state The new consume state, should be eithertrue
or false
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/player/consume?state=true\"\n
"},{"location":"json-api/#set-repeat-mode","title":"Set repeat mode","text":"Change repeat mode
Endpoint
PUT /api/player/repeat\n
Query parameters
Parameter Value state The new repeat mode, should be eitheroff
, all
or single
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/player/repeat?state=all\"\n
"},{"location":"json-api/#set-volume","title":"Set volume","text":"Change master volume or volume of a specific output.
Endpoint
PUT /api/player/volume\n
Query parameters
Parameter Value volume The new volume (0 - 100) step The increase or decrease volume by the given amount (-100 - 100) output_id (Optional) If an output id is given, only the volume of this output will be changed. If parameter is omited, the master volume will be changed.Either volume
or step
must be present as query parameter
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/player/volume?volume=50\"\n
curl -X PUT \"http://localhost:3689/api/player/volume?step=-5\"\n
curl -X PUT \"http://localhost:3689/api/player/volume?volume=50&output_id=0\"\n
"},{"location":"json-api/#seek","title":"Seek","text":"Seek to a position in the currently playing track.
Endpoint
PUT /api/player/seek\n
Query parameters
Parameter Value position_ms The new position in milliseconds to seek to seek_ms A relative amount of milliseconds to seek toResponse
On success returns the HTTP 204 No Content
success status response code.
Example
Seek to position:
curl -X PUT \"http://localhost:3689/api/player/seek?position_ms=2000\"\n
Relative seeking (skip 30 seconds backwards):
curl -X PUT \"http://localhost:3689/api/player/seek?seek_ms=-30000\"\n
"},{"location":"json-api/#outputs-speakers","title":"Outputs / Speakers","text":"Method Endpoint Description GET /api/outputs Get a list of available outputs PUT /api/outputs/set Set enabled outputs GET /api/outputs/{id} Get an output PUT /api/outputs/{id} Change an output setting PUT /api/outputs/{id}/toggle Enable or disable an output, depending on the current state"},{"location":"json-api/#get-a-list-of-available-outputs","title":"Get a list of available outputs","text":"Endpoint
GET /api/outputs\n
Response
Key Type Value outputs array Array ofoutput
objects output
object
AirPlay
, Chromecast
, ALSA
, Pulseaudio
, fifo
selected boolean true
if output is enabled has_password boolean true
if output is password protected requires_auth boolean true
if output requires authentication needs_auth_key boolean true
if output requires an authorization key (device verification) volume integer Volume in percent (0 - 100) Example
curl -X GET \"http://localhost:3689/api/outputs\"\n
{\n\"outputs\": [\n{\n\"id\": \"123456789012345\",\n\"name\": \"kitchen\",\n\"type\": \"AirPlay\",\n\"selected\": true,\n\"has_password\": false,\n\"requires_auth\": false,\n\"needs_auth_key\": false,\n\"volume\": 0\n},\n{\n\"id\": \"0\",\n\"name\": \"Computer\",\n\"type\": \"ALSA\",\n\"selected\": true,\n\"has_password\": false,\n\"requires_auth\": false,\n\"needs_auth_key\": false,\n\"volume\": 19\n},\n{\n\"id\": \"100\",\n\"name\": \"daapd-fifo\",\n\"type\": \"fifo\",\n\"selected\": false,\n\"has_password\": false,\n\"requires_auth\": false,\n\"needs_auth_key\": false,\n\"volume\": 0\n}\n]\n}\n
"},{"location":"json-api/#set-enabled-outputs","title":"Set enabled outputs","text":"Set the enabled outputs by passing an array of output ids. The server enables all outputs with the given ids and disables the remaining outputs.
Endpoint
PUT /api/outputs/set\n
Body parameters
Parameter Type Value outputs array Array of output idsResponse
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/outputs/set\" --data \"{\\\"outputs\\\":[\\\"198018693182577\\\",\\\"0\\\"]}\"\n
"},{"location":"json-api/#get-an-output","title":"Get an output","text":"Get an output
Endpoint
GET /api/outputs/{id}\n
Path parameters
Parameter Value id Output idResponse
On success returns the HTTP 200 OK
success status response code. With the response body holding the output
object.
Example
curl -X GET \"http://localhost:3689/api/outputs/0\"\n
{\n\"id\": \"0\",\n\"name\": \"Computer\",\n\"type\": \"ALSA\",\n\"selected\": true,\n\"has_password\": false,\n\"requires_auth\": false,\n\"needs_auth_key\": false,\n\"volume\": 3\n}\n
"},{"location":"json-api/#change-an-output","title":"Change an output","text":"Enable or disable an output and change its volume.
Endpoint
PUT /api/outputs/{id}\n
Path parameters
Parameter Value id Output idBody parameters
Parameter Type Value selected boolean (Optional)true
to enable and false
to disable the output volume integer (Optional) Volume in percent (0 - 100) pin string (Optional) PIN for device verification Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/outputs/0\" --data \"{\\\"selected\\\":true, \\\"volume\\\": 50}\"\n
"},{"location":"json-api/#toggle-an-output","title":"Toggle an output","text":"Enable or disable an output, depending on its current state
Endpoint
PUT /api/outputs/{id}/toggle\n
Path parameters
Parameter Value id Output idResponse
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/outputs/0/toggle\"\n
"},{"location":"json-api/#queue","title":"Queue","text":"Method Endpoint Description GET /api/queue Get a list of queue items PUT /api/queue/clear Remove all items from the queue POST /api/queue/items/add Add items to the queue PUT /api/queue/items/{id}|now_playing Updating a queue item in the queue DELETE /api/queue/items/{id} Remove a queue item from the queue"},{"location":"json-api/#list-queue-items","title":"List queue items","text":"Lists the items in the current queue
Endpoint
GET /api/queue\n
Query parameters
Parameter Value id (Optional) If a queue item id is given, only the item with the id will be returend. Use id=now_playing to get the currently playing item. start (Optional) If astart
and an end
position is given, only the items from start
(included) to end
(excluded) will be returned. If only a start
position is given, only the item at this position will be returned. end (Optional) See start
parameter Response
Key Type Value version integer Version number of the current queue count integer Number of items in the current queue items array Array ofqueue item
objects Example
curl -X GET \"http://localhost:3689/api/queue\"\n
{\n\"version\": 833,\n\"count\": 20,\n\"items\": [\n{\n\"id\": 12122,\n\"position\": 0,\n\"track_id\": 10749,\n\"title\": \"Angels\",\n\"artist\": \"The xx\",\n\"artist_sort\": \"xx, The\",\n\"album\": \"Coexist\",\n\"album_sort\": \"Coexist\",\n\"albumartist\": \"The xx\",\n\"albumartist_sort\": \"xx, The\",\n\"genre\": \"Indie Rock\",\n\"year\": 2012,\n\"track_number\": 1,\n\"disc_number\": 1,\n\"length_ms\": 171735,\n\"media_kind\": \"music\",\n\"data_kind\": \"file\",\n\"path\": \"/music/srv/The xx/Coexist/01 Angels.mp3\",\n\"uri\": \"library:track:10749\"\n},\n...\n]\n}\n
"},{"location":"json-api/#clearing-the-queue","title":"Clearing the queue","text":"Remove all items form the current queue
Endpoint
PUT /api/queue/clear\n
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/queue/clear\"\n
"},{"location":"json-api/#adding-items-to-the-queue","title":"Adding items to the queue","text":"Add tracks, playlists artists or albums to the current queue
Endpoint
POST /api/queue/items/add\n
Query parameters
Parameter Value uris Comma seperated list of resource identifiers (track
, playlist
, artist
or album
object uri
) expression A smart playlist query expression identifying the tracks that will be added to the queue. position (Optional) If a position is given, new items are inserted starting from this position into the queue. playback (Optional) If the playback
parameter is set to start
, playback will be started after adding the new items. playback_from_position (Optional) If the playback
parameter is set to start
, playback will be started with the queue item at the position given in playback_from_position
. clear (Optional) If the clear
parameter is set to true
, the queue will be cleared before adding the new items. shuffle (Optional) If the shuffle
parameter is set to true
, the shuffle mode is activated. If it is set to something else, the shuffle mode is deactivated. To leave the shuffle mode untouched the parameter should be ommited. limit (Optional) Maximum number of tracks to add Either the uris
or the expression
parameter must be set. If both are set the uris
parameter takes presedence and the expression
parameter will be ignored.
Response
On success returns the HTTP 200 OK
success status response code.
Example
Add new items by uri:
curl -X POST \"http://localhost:3689/api/queue/items/add?uris=library:playlist:68,library:artist:2932599850102967727\"\n
{\n\"count\": 42\n}\n
Add new items by query language:
curl -X POST \"http://localhost:3689/api/queue/items/add?expression=media_kind+is+music\"\n
{\n\"count\": 42\n}\n
Clear current queue, add 10 new random tracks of genre
Pop and start playback
curl -X POST \"http://localhost:3689/api/queue/items/add?limit=10&clear=true&playback=start&expression=genre+is+%22Pop%22+order+by+random+desc\"\n
{\n\"count\": 10\n}\n
"},{"location":"json-api/#updating-a-queue-item","title":"Updating a queue item","text":"Update or move a queue item in the current queue
Endpoint
PUT /api/queue/items/{id}\n
or PUT /api/queue/items/now_playing\n
Path parameters
Parameter Value id Queue item id(or use now_playing to update the currenly playing track)
Query parameters
Parameter Value new_position The new position for the queue item in the current queue. title New track title album New album title artist New artist album_artist New album artist composer New composer genre New genre artwork_url New URL to track artworkResponse
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/queue/items/3?new_position=0\"\n
curl -X PUT \"http://localhost:3689/api/queue/items/3?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg\"\n
curl -X PUT \"http://localhost:3689/api/queue/items/now_playing?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg\"\n
"},{"location":"json-api/#removing-a-queue-item","title":"Removing a queue item","text":"Remove a queue item from the current queue
Endpoint
DELETE /api/queue/items/{id}\n
Path parameters
Parameter Value id Queue item idResponse
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/queue/items/2\"\n
"},{"location":"json-api/#library","title":"Library","text":"Method Endpoint Description GET /api/library Get library information GET /api/library/playlists Get a list of playlists GET /api/library/playlists/{id} Get a playlist PUT /api/library/playlists/{id} Update a playlist attribute DELETE /api/library/playlists/{id} Delete a playlist GET /api/library/playlists/{id}/tracks Get list of tracks for a playlist PUT /api/library/playlists/{id}/tracks Update play count of tracks for a playlist GET /api/library/playlists/{id}/playlists Get list of playlists for a playlist folder GET /api/library/artists Get a list of artists GET /api/library/artists/{id} Get an artist GET /api/library/artists/{id}/albums Get list of albums for an artist GET /api/library/albums Get a list of albums GET /api/library/albums/{id} Get an album GET /api/library/albums/{id}/tracks Get list of tracks for an album GET /api/library/tracks/{id} Get a track GET /api/library/tracks/{id}/playlists Get list of playlists for a track PUT /api/library/tracks Update multiple track properties PUT /api/library/tracks/{id} Update single track properties GET /api/library/genres Get list of genres GET /api/library/count Get count of tracks, artists and albums GET /api/library/files Get list of directories in the local library POST /api/library/add Add an item to the library PUT /api/update Trigger a library rescan PUT /api/rescan Trigger a library metadata rescan PUT /api/library/backup Request library backup db"},{"location":"json-api/#library-information","title":"Library information","text":"List some library stats
Endpoint
GET /api/library\n
Response
Key Type Value songs integer Array ofplaylist
objects db_playtime integer Total playtime of all songs in the library artists integer Number of album artists in the library albums integer Number of albums in the library started_at string Server startup time (timestamp in ISO 8601
format) updated_at string Last library update (timestamp in ISO 8601
format) updating boolean true
if library rescan is in progress Example
curl -X GET \"http://localhost:3689/api/library\"\n
{\n\"songs\": 217,\n\"db_playtime\": 66811,\n\"artists\": 9,\n\"albums\": 19,\n\"started_at\": \"2018-11-19T19:06:08Z\",\n\"updated_at\": \"2018-11-19T19:06:16Z\",\n\"updating\": false\n}\n
"},{"location":"json-api/#list-playlists","title":"List playlists","text":"Lists all playlists in your library (does not return playlist folders)
Endpoint
GET /api/library/playlists\n
Query parameters
Parameter Value offset (Optional) Offset of the first playlist to return limit (Optional) Maximum number of playlists to returnResponse
Key Type Value items array Array ofplaylist
objects total integer Total number of playlists in the library offset integer Requested offset of the first playlist limit integer Requested maximum number of playlists Example
curl -X GET \"http://localhost:3689/api/library/playlists\"\n
{\n\"items\": [\n{\n\"id\": 1,\n\"name\": \"radio\",\n\"path\": \"/music/srv/radio.m3u\",\n\"smart_playlist\": false,\n\"uri\": \"library:playlist:1\"\n},\n...\n],\n\"total\": 20,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#get-a-playlist","title":"Get a playlist","text":"Get a specific playlists in your library
Endpoint
GET /api/library/playlists/{id}\n
Path parameters
Parameter Value id Playlist idResponse
On success returns the HTTP 200 OK
success status response code. With the response body holding the playlist
object.
Example
curl -X GET \"http://localhost:3689/api/library/playlists/1\"\n
{\n\"id\": 1,\n\"name\": \"radio\",\n\"path\": \"/music/srv/radio.m3u\",\n\"smart_playlist\": false,\n\"uri\": \"library:playlist:1\"\n}\n
"},{"location":"json-api/#update-a-playlist","title":"Update a playlist","text":"Update attributes of a specific playlists in your library
Endpoint
PUT /api/library/playlists/{id}\n
Path parameters
Parameter Value id Playlist idQuery parameters
Parameter Value query_limit For RSS feeds, this sets how many podcasts to retrieveExample
curl -X PUT \"http://localhost:3689/api/library/playlists/25?query_limit=20\"\n
"},{"location":"json-api/#delete-a-playlist","title":"Delete a playlist","text":"Delete a playlist, e.g. a RSS feed
Endpoint
DELETE /api/library/playlists/{id}\n
Path parameters
Parameter Value id Playlist idExample
curl -X DELETE \"http://localhost:3689/api/library/playlists/25\"\n
"},{"location":"json-api/#list-playlist-tracks","title":"List playlist tracks","text":"Lists the tracks in a playlists
Endpoint
GET /api/library/playlists/{id}/tracks\n
Path parameters
Parameter Value id Playlist idQuery parameters
Parameter Value offset (Optional) Offset of the first track to return limit (Optional) Maximum number of tracks to returnResponse
Key Type Value items array Array oftrack
objects total integer Total number of tracks in the playlist offset integer Requested offset of the first track limit integer Requested maximum number of tracks Example
curl -X GET \"http://localhost:3689/api/library/playlists/1/tracks\"\n
{\n\"items\": [\n{\n\"id\": 10766,\n\"title\": \"Solange wir tanzen\",\n\"artist\": \"Heinrich\",\n\"artist_sort\": \"Heinrich\",\n\"album\": \"Solange wir tanzen\",\n\"album_sort\": \"Solange wir tanzen\",\n\"albumartist\": \"Heinrich\",\n\"albumartist_sort\": \"Heinrich\",\n\"genre\": \"Electronica\",\n\"year\": 2014,\n\"track_number\": 1,\n\"disc_number\": 1,\n\"length_ms\": 223085,\n\"play_count\": 2,\n\"skip_count\": 1,\n\"time_played\": \"2018-02-23T10:31:20Z\",\n\"media_kind\": \"music\",\n\"data_kind\": \"file\",\n\"path\": \"/music/srv/Heinrich/Solange wir tanzen/01 Solange wir tanzen.mp3\",\n\"uri\": \"library:track:10766\"\n},\n...\n],\n\"total\": 20,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#update-playlist-tracks","title":"Update playlist tracks","text":"Updates the play count for tracks in a playlists
Endpoint
PUT /api/library/playlists/{id}/tracks\n
Path parameters
Parameter Value id Playlist idQuery parameters
Parameter Value play_count Eitherincrement
, played
or reset
. increment
will increment play_count
and update time_played
, played
will be like increment
but only where play_count
is 0, reset
will set play_count
and skip_count
to zero and delete time_played
and time_skipped
Example
curl -X PUT \"http://localhost:3689/api/library/playlists/1/tracks?play_count=played\"\n
"},{"location":"json-api/#list-playlists-in-a-playlist-folder","title":"List playlists in a playlist folder","text":"Lists the playlists in a playlist folder
Note: The root playlist folder has id
0.
Endpoint
GET /api/library/playlists/{id}/playlists\n
Path parameters
Parameter Value id Playlist idQuery parameters
Parameter Value offset (Optional) Offset of the first playlist to return limit (Optional) Maximum number of playlist to returnResponse
Key Type Value items array Array ofplaylist
objects total integer Total number of playlists in the playlist folder offset integer Requested offset of the first playlist limit integer Requested maximum number of playlist Example
curl -X GET \"http://localhost:3689/api/library/playlists/0/tracks\"\n
{\n\"items\": [\n{\n\"id\": 11,\n\"name\": \"Spotify\",\n\"path\": \"spotify:playlistfolder\",\n\"parent_id\": \"0\",\n\"smart_playlist\": false,\n\"folder\": true,\n\"uri\": \"library:playlist:11\"\n},\n{\n\"id\": 8,\n\"name\": \"bytefm\",\n\"path\": \"/srv/music/Playlists/bytefm.m3u\",\n\"parent_id\": \"0\",\n\"smart_playlist\": false,\n\"folder\": false,\n\"uri\": \"library:playlist:8\"\n}\n],\n\"total\": 2,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#list-artists","title":"List artists","text":"Lists the artists in your library
Endpoint
GET /api/library/artists\n
Query parameters
Parameter Value offset (Optional) Offset of the first artist to return limit (Optional) Maximum number of artists to returnResponse
Key Type Value items array Array ofartist
objects total integer Total number of artists in the library offset integer Requested offset of the first artist limit integer Requested maximum number of artists Example
curl -X GET \"http://localhost:3689/api/library/artists\"\n
{\n\"items\": [\n{\n\"id\": \"3815427709949443149\",\n\"name\": \"ABAY\",\n\"name_sort\": \"ABAY\",\n\"album_count\": 1,\n\"track_count\": 10,\n\"length_ms\": 2951554,\n\"uri\": \"library:artist:3815427709949443149\"\n},\n...\n],\n\"total\": 20,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#get-an-artist","title":"Get an artist","text":"Get a specific artist in your library
Endpoint
GET /api/library/artists/{id}\n
Path parameters
Parameter Value id Artist idResponse
On success returns the HTTP 200 OK
success status response code. With the response body holding the artist
object.
Example
curl -X GET \"http://localhost:3689/api/library/artists/3815427709949443149\"\n
{\n\"id\": \"3815427709949443149\",\n\"name\": \"ABAY\",\n\"name_sort\": \"ABAY\",\n\"album_count\": 1,\n\"track_count\": 10,\n\"length_ms\": 2951554,\n\"uri\": \"library:artist:3815427709949443149\"\n}\n
"},{"location":"json-api/#list-artist-albums","title":"List artist albums","text":"Lists the albums of an artist
Endpoint
GET /api/library/artists/{id}/albums\n
Path parameters
Parameter Value id Artist idQuery parameters
Parameter Value offset (Optional) Offset of the first album to return limit (Optional) Maximum number of albums to returnResponse
Key Type Value items array Array ofalbum
objects total integer Total number of albums of this artist offset integer Requested offset of the first album limit integer Requested maximum number of albums Example
curl -X GET \"http://localhost:3689/api/library/artists/32561671101664759/albums\"\n
{\n\"items\": [\n{\n\"id\": \"8009851123233197743\",\n\"name\": \"Add Violence\",\n\"name_sort\": \"Add Violence\",\n\"artist\": \"Nine Inch Nails\",\n\"artist_id\": \"32561671101664759\",\n\"track_count\": 5,\n\"length_ms\": 1634961,\n\"uri\": \"library:album:8009851123233197743\"\n},\n...\n],\n\"total\": 20,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#list-albums","title":"List albums","text":"Lists the albums in your library
Endpoint
GET /api/library/albums\n
Query parameters
Parameter Value offset (Optional) Offset of the first album to return limit (Optional) Maximum number of albums to returnResponse
Key Type Value items array Array ofalbum
objects total integer Total number of albums in the library offset integer Requested offset of the first albums limit integer Requested maximum number of albums Example
curl -X GET \"http://localhost:3689/api/library/albums\"\n
{\n\"items\": [\n{\n\"id\": \"8009851123233197743\",\n\"name\": \"Add Violence\",\n\"name_sort\": \"Add Violence\",\n\"artist\": \"Nine Inch Nails\",\n\"artist_id\": \"32561671101664759\",\n\"track_count\": 5,\n\"length_ms\": 1634961,\n\"uri\": \"library:album:8009851123233197743\"\n},\n...\n],\n\"total\": 20,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#get-an-album","title":"Get an album","text":"Get a specific album in your library
Endpoint
GET /api/library/albums/{id}\n
Path parameters
Parameter Value id Album idResponse
On success returns the HTTP 200 OK
success status response code. With the response body holding the album
object.
Example
curl -X GET \"http://localhost:3689/api/library/albums/8009851123233197743\"\n
{\n\"id\": \"8009851123233197743\",\n\"name\": \"Add Violence\",\n\"name_sort\": \"Add Violence\",\n\"artist\": \"Nine Inch Nails\",\n\"artist_id\": \"32561671101664759\",\n\"track_count\": 5,\n\"length_ms\": 1634961,\n\"uri\": \"library:album:8009851123233197743\"\n}\n
"},{"location":"json-api/#list-album-tracks","title":"List album tracks","text":"Lists the tracks in an album
Endpoint
GET /api/library/albums/{id}/tracks\n
Path parameters
Parameter Value id Album idQuery parameters
Parameter Value offset (Optional) Offset of the first track to return limit (Optional) Maximum number of tracks to returnResponse
Key Type Value items array Array oftrack
objects total integer Total number of tracks offset integer Requested offset of the first track limit integer Requested maximum number of tracks Example
curl -X GET \"http://localhost:3689/api/library/albums/1/tracks\"\n
{\n\"items\": [\n{\n\"id\": 10766,\n\"title\": \"Solange wir tanzen\",\n\"artist\": \"Heinrich\",\n\"artist_sort\": \"Heinrich\",\n\"album\": \"Solange wir tanzen\",\n\"album_sort\": \"Solange wir tanzen\",\n\"albumartist\": \"Heinrich\",\n\"albumartist_sort\": \"Heinrich\",\n\"genre\": \"Electronica\",\n\"year\": 2014,\n\"track_number\": 1,\n\"disc_number\": 1,\n\"length_ms\": 223085,\n\"play_count\": 2,\n\"last_time_played\": \"2018-02-23T10:31:20Z\",\n\"media_kind\": \"music\",\n\"data_kind\": \"file\",\n\"path\": \"/music/srv/Heinrich/Solange wir tanzen/01 Solange wir tanzen.mp3\",\n\"uri\": \"library:track:10766\"\n},\n...\n],\n\"total\": 20,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#get-a-track","title":"Get a track","text":"Get a specific track in your library
Endpoint
GET /api/library/tracks/{id}\n
Path parameters
Parameter Value id Track idResponse
On success returns the HTTP 200 OK
success status response code. With the response body holding the track
object.
Example
curl -X GET \"http://localhost:3689/api/library/tracks/1\"\n
{\n\"id\": 1,\n\"title\": \"Pardon Me\",\n\"title_sort\": \"Pardon Me\",\n\"artist\": \"Incubus\",\n\"artist_sort\": \"Incubus\",\n\"album\": \"Make Yourself\",\n\"album_sort\": \"Make Yourself\",\n\"album_id\": \"6683985628074308431\",\n\"album_artist\": \"Incubus\",\n\"album_artist_sort\": \"Incubus\",\n\"album_artist_id\": \"4833612337650426236\",\n\"composer\": \"Alex Katunich/Brandon Boyd/Chris Kilmore/Jose Antonio Pasillas II/Mike Einziger\",\n\"genre\": \"Alternative Rock\",\n\"year\": 2001,\n\"track_number\": 12,\n\"disc_number\": 1,\n\"length_ms\": 223170,\n\"rating\": 0,\n\"usermark\": 0,\n\"play_count\": 0,\n\"skip_count\": 0,\n\"time_added\": \"2019-01-20T11:58:29Z\",\n\"date_released\": \"2001-05-27\",\n\"seek_ms\": 0,\n\"media_kind\": \"music\",\n\"data_kind\": \"file\",\n\"path\": \"/music/srv/Incubus/Make Yourself/12 Pardon Me.mp3\",\n\"uri\": \"library:track:1\",\n\"artwork_url\": \"/artwork/item/1\"\n}\n
"},{"location":"json-api/#list-playlists-for-a-track","title":"List playlists for a track","text":"Get the list of playlists that contain a track (does not return smart playlists)
Endpoint
GET /api/library/tracks/{id}/playlists\n
Path parameters
Parameter Value id Track idQuery parameters
Parameter Value offset (Optional) Offset of the first playlist to return limit (Optional) Maximum number of playlist to returnResponse
Key Type Value items array Array ofplaylist
objects total integer Total number of playlists offset integer Requested offset of the first playlist limit integer Requested maximum number of playlists Example
curl -X GET \"http://localhost:3689/api/library/tracks/27/playlists\"\n
{\n\"items\": [\n{\n\"id\": 1,\n\"name\": \"playlist\",\n\"path\": \"/music/srv/playlist.m3u\",\n\"smart_playlist\": false,\n\"uri\": \"library:playlist:1\"\n},\n...\n],\n\"total\": 2,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#update-track-properties","title":"Update track properties","text":"Change properties of one or more tracks (supported properties are \"rating\", \"play_count\" and \"usermark\")
Endpoint
PUT /api/library/tracks\n
Body parameters
Parameter Type Value tracks array Array of track objectsResponse
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT -d '{ \"tracks\": [ { \"id\": 1, \"rating\": 100, \"usermark\": 4 }, { \"id\": 2, \"usermark\": 3 } ] }' \"http://localhost:3689/api/library/tracks\"\n
Endpoint
PUT /api/library/tracks/{id}\n
Path parameters
Parameter Value id Track idQuery parameters
Parameter Value rating The new rating (0 - 100) play_count Eitherincrement
or reset
. increment
will increment play_count
and update time_played
, reset
will set play_count
and skip_count
to zero and delete time_played
and time_skipped
usermark The new usermark (>= 0) Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/library/tracks/1?rating=100\"\n
curl -X PUT \"http://localhost:3689/api/library/tracks/1?play_count=increment\"\n
"},{"location":"json-api/#list-genres","title":"List genres","text":"Get list of genres
Endpoint
GET /api/library/genres\n
Response Key Type Value items array Array of browse-info
objects total integer Total number of genres in the library offset integer Requested offset of the first genre limit integer Requested maximum number of genres Example
curl -X GET \"http://localhost:3689/api/library/genres\"\n
{\n\"items\": [\n{\n\"name\": \"Classical\"\n},\n{\n\"name\": \"Drum & Bass\"\n},\n{\n\"name\": \"Pop\"\n},\n{\n\"name\": \"Rock/Pop\"\n},\n{\n\"name\": \"'90s Alternative\"\n}\n],\n\"total\": 5,\n\"offset\": 0,\n\"limit\": -1\n}\n
"},{"location":"json-api/#list-albums-for-genre","title":"List albums for genre","text":"Lists the albums in a genre
Endpoint
GET api/search?type=albums&expression=genre+is+\\\"{genre name}\\\"\"\n
Query parameters
Parameter Value genre genre name (uri encoded and html esc seq for chars: '/&) offset (Optional) Offset of the first album to return limit (Optional) Maximum number of albums to returnResponse
Key Type Value items array Array ofalbum
objects total integer Total number of albums in the library offset integer Requested offset of the first albums limit integer Requested maximum number of albums Example
curl -X GET \"http://localhost:3689/api/search?type=albums&expression=genre+is+\\\"Pop\\\"\"\ncurl -X GET \"http://localhost:3689/api/search?type=albums&expression=genre+is+\\\"Rock%2FPop\\\"\" # Rock/Pop\ncurl -X GET \"http://localhost:3689/api/search?type=albums&expression=genre+is+\\\"Drum%20%26%20Bass\\\"\" # Drum & Bass\ncurl -X GET \"http://localhost:3689/api/search?type=albums&expression=genre+is+\\\"%2790s%20Alternative\\\"\" # '90 Alternative\n
{\n\"albums\": {\n\"items\": [\n{\n\"id\": \"320189328729146437\",\n\"name\": \"Best Ever\",\n\"name_sort\": \"Best Ever\",\n\"artist\": \"ABC\",\n\"artist_id\": \"8760559201889050080\",\n\"track_count\": 1,\n\"length_ms\": 3631,\n\"uri\": \"library:album:320189328729146437\"\n},\n{\n\"id\": \"7964595866631625723\",\n\"name\": \"Greatest Hits\",\n\"name_sort\": \"Greatest Hits\",\n\"artist\": \"Marvin Gaye\",\n\"artist_id\": \"5261930703203735930\",\n\"track_count\": 2,\n\"length_ms\": 7262,\n\"uri\": \"library:album:7964595866631625723\"\n},\n{\n\"id\": \"3844610748145176456\",\n\"name\": \"The Very Best of Etta\",\n\"name_sort\": \"Very Best of Etta\",\n\"artist\": \"Etta James\",\n\"artist_id\": \"2627182178555864595\",\n\"track_count\": 1,\n\"length_ms\": 177926,\n\"uri\": \"library:album:3844610748145176456\"\n}\n],\n\"total\": 3,\n\"offset\": 0,\n\"limit\": -1\n}\n}\n
"},{"location":"json-api/#get-count-of-tracks-artists-and-albums","title":"Get count of tracks, artists and albums","text":"Get information about the number of tracks, artists and albums and the total playtime
Endpoint
GET /api/library/count\n
Query parameters
Parameter Value expression (Optional) The smart playlist query expression, if this parameter is omitted returns the information for the whole libraryResponse
Key Type Value tracks integer Number of tracks matching the expression artists integer Number of artists matching the expression albums integer Number of albums matching the expression db_playtime integer Total playtime in milliseconds of all tracks matching the expressionExample
curl -X GET \"http://localhost:3689/api/library/count?expression=data_kind+is+file\"\n
{\n\"tracks\": 6811,\n\"artists\": 355,\n\"albums\": 646,\n\"db_playtime\": 1590767\n}\n
"},{"location":"json-api/#list-local-directories","title":"List local directories","text":"List the local directories and the directory contents (tracks and playlists)
Endpoint
GET /api/library/files\n
Query parameters
Parameter Value directory (Optional) A path to a directory in your local library.Response
Key Type Value directories array Array ofdirectory
objects containing the sub directories tracks object paging
object containing track
objects that matches the directory
playlists object paging
object containing playlist
objects that matches the directory
Example
curl -X GET \"http://localhost:3689/api/library/files?directory=/music/srv\"\n
{\n\"directories\": [\n{\n\"path\": \"/music/srv/Audiobooks\"\n},\n{\n\"path\": \"/music/srv/Music\"\n},\n{\n\"path\": \"/music/srv/Playlists\"\n},\n{\n\"path\": \"/music/srv/Podcasts\"\n}\n],\n\"tracks\": {\n\"items\": [\n{\n\"id\": 1,\n\"title\": \"input.pipe\",\n\"artist\": \"Unknown artist\",\n\"artist_sort\": \"Unknown artist\",\n\"album\": \"Unknown album\",\n\"album_sort\": \"Unknown album\",\n\"album_id\": \"4201163758598356043\",\n\"album_artist\": \"Unknown artist\",\n\"album_artist_sort\": \"Unknown artist\",\n\"album_artist_id\": \"4187901437947843388\",\n\"genre\": \"Unknown genre\",\n\"year\": 0,\n\"track_number\": 0,\n\"disc_number\": 0,\n\"length_ms\": 0,\n\"play_count\": 0,\n\"skip_count\": 0,\n\"time_added\": \"2018-11-24T08:41:35Z\",\n\"seek_ms\": 0,\n\"media_kind\": \"music\",\n\"data_kind\": \"pipe\",\n\"path\": \"/music/srv/input.pipe\",\n\"uri\": \"library:track:1\",\n\"artwork_url\": \"/artwork/item/1\"\n}\n],\n\"total\": 1,\n\"offset\": 0,\n\"limit\": -1\n},\n\"playlists\": {\n\"items\": [\n{\n\"id\": 8,\n\"name\": \"radio\",\n\"path\": \"/music/srv/radio.m3u\",\n\"smart_playlist\": true,\n\"uri\": \"library:playlist:8\"\n}\n],\n\"total\": 1,\n\"offset\": 0,\n\"limit\": -1\n}\n}\n
"},{"location":"json-api/#add-an-item-to-the-library","title":"Add an item to the library","text":"This endpoint currently only supports addind RSS feeds.
Endpoint
POST /api/library/add\n
Query parameters
Parameter Value url URL of the RSS to addResponse
On success returns the HTTP 200 OK
success status response code.
Example
curl -X POST \"http://localhost:3689/api/library/add?url=http%3A%2F%2Fmyurl.com%2Flink.rss\"\n
"},{"location":"json-api/#trigger-rescan","title":"Trigger rescan","text":"Trigger a library rescan
Endpoint
PUT /api/update\n
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/update\"\n
{\n\"songs\": 217,\n\"db_playtime\": 66811,\n\"artists\": 9,\n\"albums\": 19,\n\"started_at\": \"2018-11-19T19:06:08Z\",\n\"updated_at\": \"2018-11-19T19:06:16Z\",\n\"updating\": false\n}\n
"},{"location":"json-api/#trigger-metadata-rescan","title":"Trigger metadata rescan","text":"Trigger a library metadata rescan even if files have not been updated. Maintenence method.
Endpoint
PUT /api/rescan\n
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/rescan\"\n
"},{"location":"json-api/#backup-db","title":"Backup DB","text":"Request a library backup - configuration must be enabled and point to a valid writable path. Maintenance method.
Endpoint
PUT /api/library/backup\n
Response
On success returns the HTTP 200 OK
success status response code. If backups are not enabled returns HTTP 503 Service Unavailable
response code. Otherwise a HTTP 500 Internal Server Error
response is returned.
Example
curl -X PUT \"http://localhost:3689/api/library/backup\"\n
"},{"location":"json-api/#search","title":"Search","text":"Method Endpoint Description GET /api/search Search for playlists, artists, albums, tracks,genres by a simple search term GET /api/search Search by complex query expression"},{"location":"json-api/#search-by-search-term","title":"Search by search term","text":"Search for playlists, artists, albums, tracks, genres that include the given query in their title (case insensitive matching).
Endpoint
GET /api/search\n
Query parameters
Parameter Value query The search keyword type Comma separated list of the result types (playlist
, artist
, album
, track
, genre
) media_kind (Optional) Filter results by media kind (music
, movie
, podcast
, audiobook
, musicvideo
, tvshow
). Filter only applies to artist, album and track result types. offset (Optional) Offset of the first item to return for each type limit (Optional) Maximum number of items to return for each type Response
Key Type Value tracks objectpaging
object containing track
objects that matches the query
artists object paging
object containing artist
objects that matches the query
albums object paging
object containing album
objects that matches the query
playlists object paging
object containing playlist
objects that matches the query
Example
Search for all tracks, artists, albums and playlists that contain \"the\" in their title and return the first two results for each type:
curl -X GET \"http://localhost:3689/api/search?type=tracks,artists,albums,playlists&query=the&offset=0&limit=2\"\n
{\n\"tracks\": {\n\"items\": [\n{\n\"id\": 35,\n\"title\": \"Another Love\",\n\"artist\": \"Tom Odell\",\n\"artist_sort\": \"Tom Odell\",\n\"album\": \"Es is was es is\",\n\"album_sort\": \"Es is was es is\",\n\"album_id\": \"6494853621007413058\",\n\"album_artist\": \"Various artists\",\n\"album_artist_sort\": \"Various artists\",\n\"album_artist_id\": \"8395563705718003786\",\n\"genre\": \"Singer/Songwriter\",\n\"year\": 2013,\n\"track_number\": 7,\n\"disc_number\": 1,\n\"length_ms\": 251030,\n\"play_count\": 0,\n\"media_kind\": \"music\",\n\"data_kind\": \"file\",\n\"path\": \"/music/srv/Compilations/Es is was es is/07 Another Love.m4a\",\n\"uri\": \"library:track:35\"\n},\n{\n\"id\": 215,\n\"title\": \"Away From the Sun\",\n\"artist\": \"3 Doors Down\",\n\"artist_sort\": \"3 Doors Down\",\n\"album\": \"Away From the Sun\",\n\"album_sort\": \"Away From the Sun\",\n\"album_id\": \"8264078270267374619\",\n\"album_artist\": \"3 Doors Down\",\n\"album_artist_sort\": \"3 Doors Down\",\n\"album_artist_id\": \"5030128490104968038\",\n\"genre\": \"Rock\",\n\"year\": 2002,\n\"track_number\": 2,\n\"disc_number\": 1,\n\"length_ms\": 233278,\n\"play_count\": 0,\n\"media_kind\": \"music\",\n\"data_kind\": \"file\",\n\"path\": \"/music/srv/Away From the Sun/02 Away From the Sun.mp3\",\n\"uri\": \"library:track:215\"\n}\n],\n\"total\": 14,\n\"offset\": 0,\n\"limit\": 2\n},\n\"artists\": {\n\"items\": [\n{\n\"id\": \"8737690491750445895\",\n\"name\": \"The xx\",\n\"name_sort\": \"xx, The\",\n\"album_count\": 2,\n\"track_count\": 25,\n\"length_ms\": 5229196,\n\"uri\": \"library:artist:8737690491750445895\"\n}\n],\n\"total\": 1,\n\"offset\": 0,\n\"limit\": 2\n},\n\"albums\": {\n\"items\": [\n{\n\"id\": \"8264078270267374619\",\n\"name\": \"Away From the Sun\",\n\"name_sort\": \"Away From the Sun\",\n\"artist\": \"3 Doors Down\",\n\"artist_id\": \"5030128490104968038\",\n\"track_count\": 12,\n\"length_ms\": 2818174,\n\"uri\": \"library:album:8264078270267374619\"\n},\n{\n\"id\": \"6835720495312674468\",\n\"name\": \"The Better Life\",\n\"name_sort\": \"Better Life\",\n\"artist\": \"3 Doors Down\",\n\"artist_id\": \"5030128490104968038\",\n\"track_count\": 11,\n\"length_ms\": 2393332,\n\"uri\": \"library:album:6835720495312674468\"\n}\n],\n\"total\": 3,\n\"offset\": 0,\n\"limit\": 2\n},\n\"playlists\": {\n\"items\": [],\n\"total\": 0,\n\"offset\": 0,\n\"limit\": 2\n}\n}\n
"},{"location":"json-api/#search-by-query-language","title":"Search by query language","text":"Search for artists, albums, tracks by a smart playlist query expression (see README_SMARTPL.md for the expression syntax).
Endpoint
GET /api/search\n
Query parameters
Parameter Value expression The smart playlist query expression type Comma separated list of the result types (artist
, album
, track
offset (Optional) Offset of the first item to return for each type limit (Optional) Maximum number of items to return for each type Response
Key Type Value tracks objectpaging
object containing track
objects that matches the query
artists object paging
object containing artist
objects that matches the query
albums object paging
object containing album
objects that matches the query
Example
Search for music tracks ordered descending by the time added to the library and limit result to 2 items:
curl -X GET \"http://localhost:3689/api/search?type=tracks&expression=media_kind+is+music+order+by+time_added+desc&offset=0&limit=2\"\n
"},{"location":"json-api/#server-info","title":"Server info","text":"Method Endpoint Description GET /api/config Get configuration information"},{"location":"json-api/#config","title":"Config","text":"Endpoint
GET /api/config\n
Response
Key Type Value version string Server version websocket_port integer Port number for the websocket (or0
if websocket is disabled) buildoptions array Array of strings indicating which features are supported by the server Example
curl -X GET \"http://localhost:3689/api/config\"\n
{\n\"websocket_port\": 3688,\n\"version\": \"25.0\",\n\"buildoptions\": [\n\"ffmpeg\",\n\"iTunes XML\",\n\"Spotify\",\n\"LastFM\",\n\"MPD\",\n\"Device verification\",\n\"Websockets\",\n\"ALSA\"\n]\n}\n
"},{"location":"json-api/#settings","title":"Settings","text":"Method Endpoint Description GET /api/settings Get all available categories GET /api/settings/{category-name} Get all available options for a category GET /api/settings/{category-name}/{option-name} Get a single setting option PUT /api/settings/{category-name}/{option-name} Change the value of a setting option DELETE /api/settings/{category-name}/{option-name} Reset a setting option to its default"},{"location":"json-api/#list-categories","title":"List categories","text":"List all settings categories with their options
Endpoint
GET /api/settings\n
Response
Key Type Value categories array Array of settings category objectsExample
curl -X GET \"http://localhost:3689/api/settings\"\n
{\n\"categories\": [\n{\n\"name\": \"webinterface\",\n\"options\": [\n{\n\"name\": \"show_composer_now_playing\",\n\"type\": 1,\n\"value\": true\n},\n{\n\"name\": \"show_composer_for_genre\",\n\"type\": 2,\n\"value\": \"classical\"\n}\n]\n}\n]\n}\n
"},{"location":"json-api/#get-a-category","title":"Get a category","text":"Get a settings category with their options
Endpoint
GET /api/settings/{category-name}\n
Response
Returns a settings category object
Example
curl -X GET \"http://localhost:3689/api/settings/webinterface\"\n
{\n\"name\": \"webinterface\",\n\"options\": [\n{\n\"name\": \"show_composer_now_playing\",\n\"type\": 1,\n\"value\": true\n},\n{\n\"name\": \"show_composer_for_genre\",\n\"type\": 2,\n\"value\": \"classical\"\n}\n]\n}\n
"},{"location":"json-api/#get-an-option","title":"Get an option","text":"Get a single settings option
Endpoint
GET /api/settings/{category-name}/{option-name}\n
Response
Returns a settings option object
Example
curl -X GET \"http://localhost:3689/api/settings/webinterface/show_composer_now_playing\"\n
{\n\"name\": \"show_composer_now_playing\",\n\"type\": 1,\n\"value\": true\n}\n
"},{"location":"json-api/#change-an-option-value","title":"Change an option value","text":"Get a single settings option
Endpoint
PUT /api/settings/{category-name}/{option-name}\n
Request
Key Type Value name string Option name value (integer / boolean / string) New option valueResponse
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X PUT \"http://localhost:3689/api/settings/webinterface/show_composer_now_playing\" --data \"{\\\"name\\\":\\\"show_composer_now_playing\\\",\\\"value\\\":true}\"\n
"},{"location":"json-api/#delete-an-option","title":"Delete an option","text":"Delete a single settings option (thus resetting it to default)
Endpoint
DELETE /api/settings/{category-name}/{option-name}\n
Response
On success returns the HTTP 204 No Content
success status response code.
Example
curl -X DELETE \"http://localhost:3689/api/settings/webinterface/show_composer_now_playing\"\n
"},{"location":"json-api/#push-notifications","title":"Push notifications","text":"If the server was built with websocket support it exposes a websocket at localhost:3688
to inform clients of changes (e. g. player state or library updates). The port depends on the server configuration and can be read using the /api/config
endpoint.
After connecting to the websocket, the client should send a message containing the event types it is interested in. After that the server will send a message each time one of the events occurred.
Message
Key Type Value notify array Array of event typesEvent types
Type Description update Library update started or finished database Library database changed (new/modified/deleted tracks) outputs An output was enabled or disabled player Player state changes options Playback option changes (shuffle, repeat, consume mode) volume Volume changes queue Queue changesExample
curl --include \\\n--no-buffer \\\n--header \"Connection: Upgrade\" \\\n--header \"Upgrade: websocket\" \\\n--header \"Host: localhost:3688\" \\\n--header \"Origin: http://localhost:3688\" \\\n--header \"Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==\" \\\n--header \"Sec-WebSocket-Version: 13\" \\\n--header \"Sec-WebSocket-Protocol: notify\" \\\nhttp://localhost:3688/ \\\n--data \"{ \\\"notify\\\": [ \\\"player\\\" ] }\"\n
{ \"notify\": [\n\"player\"\n]\n}\n
"},{"location":"json-api/#object-model","title":"Object model","text":""},{"location":"json-api/#queue-item-object","title":"queue item
object","text":"Key Type Value id string Item id position integer Position in the queue (starting with zero) track_id string Track id title string Title artist string Track artist name artist_sort string Track artist sort name album string Album name album_sort string Album sort name album_id string Album id album_artist string Album artist name album_artist_sort string Album artist sort name album_artist_id string Album artist id composer string Composer (optional) genre string Genre year integer Release year track_number integer Track number disc_number integer Disc number length_ms integer Track length in milliseconds media_kind string Media type of this track: music
, movie
, podcast
, audiobook
, musicvideo
, tvshow
data_kind string Data type of this track: file
, url
, spotify
, pipe
path string Path uri string Resource identifier artwork_url string (optional) Artwork url type string file (codec) type (ie mp3/flac/...) bitrate string file bitrate (ie 192/128/...) samplerate string file sample rate (ie 44100/48000/...) channel string file channel (ie mono/stereo/xx ch))"},{"location":"json-api/#playlist-object","title":"playlist
object","text":"Key Type Value id string Playlist id name string Playlist name path string Path parent_id integer Playlist id of the parent (folder) playlist type string Type of this playlist: special
, folder
, smart
, plain
smart_playlist boolean true
if playlist is a smart playlist folder boolean true
if it is a playlist folder uri string Resource identifier"},{"location":"json-api/#artist-object","title":"artist
object","text":"Key Type Value id string Artist id name string Artist name name_sort string Artist sort name album_count integer Number of albums track_count integer Number of tracks length_ms integer Total length of tracks in milliseconds uri string Resource identifier artwork_url string (optional) Artwork url"},{"location":"json-api/#album-object","title":"album
object","text":"Key Type Value id string Album id name string Album name name_sort string Album sort name artist_id string Album artist id artist string Album artist name track_count integer Number of tracks length_ms integer Total length of tracks in milliseconds uri string Resource identifier artwork_url string (optional) Artwork url"},{"location":"json-api/#track-object","title":"track
object","text":"Key Type Value id integer Track id title string Title title_sort string Sort title artist string Track artist name artist_sort string Track artist sort name album string Album name album_sort string Album sort name album_id string Album id album_artist string Album artist name album_artist_sort string Album artist sort name album_artist_id string Album artist id composer string Track composer genre string Genre comment string Comment year integer Release year track_number integer Track number disc_number integer Disc number length_ms integer Track length in milliseconds rating integer Track rating (ranges from 0 to 100) play_count integer How many times the track was played skip_count integer How many times the track was skipped time_played string Timestamp in ISO 8601
format time_skipped string Timestamp in ISO 8601
format time_added string Timestamp in ISO 8601
format date_released string Date in the format yyyy-mm-dd
seek_ms integer Resume point in milliseconds (available only for podcasts and audiobooks) media_kind string Media type of this track: music
, movie
, podcast
, audiobook
, musicvideo
, tvshow
data_kind string Data type of this track: file
, url
, spotify
, pipe
path string Path uri string Resource identifier artwork_url string (optional) Artwork url usermark integer User review marking of track (ranges from 0)"},{"location":"json-api/#paging-object","title":"paging
object","text":"Key Type Value items array Array of result objects total integer Total number of items offset integer Requested offset of the first item limit integer Requested maximum number of items"},{"location":"json-api/#browse-info-object","title":"browse-info
object","text":"Key Type Value name string Name (depends on the type of the query) name_sort string Sort name artist_count integer Number of artists album_count integer Number of albums track_count integer Number of tracks time_played string Timestamp in ISO 8601
format time_added string Timestamp in ISO 8601
format"},{"location":"json-api/#directory-object","title":"directory
object","text":"Key Type Value path string Directory path"},{"location":"json-api/#category-object","title":"category
object","text":"Key Type Value name string Category name options array Array of option in this category"},{"location":"json-api/#option-object","title":"option
object","text":"Key Type Value name string Option name type integer The type of the value for this option (0
: integer, 1
: boolean, 2
: string) value (integer / boolean / string) Current value for this option"},{"location":"json-api/#artwork-urls","title":"Artwork urls","text":"Artwork urls in queue item
, artist
, album
and track
objects can be either relative urls or absolute urls to the artwork image. Absolute artwork urls are pointing to external artwork images (e. g. for radio streams that provide artwork metadata), while relative artwork urls are served from the server.
It is possible to add the query parameters maxwidth
and/or maxheight
to relative artwork urls, in order to get a smaller image (the server only scales down never up).
Note that even if a relative artwork url attribute is present, it is not guaranteed to exist.
"},{"location":"library/","title":"Library","text":"The library is scanned in bulk mode at startup, but the server will be available even while this scan is in progress. You can follow the progress of the scan in the log file or via the web interface. When the scan is complete you will see the log message: \"Bulk library scan completed in X sec\".
The very first scan will take longer than subsequent startup scans, since every file gets analyzed. At the following startups the server looks for changed files and only analyzis those.
Updates to the library are reflected in real time after the initial scan, so you do not need to manually start rescans. The directories are monitored for changes and rescanned on the fly. Note that if you have your library on a network mount then real time updating may not work. Read below about what to do in that case.
If you change any of the directory settings in the library section of the configuration file a rescan is required before the new setting will take effect. You can do this by using \"Update library\" from the web interface.
Symlinks are supported and dereferenced, but it is best to use them for directories only.
Files starting with . (dot) and _ (underscore) are ignored.
"},{"location":"library/#pipes-for-eg-multiroom-with-shairport-sync","title":"Pipes (for e.g. multiroom with Shairport-sync)","text":"Some programs, like for instance Shairport-sync, can be configured to output audio to a named pipe. If this pipe is placed in the library, OwnTone will automatically detect that it is there, and when there is audio being written to it, playback of the audio will be autostarted (and stopped).
Using this feature, OwnTone can act as an AirPlay multiroom \"router\": You can have an AirPlay source (e.g. your iPhone) send audio Shairport-sync, which forwards it to OwnTone through the pipe, which then plays it on whatever speakers you have selected (through Remote).
The format of the audio being written to the pipe must be PCM16.
You can also start playback of pipes manually. You will find them in remotes listed under \"Unknown artist\" and \"Unknown album\". The track title will be the name of the pipe.
Shairport-sync can write metadata to a pipe, and OwnTone can read this. This requires that the metadata pipe has the same filename as the audio pipe plus a \".metadata\" suffix. Say Shairport-sync is configured to write audio to \"/foo/bar/pipe\", then the metadata pipe should be \"/foo/bar/pipe.metadata\".
"},{"location":"library/#libraries-on-network-mounts","title":"Libraries on network mounts","text":"Most network filesharing protocols do not offer notifications when the library is changed. So that means OwnTone cannot update its database in real time. Instead you can schedule a cron job to update the database.
The first step in doing this is to add two entries to the 'directories' configuration item in owntone.conf:
directories = { \"/some/local/dir\", \"/your/network/mount/library\" }\n
Now you can make a cron job that runs this command:
touch /some/local/dir/trigger.init-rescan\n
When OwnTone detects a file with filename ending .init-rescan it will perform a bulk scan similar to the startup scan.
Alternatively, you can force a metadata scan of the library even if the files have not changed by creating a filename ending .meta-rescan
.
OwnTone should support pretty much all audio formats. It relies on libav (or ffmpeg) to extract metadata and decode the files on the fly when the client doesn't support the format.
Formats are attributed a code, so any new format will need to be explicitely added. Currently supported:
If you place a file with the filename ending .full-rescan in your library, you can trigger a full rescan of your library. This will clear all music and playlists from OwnTone's database and initiate a fresh bulk scan. Pairing and speaker information will be kept. Only use this for troubleshooting, it is not necessary during normal operation.
"},{"location":"playlists/","title":"Playlists and internet radio","text":"OwnTone supports M3U and PLS playlists. Just drop your playlist somewhere in your library with an .m3u or .pls extension and it will pick it up.
From the web interface, and some mpd clients, you can also create and modify playlists by saving the current queue. Click the \"Save\" button. Note that this requires that allow_modifying_stored_playlists
is enabled in the configuration file, and that the server has write access to default_playlist_directory
.
If the playlist contains an http URL it will be added as an internet radio station, and the URL will be probed for Shoutcast (ICY) metadata. If the radio station provides artwork, OwnTone will download it during playback and send it to any remotes or AirPlay devices requesting it.
Instead of downloading M3U's from your radio stations, you can also make an empty M3U file and insert links in it to the M3U's of your radio stations.
Radio streams can only be played by OwnTone, so that means they will not be available to play in DAAP clients like iTunes.
The server can import playlists from iTunes Music Library XML files. By default, metadata from our parsers is preferred over what's in the iTunes DB; use itunes_overrides = true if you prefer iTunes' metadata.
OwnTone has support for smart playlists. How to create a smart playlist is documented in Smart playlists.
If you're not satisfied with internet radio metadata that OwnTone shows, then you can read about tweaking it in Radio streams.
"},{"location":"smart-playlists/","title":"OwnTone smart playlists","text":"To add a smart playlist to the server, create a new text file with a filename ending with .smartpl; the filename doesn't matter, only the .smartpl ending does. The file must be placed somewhere in your library folder.
"},{"location":"smart-playlists/#syntax","title":"Syntax","text":"The contents of a smart playlist must follow the syntax:
\"Playlist Name\" { expression }\n
There is exactly one smart playlist allowed for a .smartpl file.
An expression consists of:
field-name operator operand\n
Where valid field-names (with their types) are:
artist
(string)album_artist
(string)album
(string)title
(string)genre
(string)composer
(string)comment
(string)path
(string)type
(string)grouping
(string)data_kind
(enumeration)media_kind
(enumeration)play_count
(integer)skip_count
(integer)rating
(integer)year
(integer)compilation
(integer)track
(integer)disc
(integer)time_added
(date)time_modified
(date)time_played
(date)time_skipped
(date)random
(special)file_size
(integer)Valid operators include:
is
, includes
, starts with
, ends with
(string)>
, <
, <=
, >=
, =
(int)after
, before
(date)is
(enumeration)The is
operator must exactly match the field value, while the includes
operator matches a substring. The starts with
operator matches, if the value starts with the given prefix, and ends with
matches the opposite. All these matches are case-insensitive.
Valid operands include:
Valid operands for the enumeration data_kind
are:
file
url
spotify
pipe
Valid operands for the enumeration media_kind
are:
music
movie
podcast
audiobook
tvshow
Multiple expressions can be anded or ored together, using the keywords OR
and AND
. The unary not operator is also supported using the keyword NOT
.
It is possible to define the sort order and limit the number of items by adding an order clause and/or a limit clause after the last expression:
\"Playlist Name\" { expression ORDER BY field-name sort-direction LIMIT limit }\n
\"sort-direction\" is either ASC
(ascending) or DESC
(descending). \"limit\" is the maximum number of items.
There is additionally a special random
field-name that can be used in conjunction with limit
to select a random number of items based on current expression.
\"techno\" {\n genre includes \"techno\"\n and artist includes \"zombie\"\n}\n
This would match songs by \"Rob Zombie\" or \"White Zombie\", as well as those with a genre of \"Techno-Industrial\" or \"Trance/Techno\", for example.
\"techno 2015\" {\n genre includes \"techno\"\n and artist includes \"zombie\"\n and not genre includes \"industrial\"\n}\n
This would exclude e. g. songs with the genre \"Techno-Industrial\".
\"Local music\" {\n data_kind is file\n and media_kind is music\n}\n
This would match all songs added as files to the library that are not placed under the folders for podcasts, audiobooks.
\"Unplayed podcasts and audiobooks\" {\n play_count = 0\n and (media_kind is podcast or media_kind is audiobook)\n}\n
This would match any podcast and audiobook file that was never played.
\"Recently added music\" {\n media_kind is music\n order by time_added desc\n limit 10\n}\n
This would match the last 10 music files added to the library. \"Random 10 Rated Pop songs\" {\n rating > 0 and\n genre is \"Pop\" and\n media_kind is music\n order by random desc\n limit 10\n}\n
This generates a random set of, maximum of 10, rated Pop music tracks every time the playlist is queried."},{"location":"smart-playlists/#date-operand-syntax","title":"Date operand syntax","text":"One example of a valid date is a date in yyyy-mm-dd format:
\"Files added after January 1, 2004\" {\n time_added after 2004-01-01\n}\n
There are also some special date keywords:
today
, yesterday
, this week
, last week
, last month
, last year
These dates refer to the start of that period; today
means 00:00hrs of today, this week
means current Monday 00:00hrs, last week
means the previous Monday 00:00hrs, last month
is the first day of the previous month at 00:00hrs etc.
A valid date can also be made by applying an interval to a date. Intervals can be defined as days
, weeks
, months
, years
. As an example, a valid date might be:
3 weeks before today
or 3 weeks ago
Examples:
\"Recently Added\" {\n time_added after 2 weeks ago\n}\n
This matches all songs added in the last 2 weeks.
\"Recently played audiobooks\" {\n time_played after last week\n and media_kind is audiobook\n}\n
This matches all audiobooks played since the start of the last Monday 00:00AM.
All dates, except for YYYY-DD-HH
, are relative to the day of when the server evaluates the smartpl query; time_added after today
run on a Monday would match against items added since Monday 00:00hrs and evaluating the same smartpl on Friday would only match against added on Friday 00:00hrs.
Note that time_added after 4 weeks ago
and time_added after last month
are subtly different; the former is exactly 4 weeks ago (from today) whereas the latter is the first day of the previous month.
The syntax is really close to the mt-daapd smart playlist syntax (see http://sourceforge.net/p/mt-daapd/code/HEAD/tree/tags/release-0.2.4.2/contrib/mt-daapd.playlist).
Even this documentation is based on the file linked above.
Some differences are:
||
, &&
, !
are not supported (use or
, and
, not
)To run multiple instances of owntone on a server, you should copy /etc/owntone.conf
to /etc/owntone-zone.conf
(for each zone
) and modify the following to be unique across all instances:
the three port settings (general
-> websocket_port
, library
-> port
, and mpd
-> port
)
the database paths (general
-> db_path
, db_backup_path
, and db_cache_path
)
the service name (library
-> name
).
you probably also want to disable local output (set audio
-> type = \"disabled\"
).
Then run owntone -c /etc/owntone-zone.conf
to run owntone with the new zone configuration.
Owntone has a systemd
template which lets you run this automatically on systems that use systemd. You can start or enable the service for a zone
by sudo systemctl start owntone@zone
and check that it is running with sudo systemctl status owntone@zone
. Use sudo systemctl enable ownton@zone
to get the service to start on reboot.
ALSA is one of the main output configuration options for local audio; when using ALSA you will typically let the system select the soundcard on your machine as the default
device/sound card - a mixer associated with the ALSA device is used for volume control. However if your machine has multiple sound cards and your system chooses the wrong playback device, you will need to manually select the card and mixer to complete the OwnTone configuration.
ALSA devices can be addressed in a number ways but traditionally we have referred to them using the hardware prefix, card number and optionally device number with something like hw:0
or hw:0,1
. In ALSA configuration terms card X, device Y
is known as hw:X,Y
.
ALSA has other prefixes for each card and most importantly plughw
. The plughw
performs transparent sample format and sample rate conversions and maybe a better choice for many users rather than hw:
which would fail when provided unsupported audio formats/sample rates.
Alternative ALSA names can be used to refer to physical ALSA devices and can be useful in a number of ways:
The ALSA device information required for configuration the server can be deterined using aplay
, as described in the rest of this document, but OwnTone can also assist; when configured to log at INFO
level the following information is provided during startup:
laudio: Available ALSA playback mixer(s) on hw:0 CARD=Intel (HDA Intel): 'Master' 'Headphone' 'Speaker' 'PCM' 'Mic' 'Beep'\nlaudio: Available ALSA playback mixer(s) on hw:1 CARD=E30 (E30): 'E30 '\nlaudio: Available ALSA playback mixer(s) on hw:2 CARD=Seri (Plantronics Blackwire 3210 Seri): 'Sidetone' 'Headset'\n
The CARD=
string is the alternate ALSA name for the device and can be used in place of the traditional hw:x
name. On this machine the server reports that it can see the onboard HDA Intel sound card and two additional sound cards: a Topping E30 DAC and a Plantronics Headset which are both USB devices. We can address the first ALSA device as hw:0
or hw:CARD=Intel
or hw:Intel
or plughw:Intel
, the second ALSA device as hw:1
or hw:E30
and so forth. The latter 2 devices being on USB will mean that hw:1
may not always refer to hw:E30
and thus in such a case using the alternate name is useful.
OwnTone can support a single ALSA device or multiple ALSA devices.
# example audio section for server for a single soundcard\naudio {\n nickname = \"Computer\"\n type = \"alsa\"\n\n card = \"hw:1\" # defaults to 'default'\n mixer = \"Analogue\" # defaults to 'PCM' or 'Master'\n mixer_device = \"hw:1\" # defaults to same as 'card' value\n}\n
Multiple devices can be made available to OwnTone using seperate alsa { .. }
sections.
audio {\n type = \"alsa\"\n}\n\nalsa \"hw:1\" {\n nickname = \"Computer\"\n mixer = \"Analogue\"\n mixer_device = \"hw:1\"\n}\n\nalsa \"hw:2\" {\n nickname = \"Second ALSA device\"\n}\n
NB: When introducing alsa { .. }
section(s) the ALSA specific configuration in the audio { .. }
section will be ignored.
If there is only one sound card, verify if the default
sound device is correct for playback, we will use the aplay
utility.
# generate some audio if you don't have a wav file to hand\n$ sox -n -c 2 -r 44100 -b 16 -C 128 /tmp/sine441.wav synth 30 sin 500-100 fade h 0.2 30 0.2\n\n$ aplay -Ddefault /tmp/sine441.wav\n
If you can hear music played then you are good to use default
for the server configuration. If you can not hear anything from the aplay
firstly verify (using alsamixer
) that the sound card is not muted. If the card is not muted AND there is no sound you can try the options below to determine the card and mixer for configuring the server.
As shown above, OwnTone can help, consider the information that logged:
laudio: Available ALSA playback mixer(s) on hw:0 CARD=Intel (HDA Intel): 'Master' 'Headphone' 'Speaker' 'PCM' 'Mic' 'Beep'\nlaudio: Available ALSA playback mixer(s) on hw:1 CARD=E30 (E30): 'E30 '\nlaudio: Available ALSA playback mixer(s) on hw:2 CARD=Seri (Plantronics Blackwire 3210 Seri): 'Sidetone' 'Headset'\n
Using the information above, we can see 3 soundcards that we could use with OwnTone with the first soundcard having a number of seperate mixer devices (volume control) for headphone and the interal speakers - we'll configure the server to use both these and also the E30 device. The server configuration for theese multiple outputs would be:
# using ALSA device alias where possible\n\nalsa \"hw:Intel\" {\n nickname = \"Computer - Speaker\"\n mixer = \"Speaker\"\n}\n\nalsa \"hw:Intel\" {\n nickname = \"Computer - Headphones\"\n mixer = \"Headphone\"\n}\n\nalsa \"plughw:E30\" {\n # this E30 device only support S32_LE so we can use the 'plughw' prefix to\n # add transparent conversion support of more common S16/S24_LE formats\n\n nickname = \"E30 DAC\"\n mixer = \"E30 \"\n mixer_device = \"hw:E30\"\n}\n
NB: it is troublesome to use hw
or plughw
ALSA addressing when running OwnTone on a machine with pulseaudio
and if you wish to use refer to ALSA devices directly that you stop pulseaudio
.
The example below is how I determined the correct sound card and mixer values for a Raspberry Pi that has an additional DAC card (hat) mounted. Of course using the log output from the server would have given the same results.
Use aplay -l
to list all the sound cards and their order as known to the system - you can have multiple card X, device Y
entries; some cards can also have multiple playback devices such as the RPI's onboard soundcard which feeds both headphone (card 0, device 0) and HDMI (card 0, device 1).
$ aplay -l\n**** List of PLAYBACK Hardware Devices ****\ncard 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]\n Subdevices: 6/7\n Subdevice #0: subdevice #0\n Subdevice #1: subdevice #1\n Subdevice #2: subdevice #2\n Subdevice #3: subdevice #3\n Subdevice #4: subdevice #4\n Subdevice #5: subdevice #5\n Subdevice #6: subdevice #6\ncard 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]\n Subdevices: 1/1\n Subdevice #0: subdevice #0\ncard 1: IQaudIODAC [IQaudIODAC], device 0: IQaudIO DAC HiFi pcm512x-hifi-0 []\n Subdevices: 1/1\n Subdevice #0: subdevice #0\n
On this machine we see the second sound card installed, an IQaudIODAC dac hat, and identified as card 1 device 0
. This is the playback device we want to be used by the server.
hw:1,0
is the IQaudIODAC that we want to use - we verify audiable playback through that sound card using aplay -Dhw:1 /tmp/sine441.wav
. If the card has only one device, we can simply refer to the sound card using hw:X
so in this case where the IQaudIODAC only has one device, we can refer to this card as hw:1
or hw:1,0
.
Use aplay -L
to get more information about the PCM devices defined on the system.
$ aplay -L\nnull\n Discard all samples (playback) or generate zero samples (capture)\ndefault:CARD=ALSA\n bcm2835 ALSA, bcm2835 ALSA\n Default Audio Device\nsysdefault:CARD=ALSA\n bcm2835 ALSA, bcm2835 ALSA\n Default Audio Device\ndmix:CARD=ALSA,DEV=0\n bcm2835 ALSA, bcm2835 ALSA\n Direct sample mixing device\ndmix:CARD=ALSA,DEV=1\n bcm2835 ALSA, bcm2835 IEC958/HDMI\n Direct sample mixing device\ndsnoop:CARD=ALSA,DEV=0\n bcm2835 ALSA, bcm2835 ALSA\n Direct sample snooping device\ndsnoop:CARD=ALSA,DEV=1\n bcm2835 ALSA, bcm2835 IEC958/HDMI\n Direct sample snooping device\nhw:CARD=ALSA,DEV=0\n bcm2835 ALSA, bcm2835 ALSA\n Direct hardware device without any conversions\nhw:CARD=ALSA,DEV=1\n bcm2835 ALSA, bcm2835 IEC958/HDMI\n Direct hardware device without any conversions\nplughw:CARD=ALSA,DEV=0\n bcm2835 ALSA, bcm2835 ALSA\n Hardware device with all software conversions\nplughw:CARD=ALSA,DEV=1\n bcm2835 ALSA, bcm2835 IEC958/HDMI\n Hardware device with all software conversions\ndefault:CARD=IQaudIODAC\n IQaudIODAC, \n Default Audio Device\nsysdefault:CARD=IQaudIODAC\n IQaudIODAC, \n Default Audio Device\ndmix:CARD=IQaudIODAC,DEV=0\n IQaudIODAC, \n Direct sample mixing device\ndsnoop:CARD=IQaudIODAC,DEV=0\n IQaudIODAC, \n Direct sample snooping device\nhw:CARD=IQaudIODAC,DEV=0\n IQaudIODAC, \n Direct hardware device without any conversions\nplughw:CARD=IQaudIODAC,DEV=0\n IQaudIODAC, \n Hardware device with all software conversions\n
For the server configuration, we will use:
audio {\n nickname = \"Computer\"\n type = \"alsa\"\n card=\"hw:1\"\n # mixer=TBD\n # mixer_device=TBD\n}\n
"},{"location":"advanced/outputs-alsa/#mixer-name","title":"Mixer name","text":"Once you have the card number (determined from aplay -l
) we can inspect/confirm the name of the mixer that can be used for playback (it may NOT be PCM
as expected by the server). In this example, the card 1
is of interest and thus we use -c 1
with the following command:
$ amixer -c 1 \nSimple mixer control 'DSP Program',0\n Capabilities: enum\n Items: 'FIR interpolation with de-emphasis' 'Low latency IIR with de-emphasis' 'High attenuation with de-emphasis' 'Fixed process flow' 'Ringing-less low latency FIR'\n Item0: 'Ringing-less low latency FIR'\nSimple mixer control 'Analogue',0\n Capabilities: pvolume\n Playback channels: Front Left - Front Right\n Limits: Playback 0 - 1\n Mono:\n Front Left: Playback 1 [100%] [0.00dB]\n Front Right: Playback 1 [100%] [0.00dB]\nSimple mixer control 'Analogue Playback Boost',0\n Capabilities: volume\n Playback channels: Front Left - Front Right\n Capture channels: Front Left - Front Right\n Limits: 0 - 1\n Front Left: 0 [0%] [0.00dB]\n Front Right: 0 [0%] [0.00dB]\n...\n
This card has multiple controls but we want to find a mixer control listed with a pvolume
(playback) capability - in this case that mixer value required for the server configuration is called Analogue
.
For the server configuration, we will use:
audio {\n nickname = \"Computer\"\n type = \"alsa\"\n card=\"hw:1\"\n mixer=\"Analogue\"\n # mixer_device=TBD\n}\n
"},{"location":"advanced/outputs-alsa/#mixer-device","title":"Mixer device","text":"This is the name of the underlying physical device used for the mixer - it is typically the same value as the value of card
in which case a value is not required by the server configuration. An example of when you want to change explicitly configure this is if you need to use a dmix
device (see below).
Some devices such as various RPI DAC boards (IQaudio DAC, Allo Boss DAC...) cannot have multiple streams openned at the same time/cannot play multiple sound files at the same time. This results in Device or resource busy
errors. You can confirm if your sound card has this problem by using the example below once have determined the names/cards information as above.
Using our hw:1
device we try:
# generate some audio\n$ sox -n -c 2 -r 44100 -b 16 -C 128 /tmp/sine441.wav synth 30 sin 500-100 fade h 0.2 30 0.2\n\n# attempt to play 2 files at the same time\n$ aplay -v -Dhw:1 /tmp/sine441.wav &\nPlaying WAVE '/tmp/sine441.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo\nHardware PCM card 1 'IQaudIODAC' device 0 subdevice 0\nIts setup is:\n stream : PLAYBACK\n access : RW_INTERLEAVED\n format : S16_LE\n subformat : STD\n channels : 2\n rate : 44100\n exact rate : 44100 (44100/1)\n msbits : 16\n buffer_size : 22052\n period_size : 5513\n period_time : 125011\n tstamp_mode : NONE\n tstamp_type : MONOTONIC\n period_step : 1\n avail_min : 5513\n period_event : 0\n start_threshold : 22052\n stop_threshold : 22052\n silence_threshold: 0\n silence_size : 0\n boundary : 1445199872\n appl_ptr : 0\n hw_ptr : 0\n$ aplay -v -Dhw:1 /tmp/sine441.wav\naplay: main:788: audio open error: Device or resource busy\n
In this instance this device cannot open multiple streams - OwnTone can handle this situation transparently with some audio being truncated from the end of the current file as the server prepares to play the following track. If this handling is causing you problems you may wish to use ALSA's dmix
functionally which provides a software mixing module. We will need to define a dmix
component and configure the server to use that as it's sound card.
The downside to the dmix
approach will be the need to fix a samplerate (48000 being the default) for this software mixing module meaning any files that have a mismatched samplerate will be resampled.
A dmix
device can be defined in /etc/asound.conf
or ~/.asoundrc
for the same user running OwnTone. We will need to know the underlying physical soundcard to be used: in our examples above, hw:1,0
/ card 1, device 0
representing our IQaudIODAC as per output of aplay -l
. We also take the buffer_size
and period_size
from the output of playing a sound file via aplay -v
.
# use 'dac' as the name of the device: \"aplay -Ddac ....\"\npcm.!dac {\n type plug\n slave.pcm \"dmixer\"\n hint.description \"IQAudio DAC s/w dmix enabled device\"\n}\n\npcm.dmixer {\n type dmix\n ipc_key 1024 # need to be uniq value\n ipc_key_add_uid false # multiple concurrent different users\n ipc_perm 0666 # multi-user sharing permissions\n\n slave {\n pcm \"hw:1,0\" # points at the underlying device - could also simply be hw:1\n period_time 0\n period_size 4096 # from the output of aplay -v\n buffer_size 22052 # from the output of aplay -v\n rate 44100 # locked in sample rate for resampling on dmix device\n }\n hint.description \"IQAudio DAC s/w dmix device\"\n}\n\nctl.dmixer {\n type hw\n card 1 # underlying device\n device 0\n}\n
Running aplay -L
we will see our newly defined devices dac
and dmixer
$ aplay -L\nnull\n Discard all samples (playback) or generate zero samples (capture)\ndac\n IQAudio DAC s/w dmix enabled device\ndmixer\n IQAudio DAC s/w dmix device\ndefault:CARD=ALSA\n bcm2835 ALSA, bcm2835 ALSA\n Default Audio Device\n...\n
At this point we are able to rerun the concurrent aplay
commands (adding -Ddac
to specify the playback device to use) to verify ALSA configuration.
If there is only one card on the machine you may use pcm.!default
instead of pcm.!dac
- there is less configuration to be done later since many ALSA applications will use the device called default
by default. Furthermore on RPI you can explicitly disable the onboard sound card to leave us with only the IQaudIODAC board enabled (won't affect HDMI sound output) by commenting out #dtparam=audio=on
in /boot/config.txt
and rebooting.
We will use the newly defined card named dac
which uses the underlying hw:1
device as per /etc/asound.conf
or ~/.asoundrc
configuration. Note that the mixer_device
is now required and must refer to the real device (see the slave.pcm
value) and not the named device (ie dac
) that we created and are using for the card
configuration value.
For the final server configuration, we will use:
audio {\n nickname = \"Computer\"\n type = \"alsa\"\n card=\"dac\"\n mixer=\"Analogue\"\n mixer_device=\"hw:1\"\n}\n
"},{"location":"advanced/outputs-alsa/#setting-up-an-audio-equalizer","title":"Setting up an Audio Equalizer","text":"There exists an ALSA equalizer plugin. On debian
(incl Raspberry Pi) systems you can install this plugin by apt install libasound2-plugin-equal
; this is not currently available on Fedora (FC31) but can be easily built from source after installing the dependant ladspa
package.
Once installed the user must setup a virtual device and use this device in the server configuration.
If you wish to use your hw:0
device for output:
# /etc/asound.conf\nctl.equal {\n type equal;\n\n # library /usr/lib64/ladspa/caps.so\n}\n\npcm.equal {\n type plug;\n slave.pcm {\n type equal;\n\n ## must be plughw:x,y and not hw:x,y\n slave.pcm \"plughw:0,0\";\n\n # library /usr/lib64/ladspa/caps.so\n }\n hint.description \"equalised device\"\n}\n
and in owntone.conf
alsa \"equal\" {\n nickname = \"Equalised Output\"\n # adjust accordingly for mixer with pvolume capability\n mixer = \"PCM\"\n mixer_device = \"hw:0\"\n}\n
Using the web UI and on the outputs selection you should see an output called Equalised Output
which you should select and set the volume.
When starting playback for any audio tracks you should hopefully hear the output. In a terminal, run alsamixer -Dequal
and you'll see the eqaliser - to test that this is all working, go and drop the upper frequencies and boosting the bass frequencies and give it a second - if this changes the sound profile from your speakers, well done, its done and you can adjust the equalizer as you desire.
Note however, the equalizer appears to require a plughw
device which means you cannnot use this equalizer with a dmix
output chain.
Failed to open configured mixer element
when selecting output deviceErrors in log Invalid CTL
or Failed to attach mixer
when playing/adjusting volume
mixer
value is wrong. Verify name of mixer
value in server config against the names from all devices capable of playback using amixer -c <card number>
. Assume the device is card 1:
(IFS=$'\\n'\n CARD=1\n for i in $(amixer -c ${CARD} scontrols | awk -F\\' '{ print $2 }'); do \n amixer -c ${CARD} sget \"$i\" | grep Capabilities | grep -q pvolume && echo $i\n done\n)\n
Look at the names output and choose the one that fits. The outputs can be something like:
# laptop\nMaster\nHeadphone\nSpeaker\nPCM\nMic\nBeep\n\n# RPI with no additional DAC, card = 0\nPCM\n\n# RPI with additional DAC hat (IQAudioDAC, using a pcm512x chip)\nAnalogue\nDigital\n
No sound during playback - valid mixer/verified by aplay
Check that the mixer is not muted or volume set to 0. Using the value of mixer
as per server config and unmute or set volume to max. Assume the device is card 1 and mixer = Analogue
:
amixer -c 1 set Analogue unmute ## some mixers can not be muted resulting in \"invalid command\"\namixer -c 1 set Analogue 100%\n
An example of a device with volume turned all the way down - notice the Playback
values are 0
[0%]`:
Simple mixer control 'Analogue',0\nCapabilities: pvolume\nPlayback channels: Front Left - Front Right\nLimits: Playback 0 - 1\nMono:\nFront Left: Playback 0 [0%] [-6.00dB]\nFront Right: Playback 0 [0%] [-6.00dB]\n
Server stops playing after moving to new track in paly queue, Error in log Could not open playback device
The log contains these log lines:
[2019-06-19 20:52:51] [ LOG] laudio: open '/dev/snd/pcmC0D0p' failed (-16)[2019-06-19 20:52:51] [ LOG] laudio: Could not open playback device: Device or resource busy\n[2019-06-19 20:52:51] [ LOG] laudio: Device 'hw' does not support quality (48000/16/2), falling back to default\n[2019-06-19 20:52:51] [ LOG] laudio: open '/dev/snd/pcmC0D0p' failed (-16)[2019-06-19 20:52:51] [ LOG] laudio: Could not open playback device: Device or resource busy\n[2019-06-19 20:52:51] [ LOG] laudio: ALSA device failed setting fallback quality[2019-06-19 20:52:51] [ LOG] player: The ALSA device 'Computer' FAILED\n
If you have a RPI with a DAC hat with a pcm512x
chip will affect you. This is because the server wants to open the audio device for the next audio track whilst current track is still playing but the hardware does not allow this - see the comments above regarding determining concurrrent playback.
This error will occur for output hardware that do not support concurrent device open and the server plays 2 files of different bitrate (44.1khz and 48khz) back to back.
If you observe the error, you will need to use the dmix
configuration as mentioned above.
You have the choice of running Pulseaudio either in system mode or user mode. For headless servers, i.e. systems without desktop users, system mode is recommended.
If there is a desktop user logged in most of the time, a setup with network access via localhost only for daemons is a more appropriate solution, since the normal user administration (with, e.g., pulseaudio -k
) works as advertised. Also, the user specific configuration for pulseaudio is preserved across sessions as expected.
Credit: Rob Pope
This guide was written based on headless Debian Jessie platforms. Most of the instructions will require that you are root.
"},{"location":"advanced/outputs-pulse/#step-1-setting-up-pulseaudio","title":"Step 1: Setting up Pulseaudio","text":"If you see a \"Connection refused\" error when starting the server, then you will probably need to setup Pulseaudio to run in system mode [1]. This means that the Pulseaudio daemon will be started during boot and be available to all users.
How to start Pulseaudio depends on your distribution, but in many cases you will need to add a pulseaudio.service file to /etc/systemd/system with the following content:
# systemd service file for Pulseaudio running in system mode\n[Unit]\nDescription=Pulseaudio sound server\nBefore=sound.target\n\n[Service]\nExecStart=/usr/bin/pulseaudio --system --disallow-exit\n\n[Install]\nWantedBy=multi-user.target\n
If you want Bluetooth support, you must also configure Pulseaudio to load the Bluetooth module. First install it (Debian: apt install pulseaudio-module-bluetooth
) and then add the following to /etc/pulse/system.pa:
#### Enable Bluetooth\n.ifexists module-bluetooth-discover.so\nload-module module-bluetooth-discover\n.endif\n
Now you need to make sure that Pulseaudio can communicate with the Bluetooth daemon through D-Bus. On Raspbian this is already enabled, and you can skip this step. Otherwise do one of the following:
adduser pulse bluetooth
<policy context=\"default\"\\>
to \"allow\"Phew, almost done with Pulseaudio! Now you should:
systemctl enable pulseaudio
pactl list modules short
Add the user the server is running as (typically \"owntone\") to the \"pulse-access\" group:
adduser owntone pulse-access\n
Now (re)start the server.
"},{"location":"advanced/outputs-pulse/#step-3-adding-a-bluetooth-device","title":"Step 3: Adding a Bluetooth device","text":"To connect with the device, run bluetoothctl
and then:
power on\nagent on\nscan on\n**Note MAC address of BT Speaker**\npair [MAC address]\n**Type Pin if prompted**\ntrust [MAC address]\nconnect [MAC address]\n
Now the speaker should appear. You can also verify that Pulseaudio has detected the speaker with pactl list sinks short
.
Credit: wolfmanx and this blog
"},{"location":"advanced/outputs-pulse/#step-1-copy-system-pulseaudio-configuration-to-the-users-home-directory","title":"Step 1: Copy system pulseaudio configuration to the users home directory","text":"mkdir -p ~/.pulse\ncp /etc/pulse/default.pa ~/.pulse/\n
"},{"location":"advanced/outputs-pulse/#step-2-enable-tcp-access-from-localhost-only","title":"Step 2: Enable TCP access from localhost only","text":"Edit the file ~/.pulse/default.pa
, adding the following line at the end:
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1\n
"},{"location":"advanced/outputs-pulse/#step-3-restart-the-pulseaudio-deamon","title":"Step 3: Restart the pulseaudio deamon","text":"pulseaudio -k\n# OR\npulseaudio -D\n
"},{"location":"advanced/outputs-pulse/#step-4-adjust-configuration-file","title":"Step 4: Adjust configuration file","text":"In the audio
section of /etc/owntone.conf
, set server
to localhost
:
server = \"localhost\"\n
[1] Note that Pulseaudio will warn against system mode. However, in this use case it is actually the solution recommended by the Pulseaudio folks themselves.
"},{"location":"advanced/radio-streams/","title":"OwnTone and Radio Stream tweaking","text":"Radio streams have many different ways in how metadata is sent. Many should just work as expected, but a few may require some tweaking. If you are not seeing expected title, track, artist, artwork in clients or web UI, the following may help.
First, understand what and how the particular stream is sending information. ffprobe is a command that can be used to interegrate most of the stream information. ffprobe <http://stream.url>
should give you some useful output, look at the Metadata section, below is an example.
Metadata:\n icy-br : 320\n icy-description : DJ-mixed blend of modern and classic rock, electronica, world music, and more. Always 100% commercial-free\n icy-genre : Eclectic\n icy-name : Radio Paradise (320k aac)\n icy-pub : 1\n icy-url : https://radioparadise.com\n StreamTitle : Depeche Mode - Strangelove\n StreamUrl : http://img.radioparadise.com/covers/l/B000002LCI.jpg\n
In the example above, all tags are populated with correct information, no modifications to the server configuration should be needed. Note that StreamUrl points to the artwork image file.
Below is another example that will require some tweaks to the server, Notice icy-name
is blank and StreamUrl
doesn't point to an image.
Metadata:\n icy-br : 127\n icy-pub : 0\n icy-description : Unspecified description\n icy-url : \n icy-genre : various\n icy-name : \n StreamTitle : Pour Some Sugar On Me - Def Leppard\n StreamUrl : https://radio.stream.domain/api9/eventdata/49790578\n
In the above, first fix is the blank name, second is the image artwork.
"},{"location":"advanced/radio-streams/#1-set-stream-nametitle-via-the-m3u-file","title":"1) Set stream name/title via the M3U file","text":"Set the name with an EXTINF tag in the m3u playlist file:
#EXTM3U\n#EXTINF:-1, - My Radio Stream Name\nhttp://radio.stream.domain/stream.url\n
The format is basically #EXTINF:<length>, <Artist Name> - <Artist Title>
. Length is -1 since it's a stream, <Artist Name>
was left blank since StreamTitle
is accurate in the Metadata but <Artist Title>
was set to My Radio Stream Name
since icy-name
was blank.
If StreamUrl
does not point directly to an artwork file then the link may be to a json file that contains an artwork link. If so, you can make the server download the file automatically and search for an artwork link, and also track duration.
Try to download the file, e.g. with curl \"https://radio.stream.domain/api9/eventdata/49790578\"
. Let's assume you get something like this:
{\n \"eventId\": 49793707,\n \"eventStart\": \"2020-05-08 16:23:03\",\n \"eventFinish\": \"2020-05-08 16:27:21\",\n \"eventDuration\": 254,\n \"eventType\": \"Song\",\n \"eventSongTitle\": \"Pour Some Sugar On Me\",\n \"eventSongArtist\": \"Def Leppard\",\n \"eventImageUrl\": \"https://radio.stream.domain/artist/1-1/320x320/562.jpg?ver=1465083491\",\n \"eventImageUrlSmall\": \"https://radio.stream.domain/artist/1-1/160x160/562.jpg?ver=1465083491\",\n \"eventAppleMusicUrl\": \"https://geo.itunes.apple.com/dk/album/530707298?i=530707313\"\n}\n
In this case, you would need to tell the server to look for \"eventDuration\" and \"eventImageUrl\" (or just \"duration\" and \"url\"). You can do that like this:
curl -X PUT \"http://localhost:3689/api/settings/misc/streamurl_keywords_length\" --data \"{\\\"name\\\":\\\"streamurl_keywords_length\\\",\\\"value\\\":\\\"duration\\\"}\"\ncurl -X PUT \"http://localhost:3689/api/settings/misc/streamurl_keywords_artwork_url\" --data \"{\\\"name\\\":\\\"streamurl_keywords_artwork_url\\\",\\\"value\\\":\\\"url\\\"}\n
If you want multiple search phrases then comma separate, e.g. \"duration,length\".
"},{"location":"advanced/radio-streams/#3-set-metadata-with-a-custom-script","title":"3) Set metadata with a custom script","text":"If your radio station publishes metadata via another method than the above, e.g. just on their web site, then you will have to write a script that pulls the metadata and then pushes it to the server. To update metadata for the currently playing radio station use something like this JSON API request:
curl -X PUT \"http://localhost:3689/api/queue/items/now_playing?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg\"\n
If your radio station is not returning any artwork links, you can also just make a static artwork by placing a png/jpg in the same directory as the m3u, and with the same name, e.g. My Radio Stream.jpg
for My Radio Stream.m3u
.
It is possible to access a shared library over the internet from a DAAP client like iTunes. You must have remote access to the host machine.
First log in to the host and forward port 3689 to your local machine. You now need to broadcast the daap service to iTunes on your local machine. On macOS the command is:
dns-sd -P iTunesServer _daap._tcp local 3689 localhost.local 127.0.0.1 \"ffid=12345\"\n
The ffid
key is required but its value does not matter.
Your library will now appear as 'iTunesServer' in iTunes.
You can also access your library remotely using something like Zerotier. See this guide for details.
"},{"location":"clients/cli/","title":"Command line","text":"You can choose between:
mpc
Here is an example of how to use curl with DAAP/DACP. Say you have a playlist with a radio station, and you want to make a script that starts playback of that station:
sqlite3 [your OwnTone db]
. Use select id,title from files
to get the id of the radio station, and use select id,title from playlists
to get the id of the playlist.curl \"http://localhost:3689/login?pairing-guid=0x1&request-session-id=50\"\ncurl \"http://localhost:3689/ctrl-int/1/playspec?database-spec='dmap.persistentid:0x1'&container-spec='dmap.persistentid:0x[PLAYLIST-ID]'&container-item-spec='dmap.containeritemid:0x[FILE ID]'&session-id=50\"\ncurl \"http://localhost:3689/logout?session-id=50\"\n
"},{"location":"clients/mpd/","title":"MPD clients","text":"You can - to some extent - use clients for MPD to control OwnTone.
By default OwnTone listens on port 6600 for MPD clients. You can change this in the configuration file.
Currently only a subset of the commands offered by MPD (see MPD protocol documentation) are supported.
Due to some differences between OwnTone and MPD not all commands will act the same way they would running MPD:
The following table shows what is working for a selection of MPD clients:
Client Type Status mpc CLI Working commands: mpc, add, crop, current, del (ranges are not yet supported), play, next, prev (behaves like cdprev), pause, toggle, cdprev, seek, clear, outputs, enable, disable, playlist, ls, load, volume, repeat, random, single, search, find, list, update (initiates an init-rescan, the path argument is not supported) ympd Web Everything except \"add stream\" should work"},{"location":"clients/remote/","title":"Using Remote","text":"Remote gets a list of output devices from the server; this list includes any and all devices on the network we know of that advertise AirPlay: AirPort Express, Apple TV, ... It also includes the local audio output, that is, the sound card on the server (even if there is no soundcard).
OwnTone remembers your selection and the individual volume for each output device; selected devices will be automatically re-selected, except if they return online during playback.
"},{"location":"clients/remote/#pairing","title":"Pairing","text":"If Remote doesn't connect to OwnTone after you entered the pairing code something went wrong. Check the log file to see the error message. Here are some common reasons:
You did not enter the correct pairing code
You will see an error in the log about pairing failure with a HTTP response code that is not 0.
Solution: Try again.
No response from Remote, possibly a network issue
If you see an error in the log with either:
it means that OwnTone could not establish a connection to Remote. This might be a network issue, your router may not be allowing multicast between the Remote device and the host OwnTone is running on.
Solution 1: Sometimes it resolves the issue if you force Remote to quit, restart it and do the pairing proces again. Another trick is to establish some other connection (eg SSH) from the iPod/iPhone/iPad to the host.
Solution 2: Check your router settings if you can whitelist multicast addresses under IGMP settings. For Apple Bonjour, setting a multicast address of 224.0.0.251 and a netmask of 255.255.255.255 should work.
Otherwise try using avahi-browse for troubleshooting:
avahi-browse -r -k _touch-remote._tcp
+ ath0 IPv4 59eff13ea2f98dbbef6c162f9df71b784a3ef9a3 _touch-remote._tcp local\n= ath0 IPv4 59eff13ea2f98dbbef6c162f9df71b784a3ef9a3 _touch-remote._tcp local\n hostname = [Foobar.local]\n address = [192.168.1.1]\n port = [49160]\n txt = [\"DvTy=iPod touch\" \"RemN=Remote\" \"txtvers=1\" \"RemV=10000\" \"Pair=FAEA410630AEC05E\" \"DvNm=Foobar\"]\n
Hit Ctrl-C to terminate avahi-browse.
To check for network issues you can try to connect to address and port with telnet.
OwnTone supports these kinds of clients:
Like iTunes, you can control OwnTone with Remote and stream your music to AirPlay devices.
A single OwnTone instance can handle several clients concurrently, regardless of the protocol.
By default all clients on 192.168.* (and the ipv6 equivalent) are allowed to connect without authentication. You can change that in the configuration file.
Here is a list of working and non-working DAAP and Remote clients. The list is probably obsolete when you read it :-)
Client Developer Type Platform Working (vers.) iTunes Apple DAAP Win Yes (12.10.1) Apple Music Apple DAAP MacOS Yes Rhythmbox Gnome DAAP Linux Yes Diapente diapente DAAP Android Yes WinAmp DAAPClient WardFamily DAAP WinAmp Yes Amarok w/DAAP plugin KDE DAAP Linux/Win Yes (2.8.0) Banshee DAAP Linux/Win/OSX No (2.6.2) jtunes4 DAAP Java No Firefly Client (DAAP) Java No Remote Apple Remote iOS Yes (4.3) Retune SquallyDoc Remote Android Yes (3.5.23) TunesRemote+ Melloware Remote Android Yes (2.5.3) Remote for iTunes Hyperfine Remote Android Yes Remote for Windows Phone Komodex Remote Windows Phone Yes (2.2.1.0) TunesRemote SE Remote Java Yes (r108) rtRemote for Windows bizmodeller Remote Windows Yes (1.2.0.67)"},{"location":"clients/web-interface/","title":"OwnTone web interface","text":"Mobile friendly player web interface for OwnTone build with Vue.js, Bulma.
You can find the web interface at http://owntone.local:3689 or alternatively at http://SERVER_ADDRESS:3689.
Use the web interface to control playback, trigger manual library rescans, pair with remotes, select speakers, authenticate with Spotify, etc.
"},{"location":"clients/web-interface/#screenshots","title":"Screenshots","text":""},{"location":"clients/web-interface/#usage","title":"Usage","text":"You can find OwnTone's web interface at http://owntone.local:3689 or alternatively at http://SERVER_ADDRESS:3689.
"},{"location":"clients/web-interface/#build-setup","title":"Build Setup","text":"The source is located in the web-src
folder.
cd web-src\n
The web interface is built with Vite, makes use of Prettier for code formatting and ESLint for code linting (the project was set up following the guide ESLint and Prettier with Vite and Vue.js 3
# install dependencies\nnpm install\n\n# Serve with hot reload at localhost:3000\n# (assumes that OwnTone server is running on localhost:3689)\nnpm run serve\n\n# Serve with hot reload at localhost:3000\n# (with remote OwnTone server reachable under owntone.local:3689)\nVITE_OWNTONE_URL=http://owntone.local:3689 npm run serve\n\n# Build for production with minification (will update web interface\n# in \"../htdocs\")\nnpm run build\n\n# Format code\nnpm run format\n\n# Lint code (and fix errors that can be automatically fixed)\nnpm run lint\n
After running npm run serve
the web interface is reachable at localhost:3000. By default it expects owntone to be running at localhost:3689 and proxies all JSON API calls to this location.
If the server is running at a different location you have to set the env variable VITE_OWNTONE_URL
.
You can have OwnTone scrobble the music you listen to. To set up scrobbling go to the web interface and authorize OwnTone with your LastFM credentials.
OwnTone will not store your LastFM username/password, only the session key. The session key does not expire.
"},{"location":"integrations/spotify/","title":"Spotify","text":"OwnTone has built-in support for playback of the tracks in your Spotify library.
You must have a Spotify premium account. If you normally log into Spotify with your Facebook account you must first go to Spotify's web site where you can get the Spotify username and password that matches your account.
You must also make sure that your browser can reach OwnTone's web interface via the address http://owntone.local:3689. Try it right now! That is where Spotify's OAuth page will redirect your browser with the token that OwnTone needs, so it must work. The address is announced by the server via mDNS, but if that for some reason doesn't work then configure it via router or .hosts file. You can remove it again after completing the login.
To authorize OwnTone, open the web interface, locate Settings > Online Services and then click the Authorize button. You will then be sent to Spotify's authorization service, which will send you back to the web interface after you have given the authorization.
Spotify no longer automatically notifies clients about library updates, so you have to trigger updates manually. You can for instance set up a cron job that runs /usr/bin/curl http://localhost:3689/api/update
To logout and remove Spotify tracks + credentials make a request to http://owntone.local:3689/api/spotify-logout.
Limitations: You will not be able to do any playlist management through OwnTone - use a Spotify client for that. You also can only listen to your music by letting OwnTone do the playback - so that means you can't stream to DAAP clients (e.g. iTunes) and RSP clients.
"},{"location":"integrations/spotify/#via-librespotspocon","title":"Via librespot/spocon","text":"You can also use OwnTone with one of the various incarnations of librespot. This adds librespot as a selectable metaspeaker in Spotify's client, and when you start playback, librespot can be configured to start writing audio to a pipe that you have added to your library. This will be detected by OwnTone that then starts playback. You can also have a pipe for metadata and playback events, e.g. volume changes.
The easiest way of accomplishing this may be with Spocon, since it requires minimal configuration. After installing, create two pipes (with mkfifo) and set the configuration in the player section:
# Audio output device (MIXER, PIPE, STDOUT)\noutput = \"PIPE\"\n# Output raw (signed) PCM to this file (`player.output` must be PIPE)\npipe = \"/srv/music/spotify\"\n# Output metadata in Shairport Sync format (https://github.com/mikebrady/shairport-sync-metadata-reader)\nmetadataPipe = \"/srv/music/spotify.metadata\"\n
"},{"location":"outputs/airplay/","title":"AirPlay devices/speakers","text":"OwnTone will discover the AirPlay devices available on your network. For devices that are password-protected, the device's AirPlay name and password must be given in the configuration file. See the sample configuration file for the syntax.
If your Apple TV requires device verification (always required by Apple TV4 with tvOS 10.2) then you can do that through Settings > Remotes & Outputs in the web interface: Select the device and then enter the PIN that the Apple TV displays.
If your speaker is silent when you start playback, and there is no obvious error message in the log, you can try disabling ipv6 in the config. Some speakers announce that they support ipv6, but in fact don't (at least not with forked- daapd).
If the speaker becomes unselected when you start playback, and you in the log see \"ANNOUNCE request failed in session startup: 400 Bad Request\", then try the Apple Home app > Allow Speakers & TV Access > Anyone On the Same Network (or Everyone).
"},{"location":"outputs/chromecast/","title":"Chromecast","text":"OwnTone will discover Chromecast devices available on your network, and you can then select the device as a speaker. There is no configuration required.
"},{"location":"outputs/local-audio/","title":"Local audio","text":""},{"location":"outputs/local-audio/#local-audio-through-alsa","title":"Local audio through ALSA","text":"In the config file, you can select ALSA for local audio. This is the default.
When using ALSA, the server will try to syncronize playback with AirPlay. You can adjust the syncronization in the config file.
For most setups the default values in the config file should work. If they don't, there is help here
"},{"location":"outputs/local-audio/#local-audio-bluetooth-and-more-through-pulseaudio","title":"Local audio, Bluetooth and more through Pulseaudio","text":"In the config file, you can select Pulseaudio for local audio. In addition to local audio, Pulseaudio also supports an array of other targets, e.g. Bluetooth or DLNA. However, Pulseaudio does require some setup, so here is a separate page with some help on that: Pulse audio
Note that if you select Pulseaudio the \"card\" setting in the config file has no effect. Instead all soundcards detected by Pulseaudio will be listed as speakers by OwnTone.
You can adjust the latency of Pulseaudio playback in the config file.
"},{"location":"outputs/streaming/","title":"MP3 network streaming (streaming to iOS)","text":"You can listen to audio being played by OwnTone by opening this network stream address in pretty much any music player:
http://owntone.local:3689/stream.mp3 or http://SERVER_ADDRESS:3689/stream.mp3
This is currently the only way of listening to your audio on iOS devices, since Apple does not allow AirPlay receiver apps, and because Apple Home Sharing cannot be supported by OwnTone. So what you can do instead is install a music player app like VLC, connect to the stream and control playback with Remote.
In the speaker selection list, clicking on the icon should start the stream playing in the background on browsers that support that.
Note that MP3 encoding must be supported by ffmpeg/libav for this to work. If it is not available you will see a message in the log file. In Debian/Ubuntu you get MP3 encoding support by installing the package \"libavcodec-extra\".
"}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000000..00c26f7d02 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,128 @@ + +To add a smart playlist to the server, create a new text file with a filename ending with .smartpl; the filename doesn't matter, only the .smartpl ending does. The file must be placed somewhere in your library folder.
The contents of a smart playlist must follow the syntax:
There is exactly one smart playlist allowed for a .smartpl file.
An expression consists of:
Where valid field-names (with their types) are:
artist
(string)album_artist
(string)album
(string)title
(string)genre
(string)composer
(string)comment
(string)path
(string)type
(string)grouping
(string)data_kind
(enumeration)media_kind
(enumeration)play_count
(integer)skip_count
(integer)rating
(integer)year
(integer)compilation
(integer)track
(integer)disc
(integer)time_added
(date)time_modified
(date)time_played
(date)time_skipped
(date)random
(special)file_size
(integer)Valid operators include:
is
, includes
, starts with
, ends with
(string)>
, <
, <=
, >=
, =
(int)after
, before
(date)is
(enumeration)The is
operator must exactly match the field value, while the includes
operator matches a substring. The starts with
operator matches, if the value starts with the given prefix, and ends with
matches the opposite. All these matches are case-insensitive.
Valid operands include:
Valid operands for the enumeration data_kind
are:
file
url
spotify
pipe
Valid operands for the enumeration media_kind
are:
music
movie
podcast
audiobook
tvshow
Multiple expressions can be anded or ored together, using the keywords OR
and AND
. The unary not operator is also supported using the keyword NOT
.
It is possible to define the sort order and limit the number of items by adding an order clause and/or a limit clause after the last expression:
"sort-direction" is either ASC
(ascending) or DESC
(descending). "limit" is the maximum number of items.
There is additionally a special random
field-name that can be used in conjunction with limit
to select a random number of items based on current expression.
This would match songs by "Rob Zombie" or "White Zombie", as well as those with a genre of "Techno-Industrial" or "Trance/Techno", for example.
"techno 2015" {
+ genre includes "techno"
+ and artist includes "zombie"
+ and not genre includes "industrial"
+}
+
This would exclude e. g. songs with the genre "Techno-Industrial".
This would match all songs added as files to the library that are not placed under the folders for podcasts, audiobooks.
"Unplayed podcasts and audiobooks" {
+ play_count = 0
+ and (media_kind is podcast or media_kind is audiobook)
+}
+
This would match any podcast and audiobook file that was never played.
This would match the last 10 music files added to the library."Random 10 Rated Pop songs" {
+ rating > 0 and
+ genre is "Pop" and
+ media_kind is music
+ order by random desc
+ limit 10
+}
+
One example of a valid date is a date in yyyy-mm-dd format:
There are also some special date keywords:
today
, yesterday
, this week
, last week
, last month
, last year
These dates refer to the start of that period; today
means 00:00hrs of today, this week
means current Monday 00:00hrs, last week
means the previous Monday 00:00hrs, last month
is the first day of the previous month at 00:00hrs etc.
A valid date can also be made by applying an interval to a date. Intervals can be defined as days
, weeks
, months
, years
. As an example, a valid date might be:
3 weeks before today
or 3 weeks ago
Examples:
This matches all songs added in the last 2 weeks.
This matches all audiobooks played since the start of the last Monday 00:00AM.
All dates, except for YYYY-DD-HH
, are relative to the day of when the server evaluates the smartpl query; time_added after today
run on a Monday would match against items added since Monday 00:00hrs and evaluating the same smartpl on Friday would only match against added on Friday 00:00hrs.
Note that time_added after 4 weeks ago
and time_added after last month
are subtly different; the former is exactly 4 weeks ago (from today) whereas the latter is the first day of the previous month.
The syntax is really close to the mt-daapd smart playlist syntax (see http://sourceforge.net/p/mt-daapd/code/HEAD/tree/tags/release-0.2.4.2/contrib/mt-daapd.playlist).
Even this documentation is based on the file linked above.
Some differences are:
||
, &&
, !
are not supported (use or
, and
, not
)