mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-15 19:48:04 +01:00
mpris-widget: correct artUrl
Perhaps due to the regex change, or maybe it never did work, art was always nil. Use gears.string.split(), which works, is much easier to read than the regex and removes the need to munge the artUrl after too.
This commit is contained in:
parent
567b5bb84f
commit
ca08528926
1 changed files with 3 additions and 7 deletions
|
@ -135,24 +135,20 @@ end
|
||||||
local function worker()
|
local function worker()
|
||||||
|
|
||||||
-- retrieve song info
|
-- retrieve song info
|
||||||
local current_song, artist, player_status, art, artUrl
|
local current_song, artist, player_status, artUrl
|
||||||
|
|
||||||
local update_graphic = function(widget, stdout, _, _, _)
|
local update_graphic = function(widget, stdout, _, _, _)
|
||||||
local words = {}
|
local words = gears.string.split(stdout, ';')
|
||||||
for w in stdout:gmatch("([^;]*);") do table.insert(words, w) end
|
|
||||||
|
|
||||||
player_status = words[1]
|
player_status = words[1]
|
||||||
artist = words[2]
|
artist = words[2]
|
||||||
current_song = words[3]
|
current_song = words[3]
|
||||||
art = words[4]
|
artUrl = words[4]
|
||||||
if current_song ~= nil then
|
if current_song ~= nil then
|
||||||
if string.len(current_song) > 18 then
|
if string.len(current_song) > 18 then
|
||||||
current_song = string.sub(current_song, 0, 9) .. ".."
|
current_song = string.sub(current_song, 0, 9) .. ".."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if art ~= nil then artUrl = string.sub(art, 8, -1) end
|
|
||||||
|
|
||||||
if player_status == "Playing" then
|
if player_status == "Playing" then
|
||||||
icon.image = PLAY_ICON_NAME
|
icon.image = PLAY_ICON_NAME
|
||||||
widget.colors = {beautiful.widget_main_color}
|
widget.colors = {beautiful.widget_main_color}
|
||||||
|
|
Loading…
Reference in a new issue