Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

take server nick channel on command line, requirements pip file

  • Loading branch information...
commit 122ed42643360e760c2be1cfaa287d96a95afb9b 1 parent 33df50d
Eric Stein eastein authored
15 PROTOCOL.md
View
@@ -54,26 +54,33 @@ Args: `filename`, `reason`
The master sent a simul-file command and the slave couldn't. A reason should be specified. The reason shall be text.
-<A name="toc2-56" title="Command Bus" />
+<A name="toc3-56" title="simul_playcompleted" />
+### simul_playcompleted
+
+Args: `filename`
+
+As soon as file playback is completed, this should be sent. This lets the master node announce that the playback completed. Optional.
+
+<A name="toc2-63" title="Command Bus" />
## Command Bus
The Command bus will be a ZeroMQ SUB socket bound on the master node. Slaves will connect to it, and obey its commands.
-<A name="toc3-61" title="simul_file" />
+<A name="toc3-68" title="simul_file" />
### simul_file
Args: `filename`
When this message is recieved, the slave should start looking for the file specified, and drop any tasks that are currently operating, except for a running media play. `file-status` messages should be sent periodically to report on such status.
-<A name="toc3-68" title="simul_start" />
+<A name="toc3-75" title="simul_start" />
### simul_start
Args: `filename`
When this message is recieved, the file should start playing immediately. The slaves should all respond with either simul-started or simul-notstarted as soon as possible.
-<A name="toc3-75" title="simul_stop" />
+<A name="toc3-82" title="simul_stop" />
### simul_stop
Args: `filename`
6 PROTOCOL.txt
View
@@ -46,6 +46,12 @@ Args: `filename`, `reason`
The master sent a simul-file command and the slave couldn't. A reason should be specified. The reason shall be text.
+### simul_playcompleted
+
+Args: `filename`
+
+As soon as file playback is completed, this should be sent. This lets the master node announce that the playback completed. Optional.
+
## Command Bus
The Command bus will be a ZeroMQ SUB socket bound on the master node. Slaves will connect to it, and obey its commands.
12 irc.py
View
@@ -2,9 +2,12 @@
from twisted.internet import reactor, protocol
class IRCInterface(irc.IRCClient):
- nickname = "[mc]simulderp"
realname = "simulderp (c) 2012 mistakes consortium"
+ @property
+ def nickname(self) :
+ return self.factory.nick
+
def signedOn(self):
IRCInterface.instance = self
self.join(self.factory.channel)
@@ -22,11 +25,12 @@ def privmsg(self, user, channel, message):
callback(nick, channel, args)
class IRCInterfaceFactory(protocol.ReconnectingClientFactory):
- def __init__(self, channel):
+ def __init__(self, nick, channel):
+ self.nick = nick
self.channel = channel
-def start_reactor(protocol, host, port, channel):
- factory = IRCInterfaceFactory(channel)
+def start_reactor(protocol, host, port, nick, channel):
+ factory = IRCInterfaceFactory(nick, channel)
factory.protocol = protocol
reactor.connectTCP(host, port, factory)
reactor.run()
13 main.py 100644 → 100755
View
@@ -1,4 +1,6 @@
+#!/usr/bin/env python
import irc
+import sys
class SimulderpInterface(irc.IRCInterface):
started = False
@@ -77,4 +79,13 @@ def COMMAND_BRB(self, nick, channel, args):
self.ready_nicks.remove(nick)
except: pass
-irc.start_reactor(SimulderpInterface, "irc.someserver.net", 6667, "#mc")
+try :
+ serv = sys.argv[1]
+ port = 6667
+ nick = sys.argv[2]
+ chan = sys.argv[3]
+except IndexError :
+ sys.stderr.write('usage: ./simulmaster.py <server> <nick> <channel>\n')
+ sys.exit(1)
+
+irc.start_reactor(SimulderpInterface, serv, 6667, nick, chan)
1  requirements.pip
View
@@ -0,0 +1 @@
+twisted==12.0.0
Please sign in to comment.
Something went wrong with that request. Please try again.