-
Notifications
You must be signed in to change notification settings - Fork 452
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
Dbus not avalible when headless #244
Comments
I just ran into this as well (due to Arch/AUR enabling all features):
Interestingly it still doesn't work for me if a user DBUS session is available (ie. when run as root via SSH) - it will start and become visible in proprietary Spotify clients, but exits as soon as playback is switched to spotifyd. I don't see an obvious error in the debug logs, but the Ok(NotReady) does seem suspicous. When I rebuild without dbus_mpris and dbus_keyring everything works fine.
|
Having the same issue, however it works for me after disabling only |
I can introduce a new config entry for this one. |
Going to push a change on this one today. The naming is a little bit off. As far as I understood dbus_keyring, which uses the Linux secrets api, needs dbus. But I didn't know that a system bus is always available. Because of that, the feature would probably be better of named keyring only. Looks like it isn't that easy to add a new flag... |
Note to self: It needs a little bit more refactoring as the relevant information doesn't get passed down to the dbus server creation method: Lines 114 to 119 in ea66c13
Either we should pass down the whole SpotifydConfig , which is IMO too much. Or we could just pass down a flag called is_session_bus that gets set within the config.rs file inside of the SpotifydConfig struct. I would opt and prefer method 2.
|
|
As far as I know, MPRIS seems to be a standard a lot of media players comply to. I do not know of any other specifications around media consumption. If you have an alternative, feel free to mention it. I know of mpd and there own protocol they use over stdout/stdin. But to be honest, I think MPRIS is a cleaner way to do this and I am not eager to introduce another custom protocol. |
This works well, however I see unusual CPU usage, it seems dbus spawns many Spotifyd processes, mostly running at 100% CPU usage. @azrdev, are you seeing this issue? |
Running as unprivileged user under WSL. The CPU usage is due to the host system. It spawned one single instance as well. Not sure, maybe something's wrong with your setup. Do you start it automatically on system start or inside of some I run it with default configuration, just changed the backend because I don't have ALSA installed.
Edit: If you run it as non-root, does it work? Can you stream music to it? Maybe it tries to fetch for resources (like accessing your device sound card) but fails due to missing rights. I'm just guessing right now though. |
I'm trying to setup a spotify player on a raspberry pi, but have been unsuccessful so far. I compiled this library from source, making sure to enable the I tried the following command, but as you can see from the reply it does not seem to work: > dbus-send --address="unix:path=/run/user/1000/bus" --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. Anyone that can help me out ? |
After recompiling updated dbus_mpris.rs: I needed to change /usr/share/dbus-1/system.conf: |
As a slight refinement of @juno72's D-Bus config change, I defined the policy for MPRIS for all members of the <?xml version="1.0"?><!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy group="audio">
<allow own_prefix="org.mpris.MediaPlayer2"/>
</policy>
</busconfig> Restricting it further based on user name would probably be better, but this is a shortcut. |
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. |
Using latest release 0.3.2 on a Raspbian GNU/Linux 10, the problem is still existing using default configuration without any easy way to fix that besides installing Xorg & al |
In order to allow sending mpris messages to spotifyd from any process in the audio group I extended this to: <?xml version="1.0"?><!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy group="audio">
<allow own_prefix="org.mpris.MediaPlayer2"/>
<allow send_interface="org.mpris.MediaPlayer2.Player"/>
</policy>
</busconfig> |
It would be really great to have a config switch for connecting to the system dbus or the session dbus in spotifyd. diff --git a/src/dbus_mpris.rs b/src/dbus_mpris.rs
index 34fb5f6..6d5eed1 100644
--- a/src/dbus_mpris.rs
+++ b/src/dbus_mpris.rs
@@ -113,7 +113,7 @@ fn create_spotify_api(token: &RspotifyToken) -> Spotify {
async fn create_dbus_server(api_token: RspotifyToken, spirc: Arc<Spirc>, device_name: String) {
// TODO: allow other DBus types through CLI and config entry.
let (resource, conn) =
- connection::new_session_sync().expect("Failed to initialize DBus connection");
+ connection::new_system_sync().expect("Failed to initialize DBus connection");
tokio::spawn(async {
let err = resource.await;
panic!("Lost connection to D-Bus: {}", err); |
@thirdeyetux I created a PR for this a while ago (#954), although there hasn't been much maintainer activity on it yet. |
Session DBUS is not avalible without X11. It would be neat to add option in config to make MPRIS avalible through system dbus. When I edited dbus_mpris.rs
let c = Rc::new(Connection::get_private(BusType::Session).unwrap());
and changed Session to System and recompiled it everything worked great. I would make pull request but i cannot into rust so it will be mess anyway. Please can somone make it? It's big deal for headless raspberry users.
The text was updated successfully, but these errors were encountered: