From 6c2cd1c2749997a34fd45945fe18d9d7222b4926 Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Sun, 5 Apr 2026 08:01:28 -0700 Subject: [PATCH] fix(mpris): serve minimal metadata when playing radio 1. MPRIS (or `mpris-service`) is very fragile. If an invalid `mpris:trackid` (something with `-` or spaces) is passed in, it breaks. Use a minimal track id instead 2. Only populate album/artist/title --- src/main/features/linux/mpris.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/features/linux/mpris.ts b/src/main/features/linux/mpris.ts index e58f597bd..f79417c6c 100644 --- a/src/main/features/linux/mpris.ts +++ b/src/main/features/linux/mpris.ts @@ -150,6 +150,23 @@ ipcMain.on( return; } + // If the served id is an empty string, this is a radio + // Use a limited subset of the fields + if (song._serverId === '') { + // The id as passed in from use-mpris is radio- plus the radio ID + // If there are spaces or some other characters, this causes MPRIS to error and + // disconnect the bus. To prevent this, just use a fake track/radio + mprisPlayer.metadata = { + 'mpris:trackid': mprisPlayer.objectPath(`track/radio`), + 'xesam:album': song.album || null, + 'xesam:artist': song.artists?.length + ? song.artists.map((artist) => artist.name) + : null, + 'xesam:title': song.name || null, + }; + return; + } + mprisPlayer.metadata = { 'mpris:artUrl': imageUrl || null, 'mpris:length': song.duration ? Math.round((song.duration || 0) * 1e3) : null,