How to send files over ipc socket

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
elecen
Posts: 3
Joined: February 19th, 2020, 9:10 pm

How to send files over ipc socket

Post by elecen »

What I'm trying to do
I want to tell mpd to play a file from the hard drive (adding it to the queue). I do not want it to build any database over some folder. Just add a URI to the queue. A few seconds before the track is over I will add the next track to the queue (and might add crossfade parameter)

What I tried
I tried add URI and got the error no database. Well, I really don't want the MPD process to mingle with files and databases. I just want to add to the QUEUE what to play at that moment and be able to specify crossfade for each occasion.

What I've done
I've read in the default configuration file that disabling the music directory, playlists, etc will allow me to add/play the file over IPC socket. So, I modified the code to work with AF_UNIX sockets. I can connect, send commands, read the return codes and results. But how do I send the file using the file:// protocol as indicated in the config file? What command should I use?

Any help would be greatly appreciated.

max
Forum team
Posts: 1093
Joined: January 15th, 2013, 3:43 pm

Re: How to send files over ipc socket

Post by max »

The "add" command.

elecen
Posts: 3
Joined: February 19th, 2020, 9:10 pm

Re: How to send files over ipc socket

Post by elecen »

Add command responded with exception no database even though in my mpd config everything related to files, directories and db is disabled.
Maybe I'm the format wrong?
Lets assume file is located at /storage/file.mp3
I issued
add file:/storage/file.mp3

response was exception no database.

elecen
Posts: 3
Joined: February 19th, 2020, 9:10 pm

Re: How to send files over ipc socket

Post by elecen »

Hi Max, I managed to get it to work. With the URI formatted as file:///storage/file.mp3 it eventually worked. Not really sure why it wasn't working earlier.

Sorry for taking your time with such trivial bug.

Best,
p.t.

Post Reply