-
Notifications
You must be signed in to change notification settings - Fork 463
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
Add librespot-java stream source #928
Comments
I would like to see the librespot-java get supported. I have just used librespot-api (it is within the librespot-java package) to replace librespot. The advantage of librespot-java is to have the cover art image and metadata available. With librespot-api, "curl -X POST http://localhost:24879/player/next , prev, pause, resume, or etc, can be sent to the spotify host app". I set up librespot-java to send output to the pipe such that I can use equaliser such as alsaequal or eqfa4p in addition to the default sound card with aplay. The aplay command line is "aplay -D eqfa4p -r raw -f cd < myLibrespot-java-pipe.raw". |
It seems that there is some bigger refactoring going on with librespot (new-api branch), as you can see in this discussion, they also mention that the java implementation might be ahead in some regards:
For testing purposes I've replaced
logging seems to go to stdout, so I had to disable it. The stream is setup as follows:
Feel free to test this setup and give feedback |
Just for reference if someone else has an issue in the future: Otherwise it works perfectly. librespot-java seems to be more responsive regarding Spotify Connect, has much better queue compatibility and also does playback reporting. |
|
Regarding @manfreddz's tip, both |
You might also run into a difference in the volume control mappings between librespot-org/librespot and librespot-org/librespot-java. See patch at librespot-org/librespot-java#373 (comment) for a quick and dirty (i.e. no config) implementation of something like librespot's logarithmic volume control but for librespot-java. |
Does meta_librespot-java.py still work? I can't get it to work properly with the new version of Snapweb |
@ChrisIossa what exactly is not working for you, with which versions (Snapserver, Snapweb, Librespot)? |
I was actually having trouble getting the control script working at all. Neither the metadata nor the playback controls were showing up in the recent version of Snapweb. After doing some digging I found out it was because the script and Librespot were starting at the same time (when Snapserver comes up) and since Librespot java takes some time to spin up, the script was trying and failing to connect to the websocket (which wasn't open yet). Adding a |
I already fixed the same issue in Can you please try if this version fixes the probem? It simply continuously retries to open the websocket to librespot: |
So the change to the websocket loop fixes the errors for when self.websocket = websocket.WebSocketApp(
url=f"ws://{self._params['librespot-host']}:{self._params['librespot-port']}/events",
on_message=lambda ws, msg: self.on_ws_message(ws, msg),
on_error=lambda ws, error: self.on_ws_error(ws, error),
on_open=lambda ws: self.on_ws_open(ws),
on_close=lambda ws, close_status_code, close_msg: self.on_ws_close(ws, close_status_code, close_msg)
) |
Why do you need these lambdas? The constructor is the same as before, except that the Edit: May it be related to the version of the wsversion = websocket.__version__.split(".")
if int(wsversion[0]) == 0 and int(wsversion[1]) < 58:
logger.error(
f"websocket-client version 0.58.0 or higher required, installed: {websocket.__version__}, exiting."
)
exit() |
librespot-java provides an API for local control of the spotify client whereas librespot does not.
I'd like to see librespot-java considered as an (autodetected?) alternative for
librespot://
or as an additionallibrespot-java://
stream source.Counter-argument that librespot-java isn't as active as librespot.
Another counter-argument: just use
process://
.(What advantage is there internally for snapcast having specific stream sources instead of just
process://
? Is it the metadata formats?)For reference spocon packages librespot-java for Debian, etc.
Thoughts?
The text was updated successfully, but these errors were encountered: