From 35ea0775a5750c14edf2df83f84d616f66be2010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 21 Aug 2019 15:50:03 -0400 Subject: [PATCH] Revert "Continuing development." This reverts commit 5d642ce2 --- bazarr/database.py | 12 +++++++----- bazarr/main.py | 5 ++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bazarr/database.py b/bazarr/database.py index e04672776..17e9fc619 100644 --- a/bazarr/database.py +++ b/bazarr/database.py @@ -1,8 +1,10 @@ import os +import atexit from get_args import args from peewee import * from playhouse.sqliteq import SqliteQueueDatabase +from playhouse.reflection import generate_models from helper import path_replace, path_replace_movie, path_replace_reverse, path_replace_reverse_movie @@ -166,6 +168,11 @@ class TableSettingsNotifier(BaseModel): table_name = 'table_settings_notifier' +@atexit.register +def _stop_worker_threads(): + database.stop() + + def database_init(): database.start() database.connect() @@ -183,8 +190,3 @@ def database_init(): System.configured: 0 } ).execute() - - -def database_close(): - if not database.is_closed(): - database.close() diff --git a/bazarr/main.py b/bazarr/main.py index caaea85e2..9be15722a 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -22,8 +22,8 @@ import operator from get_args import args from init import * -from database import database_init, database_close, TableEpisodes, TableShows, TableMovies, TableHistory, \ - TableHistoryMovie, TableSettingsLanguages, TableSettingsNotifier, System +from database import database_init, TableEpisodes, TableShows, TableMovies, TableHistory, TableHistoryMovie, \ + TableSettingsLanguages, TableSettingsNotifier, System # Initiate database database_init() @@ -187,7 +187,6 @@ def shutdown(): else: stop_file.write('') stop_file.close() - database_close() server.stop()