|
|
|
@ -21,6 +21,7 @@ from fdsend import send_file
|
|
|
|
|
import urllib
|
|
|
|
|
|
|
|
|
|
from init_db import *
|
|
|
|
|
from update_db import *
|
|
|
|
|
from get_languages import *
|
|
|
|
|
from get_providers import *
|
|
|
|
|
|
|
|
|
@ -38,7 +39,7 @@ import logging
|
|
|
|
|
from logging.handlers import TimedRotatingFileHandler
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger('waitress')
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
c = db.cursor()
|
|
|
|
|
c.execute("SELECT log_level FROM table_settings_general")
|
|
|
|
|
log_level = c.fetchone()
|
|
|
|
@ -68,7 +69,7 @@ def configure_logging():
|
|
|
|
|
f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|',
|
|
|
|
|
'%d/%m/%Y %H:%M:%S')
|
|
|
|
|
fh.setFormatter(f)
|
|
|
|
|
logging.getLogger("enzyme").setLevel(logging.ERROR)
|
|
|
|
|
logging.getLogger("enzyme").setLevel(logging.CRITICAL)
|
|
|
|
|
logging.getLogger("apscheduler").setLevel(logging.WARNING)
|
|
|
|
|
logging.getLogger("subliminal").setLevel(logging.ERROR)
|
|
|
|
|
root = logging.getLogger()
|
|
|
|
@ -96,7 +97,7 @@ def image_proxy(url):
|
|
|
|
|
|
|
|
|
|
@route(base_url)
|
|
|
|
|
def series():
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
db.create_function("path_substitution", 1, path_replace)
|
|
|
|
|
c = db.cursor()
|
|
|
|
|
c.execute("SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster FROM table_shows ORDER BY title")
|
|
|
|
@ -126,7 +127,7 @@ def edit_series(no):
|
|
|
|
|
else:
|
|
|
|
|
hi = "False"
|
|
|
|
|
|
|
|
|
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
c = conn.cursor()
|
|
|
|
|
c.execute("UPDATE table_shows SET languages = ?, hearing_impaired = ? WHERE tvdbId LIKE ?", (str(lang), hi, no))
|
|
|
|
|
conn.commit()
|
|
|
|
@ -138,7 +139,7 @@ def edit_series(no):
|
|
|
|
|
|
|
|
|
|
@route(base_url + 'episodes/<no:int>', method='GET')
|
|
|
|
|
def episodes(no):
|
|
|
|
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
conn.create_function("path_substitution", 1, path_replace)
|
|
|
|
|
c = conn.cursor()
|
|
|
|
|
|
|
|
|
@ -173,7 +174,7 @@ def search_missing_subtitles(no):
|
|
|
|
|
|
|
|
|
|
@route(base_url + 'history')
|
|
|
|
|
def history():
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
c = db.cursor()
|
|
|
|
|
|
|
|
|
|
c.execute("SELECT COUNT(*) FROM table_history")
|
|
|
|
@ -193,7 +194,7 @@ def history():
|
|
|
|
|
|
|
|
|
|
@route(base_url + 'wanted')
|
|
|
|
|
def wanted():
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
db.create_function("path_substitution", 1, path_replace)
|
|
|
|
|
c = db.cursor()
|
|
|
|
|
|
|
|
|
@ -221,7 +222,7 @@ def wanted_search_missing_subtitles_list():
|
|
|
|
|
|
|
|
|
|
@route(base_url + 'settings')
|
|
|
|
|
def settings():
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
c = db.cursor()
|
|
|
|
|
c.execute("SELECT * FROM table_settings_general")
|
|
|
|
|
settings_general = c.fetchone()
|
|
|
|
@ -238,7 +239,7 @@ def settings():
|
|
|
|
|
def save_settings():
|
|
|
|
|
ref = request.environ['HTTP_REFERER']
|
|
|
|
|
|
|
|
|
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
c = conn.cursor()
|
|
|
|
|
|
|
|
|
|
settings_general_ip = request.forms.get('settings_general_ip')
|
|
|
|
@ -437,7 +438,7 @@ def get_subtitle():
|
|
|
|
|
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
|
|
|
|
|
tvdbid = request.forms.get('tvdbid')
|
|
|
|
|
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
|
|
|
|
|
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
|
|
|
|
|
c = db.cursor()
|
|
|
|
|
c.execute("SELECT name FROM table_settings_providers WHERE enabled = 1")
|
|
|
|
|
providers = c.fetchall()
|
|
|
|
|