3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
5 from SocketServer import *
13 class Handler(BaseRequestHandler):
15 This is a server to encode ts files in another pc.
19 print("connect from:", self.client_address)
21 recdblist.printutf8(cons + " is sent")
22 self.request.send(cons.encode('UTF-8'))
24 #ret = self.request.recv(RECV_BUF)
33 tasks = recdb.getnow("1")
36 if task["type"] == recdblist.REC_ENCODE_QUE and not re.search("d",task['opt']) and not re.search("5",task['opt']):
42 recdb.del_reckey(recdblist.REC_ENCODE_QUE, title, chtxt, btime)
43 recdb.rec_reckey(recdblist.REC_ENCODE_GRID, title, chtxt, btime, etime, opt)
44 rett = "title=" + title + "," + "opt=" + opt + ";"
48 port = int(configreader.getpath("gridserver_port"))
49 sv = ThreadingTCPServer(('', port), Handler)
50 recdblist.printutf8("This is a Rec10 GridServer.")
51 recdblist.printutf8("Waiting for connections at port" + str(port))
52 recdblist.printutf8('listen to:')
53 print (sv.socket.getsockname())
56 if __name__ == '__main__': main()