Skip to content

Instantly share code, notes, and snippets.

@DASPRiD
Created October 7, 2014 18:00
Show Gist options
  • Select an option

  • Save DASPRiD/f069cfba9cd223726280 to your computer and use it in GitHub Desktop.

Select an option

Save DASPRiD/f069cfba9cd223726280 to your computer and use it in GitHub Desktop.
MPD script for HexChat
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import hexchat
__module_name__ = "MPD Status"
__module_version__ = "0.0.1"
__module_description__ = "Sends MPD status"
def sendStatus(word, word_eolm, userdata):
os.environ["MPD_HOST"]="localhost"
output = os.popen("mpc -f '[[%artist% - ]%title%]'").readlines()
if len(output) == 1:
status = "silence"
else:
status = output[0].strip()
hexchat.command("me is listening to %s [HexChat/MPD]" % (status))
return hexchat.EAT_ALL
hexchat.hook_command("mpd", sendStatus, help="/mpd Sends MPD status")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment