Skip to content

Instantly share code, notes, and snippets.

@udoprog
Created August 23, 2013 20:56
Show Gist options
  • Save udoprog/6323931 to your computer and use it in GitHub Desktop.
Save udoprog/6323931 to your computer and use it in GitHub Desktop.
Send a broadcast message to all members on a mumble server
#!/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