[GH-ISSUE #80] Feature Request: Internet Radio Support #293

Closed
opened 2026-05-22 22:58:24 +01:00 by JakeStanger · 1 comment
Owner

Originally created by @Daxot on GitHub (Oct 10, 2023).
Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/80

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

Originally created by @Daxot on GitHub (Oct 10, 2023). Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/80 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
Author
Owner

@JakeStanger commented on GitHub (Oct 10, 2023):

Hey, I've just written a fix for the crash, which I'll merge in a few mins. Album art will already gracefully fall back if nothing can be found so that shouldn't be a problem.

I won't be able to do anything smart to try and interpret the album/artist if that's not set in the correct fields. I think that's down to the radio provider the format they pick, and it would likely cause all sorts of collisions (if any artist or song title has a - in it for example, that would make parsing the above case nigh impossible).

Getting a new release out is still pending an upstream release of the `discord-presence`` crate, so for now you'll need to build from source or use the AUR package.

<!-- gh-comment-id:1756280043 --> @JakeStanger commented on GitHub (Oct 10, 2023): Hey, I've just written a fix for the crash, which I'll merge in a few mins. Album art will already gracefully fall back if nothing can be found so that shouldn't be a problem. I won't be able to do anything smart to try and interpret the album/artist if that's not set in the correct fields. I think that's down to the radio provider the format they pick, and it would likely cause all sorts of collisions (if any artist or song title has a `-` in it for example, that would make parsing the above case nigh impossible). Getting a new release out is still pending an upstream release of the `discord-presence`` crate, so for now you'll need to build from source or use the AUR package.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/mpd-discord-rpc#293
No description provided.