Code Monkey home page Code Monkey logo

mpd-discord-rpc's Introduction

MPD Discord RPC

crates.io aur

Displays your currently playing song / album / artist from MPD in Discord using Rich Presence, along with the album art.

It includes support for multiple MPD hosts if, like me, you have more than one server you alternate between.

The program does not require MPD or Discord to be running in order to run.

Once installed just run mpd-discord-rpc.

status image

Installation

Cargo

The cargo package can be found here.

cargo install mpd-discord-rpc

Arch Linux

Two AUR packages are available:

The systemd unit is included and can be started with:

systemctl --user enable --now mpd-discord-rpc 

NixOS

You can use the mpd-discord-rpc package in nixpkgs. Users of home-manager can also use the services.mpd-discord-rpc.enable option.

Many thanks to Ilan Joselevich for maintaining both of those.

Configuration

Running the program once will generate a default configuration file. On Linux this will be at ~/.config/discord-rpc/config.toml

  • id - The Discord application ID to run through.
  • hosts - An array of MPD server host socket addresses. Each one will be tried in order until a playing server is found.
  • format - Format strings. Tokens are listed below.
    • details - A format string for the top line. This is the song title by default.
    • state - A format string for the second line. This is the artist / album by default.
    • timestamp - The timestamp mode for the third line. This is 'elapsed' by default. Can be one of elapsed, left or off. Falls back to elapsed.
    • large_image - The name of the rich presence asset that gets displayed as the large image. This is "notes" by default. Setting this to "" disables the large image.
    • small_image - The name of the rich presence asset that gets displayed as the small image. This is "notes" by default. Setting this to "" disables the small image.
    • large_text - A format string that is displayed upon hovering the large image. Setting this to "" disables the hover.
    • small_text - A format string that is displayed upon hovering the small image. Setting this to "" disables the hover.

Formatting Tokens

Any part of the format string that does not match one of these tokens will be displayed as is. The following will automatically be replaced with their value from MPD:

  • $title
  • $album
  • $artist
  • $albumartist
  • $date
  • $track
  • $disc
  • $genre
  • $duration
  • $elapsed

Default Configuration

This configuration file is automatically generated if one does not exist. It is included here for reference.

id = 677226551607033903
hosts = ["localhost:6600"]

[format]
details = "$title"
state = "$artist / $album"
timestamp = "elapsed"
large_image = "notes"
small_image = "notes"
large_text = ""
small_text = ""

Album art

Album art is pulled from the MusicBrainz database and Album Art Archive automatically. You'll only get a cover if it can be found though; there's a couple of things you can do to help this:

  • Make sure your music is sensibly tagged. In most cases MusicBrainz will be searched for releases matching the album/artist name.
  • Add MusicBrainz release tags to your tracks. This is officially supported by MPD and can be done automatically using MusicBrainz Picard.
  • Add missing album art to MusicBrainz. Many albums are missing covers, and you can upload your own to the database to contribute these for everyone.

mpd-discord-rpc's People

Contributors

dependabot[bot] avatar derinsh avatar jakestanger avatar jonathannerat avatar kranzes avatar lennyphoenix avatar monterrabyte avatar oliverkovacs avatar phate6660 avatar serial-ata avatar simvux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mpd-discord-rpc's Issues

Can't connect to socket file

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

Updates to discord stop if you skip songs too quickly

Hi,

I'm not sure how else to describe it but from my current usage, I have a hotkey setup to skip a song if I don't want to listen to it and go to the next in the playlist, and the currently playing song automatically appears in the top status bar of my screen. If I use that hotkey without giving the song a chance to play for maybe 5-10 seconds or so, I'm basically rolling a dice on whether discord will stop getting updates or not, and when I lose the dice roll, the music stays stuck on whatever song it was on when it broke, which creates a weird case where sometimes I learn way later that according to discord I've been listening to this one song for like 3 days or something. Hopefully it can be reproduced and fixed, it's not really a major bug but it is annoying to have to run systemctl --user restart mpd-discord-rpc every time it does this or to be forced to let a song that I don't want to hear play at that point in time.

