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
92 stars 18 forks source link

Can't connect to socket file #8

Closed MonterraByte closed 2 years ago

MonterraByte commented 4 years ago

I run mpd using a socket file (bind_to_address "~/.mpd/socket" in the mpd config file). This works fine for most applications, like Cantata, ncmpc, mpdris2, etc.

However, mpd-discord-rpc fails to connect. Here's my config file:

id = 677226551607033903
hosts = ["/home/username/.mpd/socket"]

[format]
details = "$title"
state = "$artist - $album"

I modified the try_get_mpd_conn function to print the error from MPDClient::connect instead of discarding it, and got this:

failed to lookup address information: Name or service not known
JakeStanger commented 4 years ago

I think this might be a limitation of the upstream library. Perhaps I'm wrong, but the docs seem to indicate it only works over TCP. You might want to raise an issue there and see if they're willing to fix it. If not, I'll perhaps look into a different MPD library or something.

As an aside, would you mind creating a PR for your modification to try_get_mpd_conn? Swallowing errors sounds like a pain and I'd much rather it displayed them as you've got it doing.