6 # @brief <p> Plugin for GMyth-Stream
8 # Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
9 # @author Artur Duque de Souza <artur.souza@indt.org.br>
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU Lesser General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 return time.strftime("%Y-%m-%d %H:%M:%S");
38 config = ConfigParser.ConfigParser()
39 config.read("stream.conf")
41 media_plugin = config.get("Media", "engine")
42 exec("from plugins.media.%s import *" % media_plugin)
46 comm_plugin = config.get("Comm", "engine")
47 exec("from plugins.comm.%s import *" % comm_plugin)
50 server = Server(config)
52 print "--> Starting the server..."
54 while (server.finish == 0):
55 con, client = server.getRequest()
58 msg = server.getMsg(1024).strip()
62 elif (msg == "SETUP"):
63 setup = server.getMsg(1024).strip().split(" ")
64 media.setup(setup[0], setup[1], setup[2], \
65 setup[3], setup[4], setup[5])
73 elif (msg == "CLOSE"):
78 print "[%s] %s: %s" % (now(), client, msg)
80 print "[%s] Closing connection with %s" % (now(), client)
81 server.disconnect_client(con)
85 print "--> Server stopped..."