Pkg info below, not sure about how to give system info or if that'd even help.

$ pacman -Qi mpd-discord-rpc-git
Name            : mpd-discord-rpc-git
Version         : v1.7.1.r91.g07a6a22-1
Description     : Displays your currently playing song / album / artist from MPD in Discord using Rich Presence.
Architecture    : x86_64
URL             : None
Licenses        : MIT
Groups          : None
Provides        : None
Depends On      : None
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 6.40 MiB
Packager        : Kusoneko <[email protected]>
Build Date      : Sun 04 Feb 2024 04:45:35 AM EST
Install Date    : Sun 04 Feb 2024 04:46:18 AM EST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None

Use the merge crate

Use the merge crate instead of Config.merge() and Format.merge().
This would simplify the code and make adding new options easier by introducing a new dependency.
I could implement this if i get the green light.

Question how to set the image

so reading through the readme file i cant find anything related to changing the image that shown in the discord other than removing it. so how does it work? is it harcoded to only show it or hide it or you can set it to whatever you want? what i wanted is to use from the music file it self(file thumbnail or something not sure what it called) but not sure how.

it will be nice if theres some other description relate to it in the documentation.

[feature request] option to clear the status if paused

i believe adding an configuration option to completely clear the "playing" status if mpd is paused should be added especially since i always have it running in the background, but if i'm not actually listening to anything, it still shows up as my playing status listening to the song it's paused on.

