Hello,

I talked with anrxc on IRC yesterday about vicious mpd widget, complaining
about missing information in the new version 2, which was present in the
precedent mpc-dependent version: with untagged files and some
webradios(such as French public radios), mpc retrieve a Name or file
information, but
the new widget keeps displaying "N/A".
I figured out how to get the old behavior back (or kind of), by retrieving a
"Name" and "file" variables when retrieving Artist, Title, etc. Then, with a
format function, it is possible (thanks to the great README example) to
switch between Artist Title and Name or file when it is relevant to. I am
not familiar with git or such tools so I enclose my new version of the
mpd.lua file to this mail (if vicious dev find this code worth including in
the official version) and the relevant code of my rc.lua is below:


mpdwidget = widget({ type = "textbox" })
vicious.register(mpdwidget, vicious.widgets.mpd,
  function (widget,args)
    local colorbal='<span color ="#dc8cc3">'
    local endcolorbal='</span>'
    if args["{state}"] == "Stop" then return ""
    else
      if args["{Title}"] ~= "N/A"
        then return colorbal .. args["{Artist}"] .. ' - ' .. args["{Title}"]
.. endcolorbal
        else
          if args["{Name}"] ~= "N/A" then return colorbal .. args["{Name}"]
.. endcolorbal
          else
            return colorbal .. args["{file}"] .. endcolorbal
          end
      end
    end
  end)

Attachment: mpd.lua
Description: Binary data

Reply via email to