mirror of https://github.com/morpheus65535/bazarr
Fix for new install since peewee integration.
This commit is contained in:
parent
5fcad77383
commit
2fcf3dee08
|
@ -8,9 +8,9 @@ from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
from helper import path_replace, path_replace_movie, path_replace_reverse, path_replace_reverse_movie
|
from helper import path_replace, path_replace_movie, path_replace_reverse, path_replace_reverse_movie
|
||||||
|
|
||||||
database = SqliteQueueDatabase(
|
database = SqliteQueueDatabase(
|
||||||
os.path.join(args.config_dir, 'db', 'bazarr.db'),
|
None,
|
||||||
use_gevent=False,
|
use_gevent=False,
|
||||||
autostart=True,
|
autostart=False,
|
||||||
queue_max_size=256, # Max. # of pending writes that can accumulate.
|
queue_max_size=256, # Max. # of pending writes that can accumulate.
|
||||||
results_timeout=30.0) # Max. time to wait for query to be executed.
|
results_timeout=30.0) # Max. time to wait for query to be executed.
|
||||||
|
|
||||||
|
@ -168,6 +168,8 @@ class TableSettingsNotifier(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
def database_init():
|
def database_init():
|
||||||
|
database.init(os.path.join(args.config_dir, 'db', 'bazarr.db'))
|
||||||
|
database.start()
|
||||||
database.connect()
|
database.connect()
|
||||||
|
|
||||||
database.pragma('wal_checkpoint', 'TRUNCATE') # Run a checkpoint and merge remaining wal-journal.
|
database.pragma('wal_checkpoint', 'TRUNCATE') # Run a checkpoint and merge remaining wal-journal.
|
||||||
|
@ -180,22 +182,7 @@ def database_init():
|
||||||
|
|
||||||
database.create_tables(models_list, safe=True)
|
database.create_tables(models_list, safe=True)
|
||||||
|
|
||||||
# Insert default values
|
|
||||||
if System.select().count() == 0:
|
|
||||||
System.insert(
|
|
||||||
{
|
|
||||||
System.updated: 0,
|
|
||||||
System.configured: 0
|
|
||||||
}
|
|
||||||
).execute()
|
|
||||||
|
|
||||||
|
|
||||||
def wal_cleaning():
|
def wal_cleaning():
|
||||||
database.pragma('wal_checkpoint', 'TRUNCATE') # Run a checkpoint and merge remaining wal-journal.
|
database.pragma('wal_checkpoint', 'TRUNCATE') # Run a checkpoint and merge remaining wal-journal.
|
||||||
database.wal_autocheckpoint = 50 # Run an automatic checkpoint every 50 write transactions.
|
database.wal_autocheckpoint = 50 # Run an automatic checkpoint every 50 write transactions.
|
||||||
|
|
||||||
|
|
||||||
@atexit.register
|
|
||||||
def _stop_worker_threads():
|
|
||||||
database.close()
|
|
||||||
database.stop()
|
|
||||||
|
|
|
@ -88,10 +88,16 @@ else:
|
||||||
bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if')
|
bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if')
|
||||||
|
|
||||||
# Reset restart required warning on start
|
# Reset restart required warning on start
|
||||||
|
if System.select().count():
|
||||||
System.update({
|
System.update({
|
||||||
System.configured: 0,
|
System.configured: 0,
|
||||||
System.updated: 0
|
System.updated: 0
|
||||||
}).execute()
|
}).execute()
|
||||||
|
else:
|
||||||
|
System.insert({
|
||||||
|
System.configured: 0,
|
||||||
|
System.updated: 0
|
||||||
|
}).execute()
|
||||||
|
|
||||||
# Load languages in database
|
# Load languages in database
|
||||||
load_language_in_db()
|
load_language_in_db()
|
||||||
|
@ -188,21 +194,16 @@ def shutdown():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error('BAZARR Cannot create bazarr.stop file.')
|
logging.error('BAZARR Cannot create bazarr.stop file.')
|
||||||
else:
|
else:
|
||||||
stop_file.write('')
|
server.stop()
|
||||||
stop_file.close()
|
|
||||||
database.close()
|
database.close()
|
||||||
database.stop()
|
database.stop()
|
||||||
server.stop()
|
stop_file.write('')
|
||||||
|
stop_file.close()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
@route(base_url + 'restart')
|
@route(base_url + 'restart')
|
||||||
def restart():
|
def restart():
|
||||||
try:
|
|
||||||
server.stop()
|
|
||||||
except:
|
|
||||||
logging.error('BAZARR Cannot stop CherryPy.')
|
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
restart_file = open(os.path.join(args.config_dir, "bazarr.restart"), "w")
|
restart_file = open(os.path.join(args.config_dir, "bazarr.restart"), "w")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -210,10 +211,12 @@ def restart():
|
||||||
else:
|
else:
|
||||||
# print 'Bazarr is being restarted...'
|
# print 'Bazarr is being restarted...'
|
||||||
logging.info('Bazarr is being restarted...')
|
logging.info('Bazarr is being restarted...')
|
||||||
restart_file.write('')
|
server.stop()
|
||||||
restart_file.close()
|
|
||||||
database.close()
|
database.close()
|
||||||
database.stop()
|
database.stop()
|
||||||
|
restart_file.write('')
|
||||||
|
restart_file.close()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
@route(base_url + 'wizard')
|
@route(base_url + 'wizard')
|
||||||
|
@ -439,7 +442,7 @@ def save_wizard():
|
||||||
settings_movie_default_hi = 'True'
|
settings_movie_default_hi = 'True'
|
||||||
settings.general.movie_default_hi = text_type(settings_movie_default_hi)
|
settings.general.movie_default_hi = text_type(settings_movie_default_hi)
|
||||||
|
|
||||||
settings_movie_default_forced = str(request.forms.getall('settings_movie_default_forced'))
|
settings_movie_default_forced = str(request.forms.get('settings_movie_default_forced'))
|
||||||
settings.general.movie_default_forced = text_type(settings_movie_default_forced)
|
settings.general.movie_default_forced = text_type(settings_movie_default_forced)
|
||||||
|
|
||||||
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
|
||||||
|
|
|
@ -105,9 +105,9 @@
|
||||||
<option value="">Languages</option>
|
<option value="">Languages</option>
|
||||||
%enabled_languages = []
|
%enabled_languages = []
|
||||||
%for language in settings_languages:
|
%for language in settings_languages:
|
||||||
<option value="{{language[1]}}">{{language[2]}}</option>
|
<option value="{{language.code2}}">{{language.name}}</option>
|
||||||
%if language[3] == True:
|
%if language.enabled == True:
|
||||||
% enabled_languages.append(str(language[1]))
|
% enabled_languages.append(str(language.code2))
|
||||||
%end
|
%end
|
||||||
%end
|
%end
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue