-
Notifications
You must be signed in to change notification settings - Fork 5
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 Linux implementation #10
Conversation
I would appreciate it if LabyStudio update his Spotify addon on FlintMC along with this PR if it gets merged |
I’m currently writing DBus parser to use this without playerctl installed. |
I’m JavaScript developer so I may not use Java naming conventions. |
Hey, nice work! |
I warpped D-Bus communication to MPRISCommunicator class now. Also LabyStudio, Please note that this only works with Linux distros that uses systemd. |
I've changed the structure of the dbus & mpris api, but it may not work anymore because I'm on Windows and can't test it properly. I guess you will have to debug it really quick and adjust the parsing to fix the issues |
I don't know exactly why but runtime.exec didn't work well with dbus-send in past and now. |
I managed to connect to the dbus of my WSL and test the Linux implementation under Windows. |
Note that position unit is in seconds, not milliseconds. |
Nevermind, It was in milliseconds. |
2024-01-09.12-55-46.mp4I ported this PR to the Spotify addon and this is happening. Any solutions to this? |
I tested this on my actual LabyMod config that i use when playing, And whenever i pause and play, The widget disappers. |
I tested it and this is the output when I play and pause:
|
It was because when sending dbus-send to call function, It does not print anything except for |
…nt if the media player interrupts or changes its current "direction". added a getPosition output line at onSync in SpotifyListenerTest to debug its current calculated position
The onPositionChanged in the listener you are using should not be used as an indicator of its actual current position. It is actually an indicator of a change in the current "flow" or "direction". The api.getPosition() function automatically calculates Spotify's current position by adding the elapsed time to the last known position. If for some reason your position still jumps, that must be a different problem. I just tested it again and it works fine for me. |
Ooh so the last known position works like offset for getting current position. |
Nice! Ready for merge? |
Yup |
Thank you for your awesome contribution! |
No problem! |
Adds Linux implementation using MPRIS and DBus
Will work on almost all distros that uses systemd (Almost all distros use systemd)