Skip to content

Commit 10aeeb7

Browse files
committed
handle absence of year in the metadata
1 parent 08b4014 commit 10aeeb7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mpris-widget/init.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,14 @@ local function worker(user_args)
246246
local update_metadata = function(meta)
247247
artist_widget:set_text(meta.artist)
248248
title_widget:set_text(meta.current_song)
249-
metadata_widget:set_text(string.format('%s (%s)\n%s (%s/%s)', meta.album, meta.year, meta.current_song, duration(meta.position), duration(meta.length)))
249+
250+
local s = meta.album;
251+
if meta.year ~= nil and #meta.year == 4 then
252+
s = s .. " (" .. meta.year .. ")"
253+
end
254+
s = s .. "\n" .. meta.current_song .. " (" .. duration(meta.position) .. "/" .. duration(meta.length) .. ")"
255+
metadata_widget:set_text(s)
256+
250257
progress_widget.value = meta.progress
251258

252259
-- poor man's urldecode

0 commit comments

Comments
 (0)