mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.28k stars 574 forks source link

Pipe not working - Can't run shairport-sync with pipe config #579

Closed CoyoTea closed 7 years ago

CoyoTea commented 7 years ago

Hi, I have shairport-sync & forked-daapd setup on a raspi3. Both work fine in normal config as services. I want to pipe incoming audio to forked-daapd to use multiple airplay speakers simultaniously. Forked-daapd is configured and paired with remote-app. Shairport-Sync has some weird issue once I edit the config to use output_backend = "pipe"; and edit the pipe path to pipe = "/srv/music/airplay"; I 'sudo systemctl restart shairport-sync' with this output

pi@onion-pi:~ $ systemctl status shairport-sync.service
● shairport-sync.service - ShairportSync AirTunes receiver
   Loaded: loaded (/lib/systemd/system/shairport-sync.service; enabled)
   Active: failed (Result: exit-code) since Mon 2017-08-21 23:08:49 CEST; 1s ago
  Process: 2222 ExecStart=/usr/local/bin/shairport-sync (code=exited, status=1/FAILURE)

So I check /var/log/syslog and it outputs

Aug 21 23:06:13 onion-pi systemd[1]: Starting ShairportSync AirTunes receiver...
Aug 21 23:06:13 onion-pi systemd[1]: Started ShairportSync AirTunes receiver.
Aug 21 23:06:13 onion-pi shairport-sync[2176]: Line 135 of the configuration file "/usr/local/etc/shairport-sync.conf":
Aug 21 23:06:13 onion-pi shairport-sync[2176]: syntax error
Aug 21 23:06:13 onion-pi systemd[1]: shairport-sync.service: main process exited, code=exited, status=1/FAILURE
Aug 21 23:06:13 onion-pi systemd[1]: Unit shairport-sync.service entered failed state.

Line 135 of config file is the { below pipe

// Parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
pipe = "/srv/music/airplay";
{
//  name = "/path/to/pipe"; // there is no default pipe name for the output
};

// These are no configuration file parameters for the "stdout" audio back end. No interpolation is done.

// These are no configuration file  parameters for the "ao" audio back end. No interpolation is done.

// Static latency settings are deprecated and the settings have been removed.

It might not even be an issue but merely blindness and stupidity on my side, but i couldnt find anything concerning this issue. Thx for your work. Hope this helps

mikebrady commented 7 years ago

There's a syntax error in the configuration file. The pipe = "stuff" is incorrect. It should read something like this (not checked on a device):

// Parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
pipe = 
{
  name = "/srv/music/airplay"; // there is no default pipe name for the output
};
CoyoTea commented 7 years ago

Thanks for clearing that up. Must have mixed things up. The code below seems to do it in terms of syntax.

// Parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
pipe =
{
  name = "/srv/pipe"; // there is no default pipe name for the output
};

But shairport-sync stil spits out this error in the syslog

Aug 22 08:59:35 onion-pi shairport-sync[2983]: Could not create output pipe "/srv/pipe"

I guess permissions, but I got no clue how to fix that.

mikebrady commented 7 years ago

Okay, the permissions thing: you need to figure out what user and group shairport-sync will be running under, and then make sure that the directory /srv exists and has permissions that allow that user and group to write to it.

If you are starting Shairport Sync using the standard script installed by the # make install step, then the user and group will both be named shairport-sync. You'll probably have to be superuser to create the /srv directory, and you can then set its owner and group using the $ chown command line command. I suggest you look it up – it's outside the scope of this forum.

CoyoTea commented 7 years ago

Thanks for the hint. Creating folder and adjusting permissions with sudo chmod -R 777 /srv/music with pipe path to /srv/music/pipe did it. Problem solved. Now pipe to forked-daapd works. Thx for your work.

mikebrady commented 7 years ago

Cool – I corrected my suggestion in case it misleads future reader...