1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 09:37:25 +00:00

Continuing development.

This commit is contained in:
Louis Vézina 2019-08-22 14:58:08 -04:00
parent 266ddbb9db
commit feaa29a640
5 changed files with 26 additions and 19 deletions

View file

@ -14,10 +14,6 @@ database = SqliteQueueDatabase(
queue_max_size=256, # Max. # of pending writes that can accumulate.
results_timeout=30.0) # Max. time to wait for query to be executed.
#database = SqliteDatabase(os.path.join(args.config_dir, 'db', 'bazarr.db'), pragmas={
# 'journal_mode': 'wal',
# 'cache_size': -1024 * 8})
@database.func('path_substitution')
def path_substitution(path):
@ -174,6 +170,11 @@ class TableSettingsNotifier(BaseModel):
def database_init():
database.connect()
database.pragma('wal_checkpoint', 'TRUNCATE') # Run a checkpoint and merge remaining wal-journal.
database.cache_size = -1024 # Number of KB of cache for wal-journal.
# Must be negative because positive means number of pages.
database.wal_autocheckpoint = 50 # Run an automatic checkpoint every 50 write transactions.
models_list = [TableShows, TableEpisodes, TableMovies, TableHistory, TableHistoryMovie, TableSettingsLanguages,
TableSettingsNotifier, System]
@ -189,6 +190,11 @@ def database_init():
).execute()
def wal_cleaning():
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.
@atexit.register
def _stop_worker_threads():
database.close()

View file

@ -4,13 +4,12 @@ import requests
import logging
import re
from queueconfig import notifications
from database import TableShows, TableEpisodes
from database import TableShows, TableEpisodes, wal_cleaning
from get_args import args
from config import settings, url_sonarr
from helper import path_replace
from list_subtitles import list_missing_subtitles, store_subtitles, series_full_scan_subtitles, \
movies_full_scan_subtitles
from list_subtitles import list_missing_subtitles, store_subtitles, series_full_scan_subtitles
from get_subtitle import episode_download_subtitles
@ -19,13 +18,7 @@ def update_all_episodes():
logging.info('BAZARR All existing episode subtitles indexed from disk.')
list_missing_subtitles()
logging.info('BAZARR All missing episode subtitles updated in database.')
def update_all_movies():
movies_full_scan_subtitles()
logging.info('BAZARR All existing movie subtitles indexed from disk.')
list_missing_subtitles()
logging.info('BAZARR All missing movie subtitles updated in database.')
wal_cleaning()
def sync_episodes():

View file

@ -8,9 +8,18 @@ from queueconfig import notifications
from get_args import args
from config import settings, url_radarr
from helper import path_replace_movie
from list_subtitles import store_subtitles_movie, list_missing_subtitles_movies
from list_subtitles import store_subtitles_movie, list_missing_subtitles_movies, movies_full_scan_subtitles
from get_subtitle import movies_download_subtitles
from database import TableMovies
from database import TableMovies, wal_cleaning
def update_all_movies():
movies_full_scan_subtitles()
logging.info('BAZARR All existing movie subtitles indexed from disk.')
list_missing_subtitles_movies()
logging.info('BAZARR All missing movie subtitles updated in database.')
wal_cleaning()
def update_movies():

View file

@ -32,7 +32,6 @@ def store_subtitles(file):
logging.debug('BAZARR started subtitles indexing for this file: ' + file)
actual_subtitles = []
if os.path.exists(file):
# notifications.write(msg='Analyzing this file for subtitles: ' + file, queue='list_subtitles')
if settings.general.getboolean('use_embedded_subs'):
logging.debug("BAZARR is trying to index embedded subtitles.")
try:

View file

@ -1,7 +1,7 @@
# coding=utf-8
from get_episodes import sync_episodes, update_all_episodes, update_all_movies
from get_movies import update_movies
from get_episodes import sync_episodes, update_all_episodes
from get_movies import update_movies, update_all_movies
from get_series import update_series
from config import settings
from get_subtitle import wanted_search_missing_subtitles, upgrade_subtitles