Clean filename if falling back to file name

This commit is contained in:
Midgard 2022-09-03 23:09:35 +02:00
parent d4ba2a548d
commit 9b7b119001
Signed by: midgard
GPG key ID: 511C112F1331BBB4

6
mmmpd
View file

@ -53,7 +53,11 @@ def clear_status():
def song_string(song_info): def song_string(song_info):
if song_info.get("title") is None: if song_info.get("title") is None:
artist = song_info.get("artist") or "" artist = song_info.get("artist") or ""
title = song_info.get("file") or "Unknown song" title = re.sub(
r"\.[a-z0-9]+$",
"",
os.path.basename(song_info.get("file"))
) or "Unknown song"
else: else:
artist = song_info.get("artist") or "Unknown artist" artist = song_info.get("artist") or "Unknown artist"
title = song_info.get("title") or "Unknown song" title = song_info.get("title") or "Unknown song"