3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
5 from SocketServer import *
12 class Handler(BaseRequestHandler):
14 This is a server to encode ts files in another pc.
18 print("connect from:", self.client_address)
20 recdblist.printutf8(cons + " is sent")
21 self.request.send(cons.encode('UTF-8'))
23 #ret = self.request.recv(RECV_BUF)
32 tasks = recdb.getnow("1")
35 if task["type"] == recdblist.REC_ENCODE_QUE:
41 recdb.del_reckey(recdblist.REC_ENCODE_QUE, title, chtxt, btime)
42 recdb.rec_reckey(recdblist.REC_ENCODE_GRID, title, chtxt, btime, etime, opt)
43 rett = "title=" + title + "," + "opt=" + opt + ";"
47 port = int(configreader.getpath("gridserver_port"))
48 sv = ThreadingTCPServer(('', port), Handler)
49 recdblist.printutf8("This is a Rec10 GridServer.")
50 recdblist.printutf8("Waiting for connections at port" + str(port))
51 recdblist.printutf8('listen to:')
52 print (sv.socket.getsockname())
55 if __name__ == '__main__': main()