diff options
author | Louis Vézina <[email protected]> | 2018-10-16 08:48:25 -0400 |
---|---|---|
committer | Louis Vézina <[email protected]> | 2018-10-16 08:48:25 -0400 |
commit | 8a1dc9e275e3a8f09fb09fe0903c0eb5619c6e0c (patch) | |
tree | 4a8a4c7992938b5cb91b9cff0d49ef3f30fb4b7b | |
parent | 9c28c30ec8d3c95f7746d46ac8aeb664b3fdfbb3 (diff) | |
download | bazarr-8a1dc9e275e3a8f09fb09fe0903c0eb5619c6e0c.tar.gz bazarr-8a1dc9e275e3a8f09fb09fe0903c0eb5619c6e0c.zip |
Flushing stdout buffer
-rw-r--r-- | bazarr.py | 16 | ||||
-rw-r--r-- | bazarr/main.py | 5 |
2 files changed, 8 insertions, 13 deletions
@@ -2,16 +2,9 @@ import subprocess as sp import threading import time import os -import logging import sys import getopt -log = logging.getLogger() -log.setLevel(logging.DEBUG) -out_hdlr = logging.StreamHandler(sys.stdout) -out_hdlr.setLevel(logging.INFO) -log.addHandler(out_hdlr) - arguments = [] try: opts, args = getopt.getopt(sys.argv[1:],"h:",["no-update", "config="]) @@ -30,10 +23,11 @@ def start_bazarr(): script = [sys.executable, os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + globals()['arguments'] ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE) - logging.info("Bazarr starting...") + print "Bazarr starting..." try: for line in iter(ep.stdout.readline, ''): sys.stdout.write(line) + sys.stdout.flush() except KeyboardInterrupt: pass @@ -58,16 +52,16 @@ if __name__ == '__main__': try: os.remove(stopfile) except: - logging.error('Unable to delete stop file.') + print 'Unable to delete stop file.' else: - logging.info('Bazarr exited.') + print 'Bazarr exited.' os._exit(0) if os.path.exists(restartfile): try: os.remove(restartfile) except: - logging.error('Unable to delete restart file.') + print 'Unable to delete restart file.' else: start_bazarr() diff --git a/bazarr/main.py b/bazarr/main.py index 4804312ec..cbb8c87a1 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -1692,9 +1692,10 @@ import warnings warnings.simplefilter("ignore", DeprecationWarning) server = CherryPyWSGIServer((str(ip), int(port)), app) -logging.info('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url)) try: - print('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url)) + logging.info('Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url)) + print 'Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url) + sys.stdout.flush() server.start() except KeyboardInterrupt: shutdown() |