JakeStanger / mpd-discord-rpc

Rust application which displays your currently playing song / album / artist from MPD in Discord using Rich Presence.
https://crates.io/crates/mpd-discord-rpc
MIT License
88 stars 16 forks source link

mpd-discord-rpc.service doesn't reconnect if discord is restarted. #138

Open codeiimon opened 1 month ago

codeiimon commented 1 month ago

When the mpd-discord-rpc is enabled, the doesn't automatically connect to discord if it is run after or if the client is restarted. Rather systemctl --user status restart mpd-discord-rpc.service outputs this error:

Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715461Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715486Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715507Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715527Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715548Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715570Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715592Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715614Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715635Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jun 14 12:54:50 nixos mpd-discord-rpc[243427]: 2024-06-14T18:54:50.715656Z ERROR discord_presence::connection::manager: Failed to connect: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })

The current way i fix this is by restarting the service with discord using the command vesktop %U && systemctl --user restart mpd-discord-rpc.service. Its a bit hacky tho, and I would rather not have to do this.

It also runs this indefinitely, creating a massive journalctl log file full of errors. I'm not sure if that was the intention, but it'd be nice if there was a cleaner implementation.

I'm Currently on NixOS 24.05.