[unless this is already the default behavior and there's something going on in my end of this.]

Can crash if MPD connection lost mid-fetch

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/jake/.cargo/registry/src/github.com-1ecc6299db9ec823/mpd-discord-rpc-1.2.0/src/mpd_conn.rs:41:76
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Which is inside the get_token_value function.

Specify target-dir in AUR PKGBUILD

When using a global target-dir, the package step of the PKGBUILD fails:

==> Starting package()...
install: cannot stat '/home/serial/.cache/paru/clone/mpd-discord-rpc/src/mpd-discord-rpc/target/release/mpd-discord-rpc': No such file or directory
==> ERROR: A failure occurred in package().
    Aborting...
error: failed to build 'mpd-discord-rpc-v1.6.0.r0.ee29533-1 (mpd-discord-rpc-git)':
error: packages failed to build: mpd-discord-rpc-v1.6.0.r0.ee29533-1 (mpd-discord-rpc-git)

The fix is to just specify the target-dir:

 build() {
     cd "$srcdir/mpd-discord-rpc"
-    cargo build --release --locked
+    cargo build --release --locked --target-dir target
 }

RPC library error: channel to be open full(..)

This package was working fine - it's pretty cool, thanks! - until very recently, where it just... stopped. Not sure if it's a discord update, or something else.

systemctl --user status mpd-discord-rpc output:

Feb 02 17:44:48 hearth mpd-discord-rpc[1552]: 2024-02-02T17:44:48.035347Z ERROR mpd_discord_rpc: {"error_message":"Io Error","error_type":"RPCLibraryError>
Feb 02 17:44:53 hearth mpd-discord-rpc[1552]: 2024-02-02T17:44:53.036788Z  INFO mpd_discord_rpc: Detected change, updating status
Feb 02 17:44:53 hearth mpd-discord-rpc[1552]: thread '<unnamed>' panicked at src/main.rs:109:18:
Feb 02 17:44:53 hearth mpd-discord-rpc[1552]: channel to be open: "Full(..)"

On Arch linux 6.7.3-arch1-1, using Discord Stable 263172 (f95e991), not sure if any additional RPC package is relevant given none are listed as dependencies, but libtirpc is 1.3.4-1, just in case.

Not sure how to troubleshoot, to be honest. Running mpd-discord-rpc with the systemctl process stopped says that it connects to discord fine:

024-02-02T17:55:56.960104Z  INFO connect: mpd_protocol::connection: connected successfully version="0.23.5"
2024-02-02T17:55:56.960129Z  INFO mpd_utils::persistent_client: Connected to 'localhost:6600'
2024-02-02T17:55:57.464823Z  INFO mpd_discord_rpc: Connected to Discord

And my firewall should be set up so as to allow discord to connect.

Restarting the systemctl process after killing both that from before and then killing the one ran in the terminal yields this systemctl output:

Feb 02 18:00:17 hearth systemd[1465]: Started Discord Rich Presence for MPD.
Feb 02 18:00:17 hearth mpd-discord-rpc[247950]: 2024-02-02T18:00:17.014233Z  INFO connect: mpd_protocol::connection: connected successfully version="0.23.>
Feb 02 18:00:17 hearth mpd-discord-rpc[247950]: 2024-02-02T18:00:17.014257Z  INFO mpd_utils::persistent_client: Connected to 'localhost:6600'
Feb 02 18:00:17 hearth mpd-discord-rpc[247950]: 2024-02-02T18:00:17.519429Z  INFO mpd_discord_rpc: Connected to Discord

But still no cigar in the discord client.

Here is my config.toml:

id = 677226551605023604
hosts = ["localhost:6600"]

[format]
details = "$title"
state = "$artist / $album"
timestamp = "elapsed"
large_image = "notes"
small_image = ""
large_text = ""
small_text = ""

Any advice on troubleshooting is gratefully received, and thank you for making a neat app!

build failed

    Updating crates.io index
  Downloaded mpd-discord-rpc v1.5.4
  Downloaded 1 crate (20.3 KB) in 1.28s
  Installing mpd-discord-rpc v1.5.4
  Downloaded futures-task v0.3.27
  Downloaded futures-sink v0.3.27
  Downloaded autocfg v1.1.0
  Downloaded tokio-macros v1.8.2
  Downloaded tinyvec_macros v0.1.1
  Downloaded foreign-types v0.3.2
  Downloaded dirs-sys v0.3.7
  Downloaded version_check v0.9.4
  Downloaded tokio-native-tls v0.3.1
  Downloaded rand_xorshift v0.1.1
  Downloaded serde_urlencoded v0.7.1
  Downloaded foreign-types-shared v0.1.1
  Downloaded tower-service v0.3.2
  Downloaded try-lock v0.2.4
  Downloaded futures-io v0.3.27
  Downloaded autocfg v0.1.8
  Downloaded hyper-tls v0.5.0
  Downloaded openssl-macros v0.1.0
  Downloaded futures-core v0.3.27
  Downloaded http-body v0.4.5
  Downloaded itoa v1.0.6
  Downloaded mime v0.3.16
  Downloaded form_urlencoded v1.1.0
  Downloaded want v0.3.0
  Downloaded iovec v0.1.4
  Downloaded pin-utils v0.1.0
  Downloaded openssl-probe v0.1.5
  Downloaded ahash v0.7.6
  Downloaded percent-encoding v2.2.0
  Downloaded httpdate v1.0.2
  Downloaded tracing-attributes v0.1.23
  Downloaded parking_lot_core v0.4.0
  Downloaded pin-project-lite v0.2.9
  Downloaded ipnet v2.7.1
  Downloaded num_cpus v1.15.0
  Downloaded slab v0.4.8
  Downloaded quote v1.0.26
  Downloaded pkg-config v0.3.26
  Downloaded httparse v1.8.0
  Downloaded tracing-core v0.1.30
  Downloaded getrandom v0.2.8
  Downloaded dirs v4.0.0
  Downloaded once_cell v1.17.1
  Downloaded log v0.4.17
  Downloaded native-tls v0.2.11
  Downloaded ryu v1.0.13
  Downloaded parking_lot v0.7.1
  Downloaded socket2 v0.4.9
  Downloaded bytes v0.4.12
  Downloaded proc-macro2 v1.0.52
  Downloaded uuid v0.6.5
  Downloaded unicode-bidi v0.3.11
  Downloaded cc v1.0.79
  Downloaded toml v0.5.11
  Downloaded url v2.3.1
  Downloaded tinyvec v1.6.0
  Downloaded futures-channel v0.3.27
  Downloaded num-traits v0.2.15
  Downloaded bytes v1.4.0
  Downloaded indexmap v1.9.2
  Downloaded base64 v0.21.0
  Downloaded openssl-sys v0.9.81
  Downloaded serde_derive v1.0.156
  Downloaded memchr v2.5.0
  Downloaded unicode-ident v1.0.8
  Downloaded serde v1.0.156
  Downloaded tracing v0.1.37
  Downloaded rand v0.4.6
  Downloaded tokio-util v0.7.7
  Downloaded minimal-lexical v0.2.1
  Downloaded http v0.2.9
  Downloaded hashbrown v0.12.3
  Downloaded aho-corasick v0.7.20
  Downloaded regex-syntax v0.6.28
  Downloaded mio v0.8.6
  Downloaded unicode-normalization v0.1.22
  Downloaded reqwest v0.11.14
  Downloaded nom v7.1.3
  Downloaded serde_json v1.0.94
  Downloaded futures-util v0.3.27
  Downloaded hyper v0.14.25
  Downloaded h2 v0.3.16
  Downloaded syn v1.0.109
  Downloaded openssl v0.10.46
  Downloaded regex v1.7.1
  Downloaded idna v0.3.0
  Downloaded rand_hc v0.1.0
  Downloaded merge_derive v0.1.0
  Downloaded rand_chacha v0.1.1
  Downloaded rand_jitter v0.1.4
  Downloaded tokio v1.26.0
  Downloaded rand_pcg v0.1.2
  Downloaded discord-rpc-client v0.3.0
  Downloaded rand_isaac v0.1.1
  Downloaded merge v0.1.0
  Downloaded libc v0.2.140
  Downloaded rand v0.6.5
  Downloaded rand_os v0.1.3
  Downloaded mpd_protocol v1.0.0
  Downloaded mpd_client v1.1.0
  Downloaded encoding_rs v0.8.32
  Downloaded crossbeam-channel v0.3.9
  Downloaded 102 crates (8.0 MB) in 1.84s (largest was `encoding_rs` at 1.4 MB)
   Compiling autocfg v1.1.0
   Compiling libc v0.2.140
   Compiling proc-macro2 v1.0.52
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.26
   Compiling syn v1.0.109
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling version_check v0.9.4
   Compiling once_cell v1.17.1
   Compiling rand_core v0.4.2
   Compiling pin-project-lite v0.2.9
   Compiling bytes v1.4.0
   Compiling cc v1.0.79
   Compiling pkg-config v0.3.26
   Compiling itoa v1.0.6
   Compiling futures-core v0.3.27
   Compiling serde_derive v1.0.156
   Compiling semver-parser v0.7.0
   Compiling serde v1.0.156
   Compiling futures-task v0.3.27
   Compiling foreign-types-shared v0.1.1
   Compiling fnv v1.0.7
   Compiling openssl v0.10.46
   Compiling futures-util v0.3.27
   Compiling maybe-uninit v2.0.0
   Compiling bitflags v1.3.2
   Compiling pin-utils v0.1.0
   Compiling native-tls v0.2.11
   Compiling hashbrown v0.12.3
   Compiling tinyvec_macros v0.1.1
   Compiling httparse v1.8.0
   Compiling futures-channel v0.3.27
   Compiling futures-sink v0.3.27
   Compiling futures-io v0.3.27
   Compiling try-lock v0.2.4
   Compiling stable_deref_trait v1.2.0
   Compiling ryu v1.0.13
   Compiling percent-encoding v2.2.0
   Compiling cfg-if v0.1.10
   Compiling serde_json v1.0.94
   Compiling openssl-probe v0.1.5
   Compiling tower-service v0.3.2
   Compiling unicode-bidi v0.3.11
   Compiling lazy_static v1.4.0
   Compiling httpdate v1.0.2
   Compiling scopeguard v0.3.3
   Compiling minimal-lexical v0.2.1
   Compiling byteorder v1.4.3
   Compiling regex-syntax v0.6.28
   Compiling mime v0.3.16
   Compiling ipnet v2.7.1
   Compiling base64 v0.21.0
   Compiling encoding_rs v0.8.32
   Compiling autocfg v0.1.8
   Compiling tokio v1.26.0
   Compiling slab v0.4.8
   Compiling indexmap v1.9.2
   Compiling num-traits v0.2.15
   Compiling rand_core v0.3.1
   Compiling rand_jitter v0.1.4
   Compiling tracing-core v0.1.30
   Compiling proc-macro-error-attr v1.0.4
   Compiling ahash v0.7.6
   Compiling proc-macro-error v1.0.4
   Compiling foreign-types v0.3.2
   Compiling semver v0.9.0
   Compiling http v0.2.9
   Compiling tinyvec v1.6.0
   Compiling owning_ref v0.4.1
   Compiling form_urlencoded v1.1.0
   Compiling crossbeam-utils v0.6.6
   Compiling openssl-sys v0.9.81
   Compiling rand_chacha v0.1.1
   Compiling rand_pcg v0.1.2
   Compiling rand v0.6.5
   Compiling rand_hc v0.1.0
   Compiling rand_xorshift v0.1.1
   Compiling rand_isaac v0.1.1
   Compiling rustc_version v0.2.3
   Compiling lock_api v0.1.5
   Compiling http-body v0.4.5
   Compiling crossbeam-channel v0.3.9
   Compiling unicode-normalization v0.1.22
   Compiling want v0.3.0
   Compiling nom v7.1.3
   Compiling aho-corasick v0.7.20
   Compiling mio v0.8.6
   Compiling socket2 v0.4.9
   Compiling num_cpus v1.15.0
   Compiling rand_os v0.1.3
   Compiling getrandom v0.2.8
   Compiling rand v0.4.6
   Compiling iovec v0.1.4
   Compiling dirs-sys v0.3.7
   Compiling smallvec v0.6.14
   Compiling parking_lot_core v0.4.0
   Compiling idna v0.3.0
   Compiling regex v1.7.1
   Compiling bytes v0.4.12
   Compiling dirs v4.0.0
   Compiling uuid v0.6.5
   Compiling url v2.3.1
   Compiling parking_lot v0.7.1
   Compiling tokio-macros v1.8.2
   Compiling tracing-attributes v0.1.23
   Compiling openssl-macros v0.1.0
   Compiling merge_derive v0.1.0
   Compiling merge v0.1.0
   Compiling tracing v0.1.37
   Compiling tokio-util v0.7.7
   Compiling mpd_protocol v1.0.0
   Compiling h2 v0.3.16
   Compiling mpd_client v1.1.0
error[E0658]: default values for const generic parameters are experimental
   --> /home/m/.cargo/registry/src/github.com-1ecc6299db9ec823/mpd_client-1.1.0/src/commands/definitions.rs:704:32
    |
704 | pub struct List<const N: usize = 0> {
    |                                ^^^
    |
    = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `mpd_client` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `mpd-discord-rpc v1.5.4`, intermediate artifacts can be found at `/tmp/cargo-installwUfRfQ`

Caused by:
  build failed

I'm getting this when building, both when trying to install from the AUR and by cloning the repo and running cargo install manually. I have no rust knowledge and that issue mentioned at the end of the error log is pretty much greek to me.

Apparently it's something with mpd_client so I opened an issue there too

rich presence shows "unknown"

image
Is this normal? There is no other stdout info

❯ ./mpd-discord-rpc
Entering idle mode
Exiting idle mode

Also the AUR package doesn't seem to build properly.

Starting build()...
    Updating git repository `https://github.com/JakeStanger/discord-rpc-client.rs`
    Updating crates.io index
error: the lock file /home/user/.cache/paru/clone/mpd-discord-rpc/src/mpd-discord-rpc/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

elapsed time does not update

so apparently the elapsed time on discord updates every 2 seconds for the person thats running mpd-discord-rpc, but it does not update for the other person that is just viewing the other person's discord status/profile.
it only updates once every minute or so, it inst consistent at all.
i would like if you could make so it updates the elapsed time every 1 second for both of the users, the one that is running mpd-discord-rpc and the one that is viewing the other person's profile.

Nothing happens in Discord when running the program

I'm probably the one at fault here, but I cannot get this or any other RPC integration to work. I have tried it with both discord and discord-canary from the AUR. I am using the default configuration.

Output:

Entering idle mode
Exiting idle mode
Entering idle mode
Exiting idle mode

The mode switches when I play/pause mpd, as expected.

Am I missing some setup in Discord? I couldn't find any installation instructions in the readme other than to run the program.

InvalidMessage when playing a song

Hi, I installed this with cargo, and when I run it it seems to work fine until I play a song, I get a InvalidMessage error:

image

I'm on macOS Monterey if it's any help. Let me know if you need any extra info.

Crashes if connection to Discord is lost

If Discord restarts or the connection to its RPC server drops for whatever reason, the program crashes.

thread '<unnamed>' panicked at 'Failed to send outgoing data: IoError(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })', /home/jake/.cargo/registry/src/github.com-1ecc6299db9ec823/discord-rpc-client-0.3.0/src/connection/manager.rs:131:30

Feature Request: Internet Radio Support

Would be cool if this program would support Internet Radio (.m3u, .pls and etc)

For now, if mpd plays internet radio mpd-discord-rpc crashes with this error:

daxot@Void ~ $ RUST_BACKTRACE=full mpd-discord-rpc
2023-10-10T17:08:03.108377Z  INFO connect: mpd_protocol::connection: connected successfully version="0.23.5"
2023-10-10T17:08:03.108422Z  INFO mpd_utils::persistent_client: Connected to 'localhost:6600'
[/home/daxot/.cargo/registry/src/index.crates.io-6f17d22bba15001f/discord-presence-0.5.18/src/client.rs:218] tx.send(info).err() = None
2023-10-10T17:08:07.441184Z  INFO mpd_discord_rpc: Detected change, updating status
thread 'main' panicked at 'Failed to get duration from MPD status', /home/daxot/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mpd-discord-rpc-1.7.1/src/mpd_conn.rs:69:10
stack backtrace:
   0:     0x557367b33091 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h415229f7b2fca78e
   1:     0x557367b5d5be - core::fmt::write::h28fb50bb262ea1b4
   2:     0x557367b2f987 - std::io::Write::write_fmt::hffbb0afe6e8b0d78
   3:     0x557367b32ea5 - std::sys_common::backtrace::print::hce0a8e46d986e642
   4:     0x557367b34494 - std::panicking::default_hook::{{closure}}::h155069ddad794f9c
   5:     0x557367b341ba - std::panicking::default_hook::h8bc760cc0648492d
   6:     0x557367b34a45 - std::panicking::rust_panic_with_hook::ha439e181de84b322
   7:     0x557367b34947 - std::panicking::begin_panic_handler::{{closure}}::h9e7cd98d71ee1ac4
   8:     0x557367b334f6 - std::sys_common::backtrace::__rust_end_short_backtrace::hdfd0b3c653f57627
   9:     0x557367b34652 - rust_begin_unwind
  10:     0x5573677990b3 - core::panicking::panic_fmt::he92bf07b4379581c
  11:     0x557367799073 - core::option::expect_failed::h34760d18e98a53f9
  12:     0x5573677b595c - mpd_discord_rpc::mpd_conn::get_token_value::h546020dadf655f44
  13:     0x5573677ff25a - mpd_discord_rpc::replace_tokens::h517bacb1db6ebc77
  14:     0x5573677d9a3d - mpd_discord_rpc::Service::update_state::{{closure}}::hb46d9655f8af884e
  15:     0x5573677d5d6a - tokio::runtime::park::CachedParkThread::block_on::he4a4a4c670ed30ba
  16:     0x55736780cc37 - tokio::runtime::context::runtime::enter_runtime::h53bbf7b97693cc33
  17:     0x55736779febc - tokio::runtime::runtime::Runtime::block_on::h327b810cc6f2cb3b
  18:     0x5573677ffc4f - mpd_discord_rpc::main::h80e7e7df65458be2
  19:     0x5573677ffd63 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9ce7dc0776f0240c
  20:     0x5573677ffd79 - std::rt::lang_start::{{closure}}::h104c92cbfc117907
  21:     0x557367b2b268 - std::rt::lang_start_internal::h71fb5f7e4d3d800b
  22:     0x5573677ffd25 - main
  23:     0x7f22e276118c - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  24:     0x7f22e2761245 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:381:3
  25:     0x557367799851 - _start
                               at ./csu/../sysdeps/x86_64/start.S:115
  26:                0x0 - <unknown>

Internet Radio usually doesn't have any info about $duration of the song. I think album cover will not work too, because MPD doesn't provide any information about $album or $artist (at least i don't see them in ncmpcpp) and $title in MPD consist of two parts: $artist-$title provided by Internet Radio

Default fallback if missing from config

It would be nice if the program would fallback to the default options if they aren't defined in the config.toml.

For example, a config.toml with this content:

[format]
large_image = ""

Should still work, and not crash the program. The program will then use the default options but replace the large_image option with the one defined in the config file.

Better error handling

Following on from the more flexible config changes in #19, I'd like to see some nicer error handling. Most unwraps should be replaced with either an expect to print a slightly more sensible message, or friendly console output and a clean exit so it's clear what's wrong with the config.

[feature] config option for string formatting

Add a configuration option to change the string display format for both the details (song title) and state (artist / album) to allow for custom formatting.

For example the current default config options might look like:

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

@Phate6660 I spotted your fork, thank you for the inspiration for this and the kind words. I'm glad you like it :)

Using release-group id instead of release id to fetch album arts

I was investigating why this would not show album art for some of my albums.

This API call finds the release with the ID b56f3ba4-77c8-36c4-95f6-4b7da3d21e9a
https://musicbrainz.org/ws/2/release/?query=artist:Muse%20AND%20release:Origin%20of%20Symmetry&limit=1&fmt=json
We can confirm from the following url that no cover art exists for this.
https://coverartarchive.org/release/b56f3ba4-77c8-36c4-95f6-4b7da3d21e9a/front-250

There are 26 releases within the release-group of this album. Only 5 of them lack an attached album cover art. It seems to be hit or miss.
However, release groups themselves get album arts, and we can fetch them using this url, almost the same as it is done currently.
https://coverartarchive.org/release-group/{}/front-250

We can follow the same API result to get the release-group id. It's ef03fe86-b54c-3667-8768-029833e7e1cd. We can see that the following indeed does return a valid cover art.
https://coverartarchive.org/release-group/ef03fe86-b54c-3667-8768-029833e7e1cd/front-250

I found forgoing releases and going for the release-groups a more reliable way to get the album arts (at least for the artists I listen to), however I did not test this thoroughly. Alternatively, it could become a fallback if there is no cover for the release. This would require an extra request with the client.

Album art not always showing up depending on the song

So first of all, I love the new update. I was planning on trying to learn Rust and add the feature myself, but looks like someone read my mind. It's great, but I've noticed that some songs won't have their album art displayed.

Here are images showing just one example of it:
Screenshot_2022-06-16-08-15-59_1920x1080

You can see that the album art is not displayed next to the RPC itself.

Screenshot_2022-06-16-20-06-20_1920x1080
Yet dunst is able to pickup the album art just fine here.

This isn't the only song where this happens. This might be because of the method that's being used to get the album art. The album art that is being pickup is included in the song file itself, but if mpd-discord-rpc is using some third-party to fetch album art, then that might be why it's not picking up the album art. I'm not sure if it is possible, but the program could try fetching the album art from the file itself assuming it's not already trying to do that. I'm not educated on the matter, but I'm sure you will be able to enlighten the idea further.

Edit: It seems to be a 50:50 for me as far as which songs have their album art shown.

feature request: album cover

It would be great if there was an option to have it fetch the appropriate album cover image from the internet and show it in the image box. Many Discord RPCs for music already do that.

Not connecting to Discord anymore.

Oddly enough, there are no errors or anything. It runs just like it usually does.

However, there is simply just no rich presence being displayed.

I'm not sure what the issue could be, as my own plus other rich presence programs work fine.

Though it did stop working after Discord updated, so that could be part of the issue.

Customization

Is there any built in way to modify the value of the game being played from 'music', in addition, is there any way to change the image?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.