All pastes #61454 Raw Edit

Anonymous

public text v1 · immutable
#61454 ·published 2006-06-03 21:56 UTC
rendered paste body
#!/usr/bin/env ruby

require 'mpd'

m = MPD.new

def format(m)
  if m.strf("%A") > "0"
    return m.strf("%a - %t (from %A) [%e/%l]")
  else
    return m.strf("%a - %t [%e/%l]")
  end
end

if (m.status["state"] == "play") or
  # Do the if statement which formats the song
  npEcho = "np: #{format(m)}"
elsif m.status["state"] == "pause"
  # Do the if statement which formats the song
  npEcho = "np: #{format(m)} PAUSED"
else
  # Do not do it here
  npEcho = "np: nothing"
end

puts npEcho