#!/usr/bin/env ruby require 'mpd' m = MPD.new if m.strf("%A") > "0" npSong = m.strf("%a - %t (from %A) [%e/%l]") else npSong = m.strf("%a - %t [%e/%l]") end if m.status["state"] == "play" # Do the if statement which formats the song npEcho = "np: #{npSong}" elsif m.status["state"] == "pause" # Do the if statement which formats the song npEcho = "np: #{npSong} PAUSED" else # Do not do it here npEcho = "np: nothing" end puts npEcho