Created
August 23, 2013 20:56
-
-
Save udoprog/6323931 to your computer and use it in GitHub Desktop.
Send a broadcast message to all members on a mumble server
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 | |
import dbus | |
import collections | |
import sys | |
import os | |
if __name__ == "__main__": | |
if len(sys.argv) < 2: | |
print "Usage: mumble-broadcast <message>" | |
sys.exit(1) | |
user = os.environ.get("USER", "system") | |
message = u"Message from {0}: {1}".format(user, sys.argv[1]) | |
Player = collections.namedtuple("Player", "session mute deaf suppressed selfMute selfDeaf channel id name onlinesecs bytespersecond") | |
Channel = collections.namedtuple("Channel", "id name parent links") | |
dbus_base = 'net.sourceforge.mumble.murmur' | |
bus = dbus.SystemBus() | |
proxy = bus.get_object(dbus_base, '/1') | |
murmur = dbus.Interface(proxy, 'net.sourceforge.mumble.Murmur') | |
for p in murmur.getPlayers(): | |
player = Player(*p) | |
murmur.sendMessage(player.session, message) | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment