|
|
@ -77,7 +77,7 @@ def get_stop_status_code(input_file):
|
|
|
|
except (ValueError, TypeError):
|
|
|
|
except (ValueError, TypeError):
|
|
|
|
status_code = EXIT_NORMAL
|
|
|
|
status_code = EXIT_NORMAL
|
|
|
|
file.close()
|
|
|
|
file.close()
|
|
|
|
except:
|
|
|
|
except Exception:
|
|
|
|
status_code = EXIT_NORMAL
|
|
|
|
status_code = EXIT_NORMAL
|
|
|
|
return status_code
|
|
|
|
return status_code
|
|
|
|
|
|
|
|
|
|
|
@ -87,9 +87,9 @@ def check_status():
|
|
|
|
if os.path.exists(stop_file):
|
|
|
|
if os.path.exists(stop_file):
|
|
|
|
status_code = get_stop_status_code(stop_file)
|
|
|
|
status_code = get_stop_status_code(stop_file)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
print(f"Deleting stop file...")
|
|
|
|
print("Deleting stop file...")
|
|
|
|
os.remove(stop_file)
|
|
|
|
os.remove(stop_file)
|
|
|
|
except Exception as e:
|
|
|
|
except Exception:
|
|
|
|
print('Unable to delete stop file.')
|
|
|
|
print('Unable to delete stop file.')
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
terminate_child()
|
|
|
|
terminate_child()
|
|
|
@ -97,13 +97,13 @@ def check_status():
|
|
|
|
|
|
|
|
|
|
|
|
if os.path.exists(restart_file):
|
|
|
|
if os.path.exists(restart_file):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
print(f"Deleting restart file...")
|
|
|
|
print("Deleting restart file...")
|
|
|
|
os.remove(restart_file)
|
|
|
|
os.remove(restart_file)
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
print('Unable to delete restart file.')
|
|
|
|
print('Unable to delete restart file.')
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
terminate_child()
|
|
|
|
terminate_child()
|
|
|
|
print(f"Bazarr is restarting...")
|
|
|
|
print("Bazarr is restarting...")
|
|
|
|
child_process = start_bazarr()
|
|
|
|
child_process = start_bazarr()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -116,7 +116,7 @@ def interrupt_handler(signum, frame):
|
|
|
|
interrupted = True
|
|
|
|
interrupted = True
|
|
|
|
print('Handling keyboard interrupt...')
|
|
|
|
print('Handling keyboard interrupt...')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print(f"Stop doing that! I heard you the first time!")
|
|
|
|
print("Stop doing that! I heard you the first time!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
@ -148,5 +148,5 @@ if __name__ == '__main__':
|
|
|
|
time.sleep(5)
|
|
|
|
time.sleep(5)
|
|
|
|
except (KeyboardInterrupt, SystemExit, ChildProcessError):
|
|
|
|
except (KeyboardInterrupt, SystemExit, ChildProcessError):
|
|
|
|
# this code should never be reached, if signal handling is working properly
|
|
|
|
# this code should never be reached, if signal handling is working properly
|
|
|
|
print(f'Bazarr exited main script file via keyboard interrupt.')
|
|
|
|
print('Bazarr exited main script file via keyboard interrupt.')
|
|
|
|
exit_program(EXIT_INTERRUPT)
|
|
|
|
exit_program(EXIT_INTERRUPT)
|
|
|
|