Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back pipe backend #354

Closed
3 tasks
mainrs opened this issue Oct 5, 2019 · 8 comments · Fixed by #1284
Closed
3 tasks

Bring back pipe backend #354

mainrs opened this issue Oct 5, 2019 · 8 comments · Fixed by #1284
Labels
enhancement A new feature that would improve Spotifyd wontfix Issues that will not be fixed under any circumstances

Comments

@mainrs
Copy link
Member

mainrs commented Oct 5, 2019

#283 removed the pipe backend during the Great Refactoring (TM pending). Might be a good idea to bring it back at some point.

Thinks to take care of:

  • Logging to stdout would interfere with this feature. So if --backend pipe is specified and the daemon runs with the --no-daemon flag, all logging would have to happen on stderr instead.
  • Add the new backend to the Backend enum.
  • Add the needed code to setup.rs (I think this is were the backend logic lies).

"Fixes" #256 by basically providing the functionality in the first place.

@mainrs mainrs added the enhancement A new feature that would improve Spotifyd label Oct 5, 2019
@misuzu
Copy link

misuzu commented Jan 10, 2020

Something like this would be better:

backend = pipe
device = "ffmpeg -re -i - -c:a copy -f rtp rtp://127.0.0.1:1234"

spotifyd would start ffmpeg and pipe audio to ffmpeg's stdin and there would not be any logging issues.

@awerlang
Copy link
Contributor

spotifyd would start ffmpeg and pipe audio to ffmpeg's stdin and there would not be any logging issues.

A new option (pipe_command) could be added for this, as the device should be used to point to a named pipe. I don't think spotifyd should be spawning processes though.

@misuzu
Copy link

misuzu commented May 17, 2020

I've added this feature to librespot-org, should be easy to adapt: librespot-org/librespot#422

@awerlang
Copy link
Contributor

awerlang commented May 18, 2020

Being "easy to adapt" isn't a good reason to implement a feature.

The proposal for a subprocess backend (there it's a separate backend, a little different than what's proposed here) it's bad solution because then you have to handle failure in the spawned process. If spotifyd fails, then you have to restart both processes.

The pipe backend on the other hand would already allow, when re-integrated, in two ways

  1. spotifyd --backend pipe | player ...
  • redirect log to stderr, just like any tool have been doing (curl, wget, etc.)
  1. spotifyd --backend pipe --device /tmp/musicfifo player /tmp/musicfifo
  • both processes can be run as separate users, which is great from a security perspective

Is there an use case where the subprocess backend would help where pipe wouldn't?

@misuzu
Copy link

misuzu commented May 18, 2020

If spotifyd fails, then you have to restart both processes.

This is handled by init system.

Is there an use case where the subprocess backend would help where pipe wouldn't?

You'll need to modify systemd unit to use pipe backend. When stdout consumer crashes, it won't be restarted. With subprocess you'll only need to edit spotifyd's config and consumer restarts will be handled automatically.

@awerlang
Copy link
Contributor

If spotifyd fails, then you have to restart both processes.

This is handled by init system.

Let me rephrase: If spotifyd fails, then both processes have to be restarted. It doesn't matter if such restart is automatic, there's still the instability in one process taking down the other. It doesn't need to be case with the pipe backend.

Is there an use case where the subprocess backend would help where pipe wouldn't?

You'll need to modify systemd unit to use pipe backend. When stdout consumer crashes, it won't be restarted. With subprocess you'll only need to edit spotifyd's config and consumer restarts will be handled automatically.

The subcommand approach requires the single systemd unit to have maximum permissions. With the pipe backend, you can have one system unit, running a separate user, minimal permissions, only one directory and network. Then the playback is either a regular process, or an user systemd service.

In sum, the subcommand backend doesn't add any new capability over the pipe backend, which allows more control over the processes.

@Rohmilchkaese
Copy link

Is there anything I can do, to get pipe backend ?
Is someone working on that ?

Just to get you right:
There is no pipe backend implemented at all at the moment ?
Or it just doesn’t get build with pipe support ?

@stale
Copy link

stale bot commented Jan 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix Issues that will not be fixed under any circumstances label Jan 13, 2021
@stale stale bot closed this as completed Jan 23, 2021
eladyn pushed a commit that referenced this issue Oct 21, 2024
add pipe as a backend, which sends audio to stdout or the file handle
given to --device

Fixes #354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature that would improve Spotifyd wontfix Issues that will not be fixed under any circumstances
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants