Created
January 4, 2012 21:13
-
-
Save raphaelm/1562170 to your computer and use it in GitHub Desktop.
Skype+MPD currently hearing as message
This file contains 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/env python | |
# -*- coding: utf-8 -*- | |
from mpd import (MPDClient, CommandError) | |
import sys | |
import datetime | |
import Skype4Py | |
from time import sleep | |
if len(sys.argv) < 2: | |
print "Username angeben!" | |
client = MPDClient() | |
client.connect(host='localhost', port='6600') | |
cs = client.currentsong() | |
msg = '/me hört gerade „%s“ von %s' % (cs['title'], cs['artist']) | |
client.disconnect() | |
def OnAttach(status): | |
global msg | |
if status == Skype4Py.apiAttachAvailable: | |
skype.Attach() | |
if status == Skype4Py.apiAttachSuccess: | |
print "works" | |
skype = Skype4Py.Skype() | |
skype.OnAttachmentStatus = OnAttach | |
skype.Attach() | |
skype.SendMessage(sys.argv[1], msg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needs Skype4Py[1] and python-mpd[2].
[1] http://skype4py.sourceforge.net
[2] http://pypi.python.org/pypi/python-mpd/