mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1160] Event System overehauled, not yet released #535
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#535
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @K1ngjulien on GitHub (May 2, 2023).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1160
Hi!
I'm working on automatically turn on my sound system when a device connects to my raspotify (wrapper of librespot) instance using the following script.
https://gitlab.com/k1ngjulien/raspotify-handler
While writing docs for all the different parameters being passed from the rust source code, i noticed that the event names did not match those found in the source code...
(I would be happy to clean up the docs and add them here in the upstream wiki)
Describe the bug
It looks to me like the event system was overhauled months ago, yet the released packages all still contain the old api.
github.com/librespot-org/librespot@8545f361c4 (diff-fc7864922f)When can I expect these 6month old changes to land on a release tag?
I am running the latest 0.4.2 release but even this seems out of date.
To reproduce
Steps to reproduce the behavior:
librespot -v --onevent something.pyLog
when looking at the current source code, it should be "track_changed" and not "changed"
https://github.com/librespot-org/librespot/blob/dev/src/player_event_handler.rs#L30
Host (what you are running
librespoton):Linux page 6.1.19-v7+ #1637 SMP Tue Mar 14 11:04:52 GMT 2023 armv7l GNU/Linux
Raspberry Pi 3 Model B Rev 1.2
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
@K1ngjulien commented on GitHub (May 2, 2023):
@JasonLG1979 Is this something you can bundle with raspotify or has your fork diverged too much?
I will try building librespot from HEAD of dev and see if i can get all the event details that way.
@JasonLG1979 commented on GitHub (May 2, 2023):
No.
@JasonLG1979 commented on GitHub (May 2, 2023):
Here is an example event handler script written in python with all of the events listed for the dev branch.
https://github.com/librespot-org/librespot/blob/dev/contrib/event_handler_example.py
@K1ngjulien commented on GitHub (May 3, 2023):
so im guessing the raspotify librespot has diverged too much from upstream? any particular reason why?
@JasonLG1979 commented on GitHub (May 3, 2023):
No. The use of the new API in the dev branch facilitated the event revamp. Backporting makes no sense because what you would end up with would be the dev branch.
@JasonLG1979 commented on GitHub (May 3, 2023):
If you want to use those events you'll need to use the dev branch and roll your solution. Events don't really work at all with Raspotify with how locked down the service is and I really don't plan on changing that or supporting events or inevitably whatever they're triggering.
@K1ngjulien commented on GitHub (May 3, 2023):
hmm events seem to work just fine with raspotify.
i just added the following to
/etc/raspotify/confand it called my script right away, even tho its still sending the old events.to me it seems like raspotify is not doing much besides passing the config value as a parameter when running librespot.
currently trying to build librespot for/on my raspberry pi 3, we'll see how that works :D
@JasonLG1979 commented on GitHub (May 3, 2023):
The event script will have the same restrictions as the librespot binary.
Building on a Pi takes forever. You can build an ARM binary using docker in less than 5 min.
@JasonLG1979 commented on GitHub (May 3, 2023):
The easiest way to work around any restrictions is to UDP multicast the events with something like this:
https://gist.github.com/JasonLG1979/934a5bd969180141a970e2e8197c1f09
With that the receiver of the event only needs to be on the same network.
@K1ngjulien commented on GitHub (May 3, 2023):
Huh I didn't even know you could listen to the events over the network :D
anyway, i was able to do what i wanted (which was automatically turn on my sound system when a client connects) with the following script:
https://gitlab.com/k1ngjulien/raspotify-handler/-/blob/main/soundsystem-on.sh
idk what restrictions you're talking about, but the
--oneventparameter works just fine for my use :) I was just confused as to why the event names were all weird until i noticed that this was changed about 6months ago.would be neat if at least the new
src/player_event_handler.rscould land in raspotify, even if I can do everything i needed with the old "api"@K1ngjulien commented on GitHub (May 3, 2023):
anyways, my sound system now automatically turns on when i connect to raspotify with my phone 🎉
I'll consider my issue to be solved 😊
@JasonLG1979 commented on GitHub (May 3, 2023):
If that works for you with stock Raspotify please consider adding a wiki howto page.
@K1ngjulien commented on GitHub (May 3, 2023):
sure! but only if you can upstream the api changes :P /s
@JasonLG1979 commented on GitHub (May 3, 2023):
You don't need the new API if all your doing is turning an amp on and off. When whatever dev becomes is released Raspotify will switch to that version.
@K1ngjulien commented on GitHub (May 3, 2023):
I've added a Wiki entry. I'm surprised I'm just allowed to edit all those pages 😅
https://github.com/dtcooper/raspotify/wiki/How-To:-Listen-To-Librespot-Events
@JasonLG1979 commented on GitHub (May 3, 2023):
Thanks. Yep wikis by default are writeable to everyone.