Created
October 7, 2014 18:00
-
-
Save DASPRiD/f069cfba9cd223726280 to your computer and use it in GitHub Desktop.
MPD script for HexChat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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