Skip to content

Instantly share code, notes, and snippets.

@raphaelm
Created January 4, 2012 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raphaelm/1562170 to your computer and use it in GitHub Desktop.
Save raphaelm/1562170 to your computer and use it in GitHub Desktop.
Skype+MPD currently hearing as message
#!/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);
@raphaelm
Copy link
Author

raphaelm commented Jan 4, 2012

Needs Skype4Py[1] and python-mpd[2].

[1] http://skype4py.sourceforge.net
[2] http://pypi.python.org/pypi/python-mpd/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment