From c6559d60f83b51b3885ea1f00fe4168228aca132 Mon Sep 17 00:00:00 2001 From: Date: Sat, 14 Oct 2017 00:07:22 +0300 Subject: [PATCH] Added daemonizer and fixed bug when 0 games are found --- src/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 2dc005d..4e70c93 100755 --- a/src/main.py +++ b/src/main.py @@ -5,6 +5,7 @@ from twitch import TwitchClient import json import cherrypy +from cherrypy.process.plugins import Daemonizer ver = '1.00' @@ -42,7 +43,7 @@ class FleastServer(object): return 'Internal Error
Tell me more at https://twitter.com/alexvanin' if data['_total'] == 0: - return self.templ_main.format( _stream_num_ = data['_total'], _stream_list_ = '', _version_ = ver) + return self.templ_main.format( _stream_num_ = data['_total'], _game_name_ = game, _stream_list_ = '', _version_ = ver) cherrypy.log('Found %d streams' % data['_total']) @@ -57,6 +58,8 @@ class FleastServer(object): def main(): server = FleastServer() + d = Daemonizer(cherrypy.engine) + d.subscribe() cherrypy.quickstart(server, '/fleast', './server.conf')