|
|
|
@ -370,6 +370,7 @@ class Daemon(threading.Thread):
|
|
|
|
|
self.buf = buf
|
|
|
|
|
self.running=True
|
|
|
|
|
self.info = info
|
|
|
|
|
self.paused=False
|
|
|
|
|
threading.Thread.__init__(self)
|
|
|
|
|
def _get(self,con, fr, ca=False):
|
|
|
|
|
if ca:
|
|
|
|
@ -403,6 +404,12 @@ class Daemon(threading.Thread):
|
|
|
|
|
elif cmd.uCommand == Command.CMD_INFO: #information
|
|
|
|
|
log("[daemon]: Recieved info")
|
|
|
|
|
con.send(json.dumps(self.info).encode("ascii"))
|
|
|
|
|
elif cmd.uCommand == Command.CMD_PAUSE:
|
|
|
|
|
log("[daemon]: Recieved pause")
|
|
|
|
|
self.paused = True
|
|
|
|
|
elif cmd.uCommand == Command.CMD_RESUME:
|
|
|
|
|
log("[daemon]: Recieved resume")
|
|
|
|
|
self.paused = False
|
|
|
|
|
else: #unknwon command
|
|
|
|
|
log("[daemon]: Recieved unknown command")
|
|
|
|
|
pass
|
|
|
|
@ -466,6 +473,10 @@ if args.daemon!=None:
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
while runForever or daemon.running:
|
|
|
|
|
|
|
|
|
|
if(not runForever) and daemon.paused:
|
|
|
|
|
log("Skipping rotation")
|
|
|
|
|
else:
|
|
|
|
|
log("Reading threads for %s from %d" % (args.board, last))
|
|
|
|
|
posts = parse_page(args.api, args.board, "1", last)
|
|
|
|
|
last = pnomax(last, posts)
|
|
|
|
|