From bb895e9c9a5de0ee8a8628ed65b1dedd9553b750 Mon Sep 17 00:00:00 2001 From: Midgard Date: Wed, 31 Aug 2022 14:44:09 +0200 Subject: [PATCH] Use filename/URL if there's no title --- mmmpd | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mmmpd b/mmmpd index 72294fd..9a08f22 100755 --- a/mmmpd +++ b/mmmpd @@ -50,9 +50,13 @@ def clear_status(): # --------- def song_string(song_info): - artist = song_info.get("artist") or "Unknown artist" - title = song_info.get("title") or "Unknown song" - return f"{artist} – {title}" + if song_info.get("title") is None: + artist = song_info.get("artist") or "" + title = song_info.get("file") or "Unknown song" + else: + artist = song_info.get("artist") or "Unknown artist" + title = song_info.get("title") or "Unknown song" + return f"{artist}{' – ' if artist else ''}{title}" def formatted_status(mpd_client):