diff options
author | Louis Vézina <[email protected]> | 2017-10-19 19:50:54 -0400 |
---|---|---|
committer | Louis Vézina <[email protected]> | 2017-10-19 19:50:54 -0400 |
commit | 7d471ef0f202bbbbdd0541c893def04172e8dba7 (patch) | |
tree | 97dfea4baa1f108b7672b1473de5d2506aa65376 | |
parent | dcaa2ce0c80f1b2c511d07e8997b392b2fa86cdf (diff) | |
download | bazarr-7d471ef0f202bbbbdd0541c893def04172e8dba7.tar.gz bazarr-7d471ef0f202bbbbdd0541c893def04172e8dba7.zip |
Put log and db in data folder
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Dockerfile | 2 | ||||
-rw-r--r-- | bazarr.py | 26 | ||||
-rw-r--r-- | get_episodes.py | 4 | ||||
-rw-r--r-- | get_general_settings.py | 2 | ||||
-rw-r--r-- | get_languages.py | 2 | ||||
-rw-r--r-- | get_providers.py | 2 | ||||
-rw-r--r-- | get_series.py | 2 | ||||
-rw-r--r-- | get_sonarr_settings.py | 2 | ||||
-rw-r--r-- | get_subtitle.py | 4 | ||||
-rw-r--r-- | init_db.py | 4 | ||||
-rw-r--r-- | list_subtitles.py | 10 | ||||
-rw-r--r-- | utils.py | 2 |
13 files changed, 33 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore index 30c64c842..10dfa1997 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ *.pyc -bazarr.db +data/db/bazarr.db cachefile.dbm *.log *.log.* *.db *.pyc *.pyc -bazarr.db +data/db/bazarr.db diff --git a/Dockerfile b/Dockerfile index 12bcc8e3b..467c4a468 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM lsiobase/alpine.python EXPOSE 6767 -VOLUME /bazarr /tv +VOLUME /bazarr/data /tv # Update RUN apk add --update build-base python-dev py2-pip py-setuptools jpeg-dev zlib-dev git @@ -28,7 +28,7 @@ from utils import * import logging
from logging.handlers import TimedRotatingFileHandler
logger = logging.getLogger('waitress')
-db = sqlite3.connect('bazarr.db')
+db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
c.execute("SELECT log_level FROM table_settings_general")
log_level = c.fetchone()
@@ -53,7 +53,7 @@ class OneLineExceptionFormatter(logging.Formatter): return s
def configure_logging():
- fh = TimedRotatingFileHandler('bazarr.log', when="midnight", interval=1, backupCount=7)
+ fh = TimedRotatingFileHandler('data/log/bazarr.log', when="midnight", interval=1, backupCount=7)
f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|',
'%d/%m/%Y %H:%M:%S')
fh.setFormatter(f)
@@ -78,7 +78,7 @@ def image_proxy(url): @route(base_url + '/')
def series():
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
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")
@@ -108,7 +108,7 @@ def edit_series(no): else:
hi = "False"
- conn = sqlite3.connect('bazarr.db')
+ conn = sqlite3.connect('data/db/bazarr.db')
c = conn.cursor()
c.execute("UPDATE table_shows SET languages = ?, hearing_impaired = ? WHERE tvdbId LIKE ?", (str(lang), hi, no))
conn.commit()
@@ -144,7 +144,7 @@ def add_new_episodes_list(): @route(base_url + '/episodes/<no:int>', method='GET')
def episodes(no):
- conn = sqlite3.connect('bazarr.db')
+ conn = sqlite3.connect('data/db/bazarr.db')
conn.create_function("path_substitution", 1, path_replace)
c = conn.cursor()
@@ -178,7 +178,7 @@ def search_missing_subtitles(no): @route(base_url + '/history')
def history():
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
c.execute("SELECT COUNT(*) FROM table_history")
@@ -198,7 +198,7 @@ def history(): @route(base_url + '/wanted')
def wanted():
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
db.create_function("path_substitution", 1, path_replace)
c = db.cursor()
@@ -220,7 +220,7 @@ def wanted(): def wanted_search_missing_subtitles():
ref = request.environ['HTTP_REFERER']
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
db.create_function("path_substitution", 1, path_replace)
c = db.cursor()
@@ -235,7 +235,7 @@ def wanted_search_missing_subtitles(): @route(base_url + '/settings')
def settings():
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
c.execute("SELECT * FROM table_settings_general")
settings_general = c.fetchone()
@@ -252,7 +252,7 @@ def settings(): def save_settings():
ref = request.environ['HTTP_REFERER']
- conn = sqlite3.connect('bazarr.db')
+ conn = sqlite3.connect('data/db/bazarr.db')
c = conn.cursor()
settings_general_ip = request.forms.get('settings_general_ip')
@@ -292,14 +292,14 @@ def save_settings(): @route(base_url + '/system')
def system():
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
c.execute("SELECT * FROM table_scheduler")
tasks = c.fetchall()
c.close()
logs = []
- for line in reversed(open('bazarr.log').readlines()):
+ for line in reversed(open('data/log/bazarr.log').readlines()):
logs.append(line.rstrip())
return template('system', tasks=tasks, logs=logs, base_url=base_url)
@@ -331,7 +331,7 @@ def get_subtitle(): sonarrSeriesId = request.forms.get('sonarrSeriesId')
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
c.execute("SELECT name FROM table_settings_providers WHERE enabled = 1")
providers = c.fetchall()
diff --git a/get_episodes.py b/get_episodes.py index 24ffee633..692e0cbd2 100644 --- a/get_episodes.py +++ b/get_episodes.py @@ -6,7 +6,7 @@ from list_subtitles import * def update_all_episodes():
# Open database connection
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Get Sonarr API URL from database config table
@@ -65,7 +65,7 @@ def update_all_episodes(): def add_new_episodes():
# Open database connection
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Get Sonarr API URL from database config table
diff --git a/get_general_settings.py b/get_general_settings.py index 94185fe5e..7d0092daa 100644 --- a/get_general_settings.py +++ b/get_general_settings.py @@ -3,7 +3,7 @@ import os import ast
# Open database connection
-db = sqlite3.connect('bazarr.db')
+db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Get general settings from database table
diff --git a/get_languages.py b/get_languages.py index b48fa4931..7c219b46f 100644 --- a/get_languages.py +++ b/get_languages.py @@ -7,7 +7,7 @@ langs = [[lang.alpha_3,lang.alpha_2,lang.name] if hasattr(lang, 'alpha_2')]
# Open database connection
-db = sqlite3.connect('bazarr.db')
+db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Insert languages in database table
diff --git a/get_providers.py b/get_providers.py index f20f750e3..df4aacb0b 100644 --- a/get_providers.py +++ b/get_providers.py @@ -5,7 +5,7 @@ from subliminal import * providers_list = sorted(provider_manager.names()) # Open database connection -db = sqlite3.connect('bazarr.db') +db = sqlite3.connect('data/db/bazarr.db') c = db.cursor() # Insert providers in database table diff --git a/get_series.py b/get_series.py index c8dba939f..f4b86253e 100644 --- a/get_series.py +++ b/get_series.py @@ -6,7 +6,7 @@ from get_sonarr_settings import * def update_series():
# Open database connection
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Get shows data from Sonarr
diff --git a/get_sonarr_settings.py b/get_sonarr_settings.py index 387795074..da8ad1a81 100644 --- a/get_sonarr_settings.py +++ b/get_sonarr_settings.py @@ -3,7 +3,7 @@ import os import ast
# Open database connection
-db = sqlite3.connect('bazarr.db')
+db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Get Sonarr API URL from database config table
diff --git a/get_subtitle.py b/get_subtitle.py index b51b49cdc..5d905d1b3 100644 --- a/get_subtitle.py +++ b/get_subtitle.py @@ -27,7 +27,7 @@ def download_subtitle(path, language, hi, providers): return None def series_download_subtitles(no): - conn_db = sqlite3.connect('bazarr.db') + conn_db = sqlite3.connect('data/db/bazarr.db') c_db = conn_db.cursor() episodes_details = c_db.execute("SELECT path, missing_subtitles, sonarrEpisodeId FROM table_episodes WHERE path = ?", (no,)).fetchall() series_details = c_db.execute("SELECT hearing_impaired FROM table_shows WHERE sonarrSeriesId = ?", (no,)).fetchone() @@ -47,7 +47,7 @@ def series_download_subtitles(no): list_missing_subtitles(no) def wanted_download_subtitles(path): - conn_db = sqlite3.connect('bazarr.db') + conn_db = sqlite3.connect('data/db/bazarr.db') c_db = conn_db.cursor() episodes_details = c_db.execute("SELECT table_episodes.path, table_episodes.missing_subtitles, table_episodes.sonarrEpisodeId, table_episodes.sonarrSeriesId, table_shows.hearing_impaired FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.path = ? AND missing_subtitles != '[]'", (path_replace_reverse(path),)).fetchall() enabled_providers = c_db.execute("SELECT name FROM table_settings_providers WHERE enabled = 1").fetchall() diff --git a/init_db.py b/init_db.py index fab283f9a..0a70906d8 100644 --- a/init_db.py +++ b/init_db.py @@ -2,7 +2,7 @@ import os.path import sqlite3
# Check if database exist
-if os.path.exists('bazarr.db') == True:
+if os.path.exists('data/db/bazarr.db') == True:
pass
else:
# Get SQL script from file
@@ -10,7 +10,7 @@ else: script = fd.read()
# Open database connection
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Execute script and commit change to database
diff --git a/list_subtitles.py b/list_subtitles.py index e4b64b3cd..a0dceb1a1 100644 --- a/list_subtitles.py +++ b/list_subtitles.py @@ -49,7 +49,7 @@ def store_subtitles(file): except:
pass
- conn_db = sqlite3.connect('bazarr.db')
+ conn_db = sqlite3.connect('data/db/bazarr.db')
c_db = conn_db.cursor()
subtitles = core.search_external_subtitles(file)
@@ -71,7 +71,7 @@ def list_missing_subtitles(*no): query_string = " WHERE table_episodes.sonarrSeriesId = " + str(no[0])
except:
pass
- conn_db = sqlite3.connect('bazarr.db')
+ conn_db = sqlite3.connect('data/db/bazarr.db')
c_db = conn_db.cursor()
episodes_subtitles = c_db.execute("SELECT table_episodes.sonarrEpisodeId, table_episodes.subtitles, table_shows.languages FROM table_episodes INNER JOIN table_shows on table_episodes.sonarrSeriesId = table_shows.sonarrSeriesId" + query_string).fetchall()
@@ -100,7 +100,7 @@ def list_missing_subtitles(*no): c_db.close()
def full_scan_subtitles():
- conn_db = sqlite3.connect('bazarr.db')
+ conn_db = sqlite3.connect('data/db/bazarr.db')
c_db = conn_db.cursor()
episodes = c_db.execute("SELECT path FROM table_episodes").fetchall()
c_db.close()
@@ -109,7 +109,7 @@ def full_scan_subtitles(): store_subtitles(path_replace(episode[0]))
def series_scan_subtitles(no):
- conn_db = sqlite3.connect('bazarr.db')
+ conn_db = sqlite3.connect('data/db/bazarr.db')
c_db = conn_db.cursor()
episodes = c_db.execute("SELECT path FROM table_episodes WHERE sonarrSeriesId = ?", (no,)).fetchall()
c_db.close()
@@ -120,7 +120,7 @@ def series_scan_subtitles(no): list_missing_subtitles(no)
def new_scan_subtitles():
- conn_db = sqlite3.connect('bazarr.db')
+ conn_db = sqlite3.connect('data/db/bazarr.db')
c_db = conn_db.cursor()
episodes = c_db.execute("SELECT path FROM table_episodes WHERE subtitles is null").fetchall()
c_db.close()
@@ -3,7 +3,7 @@ import time def history_log(action, sonarrSeriesId, sonarrEpisodeId, description):
# Open database connection
- db = sqlite3.connect('bazarr.db')
+ db = sqlite3.connect('data/db/bazarr.db')
c = db.cursor()
# Get Sonarr API URL from database config table
|