mpris-widget: rename mpdstatus to player_status

This commit is contained in:
Romanos Skiadas 2021-10-15 17:50:59 +03:00
parent 435d5d14f8
commit 588227cc1a
1 changed files with 6 additions and 7 deletions

View File

@ -128,7 +128,7 @@ end
local function worker() local function worker()
-- retrieve song info -- retrieve song info
local current_song, artist, mpdstatus, art, artUrl local current_song, artist, player_status, art, artUrl
local icon = wibox.widget { local icon = wibox.widget {
id = "icon", id = "icon",
@ -159,11 +159,10 @@ local function worker()
} }
local update_graphic = function(widget, stdout, _, _, _) local update_graphic = function(widget, stdout, _, _, _)
-- mpdstatus, artist, current_song = stdout:match("(%w+)%;+(.-)%;(.*)")
local words = {} local words = {}
for w in stdout:gmatch("([^;]*);") do table.insert(words, w) end for w in stdout:gmatch("([^;]*);") do table.insert(words, w) end
mpdstatus = words[1] player_status = words[1]
artist = words[2] artist = words[2]
current_song = words[3] current_song = words[3]
art = words[4] art = words[4]
@ -175,19 +174,19 @@ local function worker()
if art ~= nil then artUrl = string.sub(art, 8, -1) end if art ~= nil then artUrl = string.sub(art, 8, -1) end
if mpdstatus == "Playing" then if player_status == "Playing" then
mpdarc_icon_widget.visible = true mpdarc_icon_widget.visible = true
icon.image = PLAY_ICON_NAME icon.image = PLAY_ICON_NAME
widget.colors = {beautiful.widget_main_color} widget.colors = {beautiful.widget_main_color}
mpdarc_current_song_widget.markup = current_song mpdarc_current_song_widget.markup = current_song
widget:set_text(artist, current_song) widget:set_text(artist, current_song)
elseif mpdstatus == "Paused" then elseif player_status == "Paused" then
mpdarc_icon_widget.visible = true mpdarc_icon_widget.visible = true
icon.image = PAUSE_ICON_NAME icon.image = PAUSE_ICON_NAME
widget.colors = {beautiful.widget_main_color} widget.colors = {beautiful.widget_main_color}
mpdarc_current_song_widget.markup = current_song mpdarc_current_song_widget.markup = current_song
widget:set_text(artist, current_song) widget:set_text(artist, current_song)
elseif mpdstatus == "Stopped" then elseif player_status == "Stopped" then
mpdarc_icon_widget.visible = true mpdarc_icon_widget.visible = true
icon.image = STOP_ICON_NAME icon.image = STOP_ICON_NAME
mpdarc_current_song_widget.markup = "" mpdarc_current_song_widget.markup = ""
@ -226,7 +225,7 @@ local function worker()
hover_timeout = 0.5, hover_timeout = 0.5,
width = 240, width = 240,
height = 90, height = 90,
title = "<b>" .. mpdstatus .. "</b>", title = "<b>" .. player_status .. "</b>",
text = current_song .. " <b>by</b> " .. artist, text = current_song .. " <b>by</b> " .. artist,
image = artUrl image = artUrl
} }