owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.1k stars 237 forks source link

Difficulties using MPD in proxy mode #898

Open kinglouie opened 4 years ago

kinglouie commented 4 years ago

I'm really happy with forked daapd running on a server so far with using ios remote app, the webinterface or itunes.

Now I want to create a setup on my personal linux machine using mpd which works similar to itunes with forked-daapd as in Itunes reads the database of forked-daapd but plays from the local machine. Mpc or other clients would control forked-daapd itself but I don't want that. I found a configuration example on the mpd docs where you let mpd read the database from another mpd but play the files locally e.g. from a samba share.

See this configuration example: https://www.musicpd.org/doc/html/user.html#satellite

So following the example from the docs I installed mpd on my linux machine, setup forked-daapd as database proxy and mounted the share from the server forked-daapd is running on.

Now if I query the mpd running on my linux machine with mpc it successfully reads the database from forked-daapd.

The issue im facing is that forked-daapd returns incompatible paths e.g:

> mpc search title "kiara"
file:/music/Bonobo/Black Sands/Kirara.mp3

On my linux machine mpd tries to play

~/music/file:/music/Bonobo/Black Sands/Kirara.mp3

where ~/music is the mounted directory from the server forked-daapd is running on. For this to work forked-daapd should return paths without file:/music/ .

If I install my own mpd server with a music library it doesn't use absolute paths on mpc queries, so is there a reason forked-daapd does this different?

chme commented 4 years ago

The reason forked-daapd uses absolute paths is, that forked-daapd supports multiple music directories (mpd only has one music directory). The prefix "file:/" was introduces to be able to list spotify files (prefixed with "spotify:/").

I have to admit, that this solution is not the best one. And it would probably be good to investigate if, mpd's mount options would be a better fit, to handle multiple directories and sources. But that's quite some work ...

kinglouie commented 4 years ago

That seems reasonable, however would it be possible to introduce some kind of single library config option that removes these path prefixes? I think there are a lot of users not needing spotify or multiple music library folders. EDIT: Maybe this could even be automatic so if you only have one library defined it uses relative paths and if you have defined multiple libs it uses absolute paths

chme commented 4 years ago

Unfortunately that's not an easy task as well. Currently forked-daapd depends in some places on the prefix to identify from where the item originated. Would be nice to get that cleaned up, but as said, requires quite some work (we would also need to figure out how to migrate exiting libraries, etc.).