Logo Search packages:      
Sourcecode: weechat-scripts version File versions  Download package

def mpdnp::np (   server,
  args 
)

  Send information about the currently
  played song to the channel.

Definition at line 56 of file mpdnp.py.

00056                     :
  """
    Send information about the currently
    played song to the channel.
  """
  host = wc.get_plugin_config("host")
  port = int(wc.get_plugin_config("port"))
  cont = mpd.MpdController(host=host, port=port)
  song = cont.getCurrentSong()
  pos, length, pct = cont.getSongPosition()

  # insert artist, title, album, track, path
  d = song.__dict__
  d.update({
      "title_or_file": song.title or splitext(basename(song.path))[0],
      "pos_sec": "%02d" % (pos / 60),
      "pos_min": str(pos / 60),
      "length_sec": "%02d" % (length % 60),
      "length_min": str(length / 60),
      "pct": "%2.0f" % pct,
  })
  
  wc.command(subst(wc.get_plugin_config("format"), d))
  return 0
  
def dbgnp(server, args):


Generated by  Doxygen 1.6.0   Back to index