Reformat code

pull/479/head
Halali 5 years ago
parent 78b819ef50
commit daa6d87e76

@ -1,7 +1,6 @@
# coding=utf-8
import subprocess as sp
import threading
import time
import os
import sys
@ -38,6 +37,7 @@ if __name__ == '__main__':
except:
pass
def daemon():
if os.path.exists(stopfile):
try:
@ -56,6 +56,7 @@ if __name__ == '__main__':
else:
start_bazarr()
start_bazarr()
# Keep the script running forever.

@ -65,7 +65,7 @@ def get_video(path, title, sceneName, use_scenename, providers=None, media_type=
video.used_scene_name = dont_use_actual_file
video.original_name = original_name
video.original_path = original_path
refine_from_db(original_path,video)
refine_from_db(original_path, video)
logging.debug('BAZARR is using those video object properties: %s', vars(video))
return video
@ -100,7 +100,8 @@ def get_scores(video, media_type, min_score_movie_perc=60 * 100 / 120.0, min_sco
return min_score, max_score, set(scores)
def download_subtitle(path, language, hi, forced, providers, providers_auth, sceneName, title, media_type, forced_minimum_score=None, is_upgrade=False):
def download_subtitle(path, language, hi, forced, providers, providers_auth, sceneName, title, media_type,
forced_minimum_score=None, is_upgrade=False):
# fixme: supply all missing languages, not only one, to hit providers only once who support multiple languages in
# one query
@ -187,7 +188,8 @@ def download_subtitle(path, language, hi, forced, providers, providers_auth, sce
try:
fld = get_target_folder(path)
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith('win') and settings.general.getboolean('chmod_enabled') else None
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith(
'win') and settings.general.getboolean('chmod_enabled') else None
saved_subtitles = save_subtitles(video.original_path, subtitles, single=single,
tags=None, # fixme
directory=fld,
@ -224,7 +226,8 @@ def download_subtitle(path, language, hi, forced, providers, providers_auth, sce
if use_postprocessing is True:
command = pp_replace(postprocessing_cmd, path, downloaded_path, downloaded_language,
downloaded_language_code2, downloaded_language_code3, subtitle.language.forced)
downloaded_language_code2, downloaded_language_code3,
subtitle.language.forced)
try:
if os.name == 'nt':
codepage = subprocess.Popen("chcp", shell=True, stdout=subprocess.PIPE,
@ -359,7 +362,8 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa
return final_subtitles
def manual_download_subtitle(path, language, hi, forced, subtitle, provider, providers_auth, sceneName, title, media_type):
def manual_download_subtitle(path, language, hi, forced, subtitle, provider, providers_auth, sceneName, title,
media_type):
logging.debug('BAZARR Manually downloading subtitles for this file: ' + path)
if settings.general.getboolean('utf8_encode'):
@ -394,7 +398,8 @@ def manual_download_subtitle(path, language, hi, forced, subtitle, provider, pro
try:
score = round(subtitle.score / max_score * 100, 2)
fld = get_target_folder(path)
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith('win') and settings.general.getboolean('chmod_enabled') else None
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith(
'win') and settings.general.getboolean('chmod_enabled') else None
saved_subtitles = save_subtitles(video.original_path, [subtitle], single=single,
tags=None, # fixme
directory=fld,
@ -423,7 +428,8 @@ def manual_download_subtitle(path, language, hi, forced, subtitle, provider, pro
if use_postprocessing is True:
command = pp_replace(postprocessing_cmd, path, downloaded_path, downloaded_language,
downloaded_language_code2, downloaded_language_code3, subtitle.language.forced)
downloaded_language_code2, downloaded_language_code3,
subtitle.language.forced)
try:
if os.name == 'nt':
codepage = subprocess.Popen("chcp", shell=True, stdout=subprocess.PIPE,
@ -490,7 +496,8 @@ def series_download_subtitles(no):
for i, episode in enumerate(episodes_details, 1):
for language in ast.literal_eval(episode[1]):
if language is not None:
notifications.write(msg='Searching for series subtitles...', queue='get_subtitle', item=i, length=count_episodes_details)
notifications.write(msg='Searching for series subtitles...', queue='get_subtitle', item=i,
length=count_episodes_details)
result = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(language)),
series_details[0], series_details[2], providers_list,
providers_auth, str(episode[3]), series_details[1], 'series')
@ -507,7 +514,8 @@ def series_download_subtitles(no):
list_missing_subtitles(no)
if count_episodes_details:
notifications.write(msg='Searching completed. Please reload the page.', type='success', duration='permanent', button='refresh', queue='get_subtitle')
notifications.write(msg='Searching completed. Please reload the page.', type='success', duration='permanent',
button='refresh', queue='get_subtitle')
def episode_download_subtitles(no):
@ -519,7 +527,8 @@ def episode_download_subtitles(no):
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c_db = conn_db.cursor()
episodes_details = c_db.execute(
'SELECT table_episodes.path, table_episodes.missing_subtitles, table_episodes.sonarrEpisodeId, table_episodes.scene_name, table_shows.hearing_impaired, table_shows.title, table_shows.sonarrSeriesId, table_shows.forced FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.sonarrEpisodeId = ?' + monitored_only_query_string, (no,)).fetchall()
'SELECT table_episodes.path, table_episodes.missing_subtitles, table_episodes.sonarrEpisodeId, table_episodes.scene_name, table_shows.hearing_impaired, table_shows.title, table_shows.sonarrSeriesId, table_shows.forced FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.sonarrEpisodeId = ?' + monitored_only_query_string,
(no,)).fetchall()
c_db.close()
providers_list = get_providers()
@ -579,7 +588,8 @@ def movies_download_subtitles(no):
list_missing_subtitles_movies(no)
if count_movie:
notifications.write(msg='Searching completed. Please reload the page.', type='success', duration='permanent', button='refresh', queue='get_subtitle')
notifications.write(msg='Searching completed. Please reload the page.', type='success', duration='permanent',
button='refresh', queue='get_subtitle')
def wanted_download_subtitles(path, l, count_episodes):
@ -617,7 +627,8 @@ def wanted_download_subtitles(path, l, count_episodes):
if attempt[i][0] == language:
language = language.split(':')[0]
if search_active(attempt[i][1]):
notifications.write(msg='Searching for series subtitles...', queue='get_subtitle', item=l, length=count_episodes)
notifications.write(msg='Searching for series subtitles...', queue='get_subtitle', item=l,
length=count_episodes)
result = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(language)),
episode[4], episode[8], providers_list, providers_auth,
str(episode[5]), episode[7], 'series')
@ -671,7 +682,8 @@ def wanted_download_subtitles_movie(path, l, count_movies):
if attempt[i][0] == language:
language = language.split(':')[0]
if search_active(attempt[i][1]) is True:
notifications.write(msg='Searching for movies subtitles...', queue='get_subtitle', item=l, length=count_movies)
notifications.write(msg='Searching for movies subtitles...', queue='get_subtitle', item=l,
length=count_movies)
result = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(language)),
movie[4], movie[8], providers_list, providers_auth, str(movie[5]),
movie[7], 'movie')
@ -719,7 +731,7 @@ def wanted_search_missing_subtitles():
providers = get_providers()
if settings.general.getboolean('use_sonarr'):
if providers:
count_episodes= len(episodes)
count_episodes = len(episodes)
for i, episode in enumerate(episodes, 1):
wanted_download_subtitles(episode[0], i, count_episodes)
else:
@ -737,7 +749,8 @@ def wanted_search_missing_subtitles():
logging.info('BAZARR Finished searching for missing subtitles. Check histories for more information.')
notifications.write(msg='Searching completed. Please reload the page.', type='success', duration='permanent', button='refresh', queue='get_subtitle')
notifications.write(msg='Searching completed. Please reload the page.', type='success', duration='permanent',
button='refresh', queue='get_subtitle')
def search_active(timestamp):
@ -763,7 +776,9 @@ def refine_from_db(path, video):
if isinstance(video, Episode):
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
data = c.execute("SELECT table_shows.title, table_episodes.season, table_episodes.episode, table_episodes.title, table_shows.year, table_shows.tvdbId, table_shows.alternateTitles, table_episodes.format, table_episodes.resolution, table_episodes.video_codec, table_episodes.audio_codec FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.path = ?", (unicode(path_replace_reverse(path)),)).fetchone()
data = c.execute(
"SELECT table_shows.title, table_episodes.season, table_episodes.episode, table_episodes.title, table_shows.year, table_shows.tvdbId, table_shows.alternateTitles, table_episodes.format, table_episodes.resolution, table_episodes.video_codec, table_episodes.audio_codec FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.path = ?",
(unicode(path_replace_reverse(path)),)).fetchone()
db.close()
if data:
video.series, year, country = series_re.match(data[0]).groups()
@ -785,10 +800,12 @@ def refine_from_db(path, video):
elif isinstance(video, Movie):
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
data = c.execute("SELECT title, year, alternativeTitles, format, resolution, video_codec, audio_codec, imdbId FROM table_movies WHERE path = ?", (unicode(path_replace_reverse_movie(path)),)).fetchone()
data = c.execute(
"SELECT title, year, alternativeTitles, format, resolution, video_codec, audio_codec, imdbId FROM table_movies WHERE path = ?",
(unicode(path_replace_reverse_movie(path)),)).fetchone()
db.close()
if data:
video.title = re.sub(r'(\(\d\d\d\d\))' , '', data[0])
video.title = re.sub(r'(\(\d\d\d\d\))', '', data[0])
if data[1]:
if int(data[1]) > 0: video.year = int(data[1])
if data[7]: video.imdb_id = data[7]

@ -4,7 +4,6 @@ import os
import re
import types
import logging
import sqlite3
import chardet
from bs4 import UnicodeDammit

@ -22,7 +22,8 @@ if settings.general.anti_captcha_provider == 'anti-captcha' and settings.anticap
os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = settings.anticaptcha.anti_captcha_key
elif settings.general.anti_captcha_provider == 'death-by-captcha' and settings.deathbycaptcha.username != "" and settings.deathbycaptcha.password != "":
os.environ["ANTICAPTCHA_CLASS"] = 'DeathByCaptchaProxyLess'
os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = ':'.join({settings.deathbycaptcha.username, settings.deathbycaptcha.password})
os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = ':'.join(
{settings.deathbycaptcha.username, settings.deathbycaptcha.password})
else:
os.environ["ANTICAPTCHA_CLASS"] = ''
@ -183,4 +184,5 @@ def init_binaries():
return unrar
init_binaries()

@ -1,7 +1,7 @@
# coding=utf-8
import sys
import os
import sys
def set_libs():

@ -47,7 +47,8 @@ def store_subtitles(file):
logging.debug("BAZARR unable to index this unrecognized language: " + subtitle_language)
pass
except Exception as e:
logging.exception("BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(file)[1], file))
logging.exception(
"BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(file)[1], file))
pass
brazilian_portuguese = [".pt-br", ".pob", "pb"]
@ -136,7 +137,8 @@ def store_subtitles_movie(file):
logging.debug("BAZARR unable to index this unrecognized language: " + subtitle_language)
pass
except Exception as e:
logging.exception("BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(file)[1], file))
logging.exception(
"BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(file)[1], file))
pass
dest_folder = get_subtitle_destination_folder() or ''
@ -154,19 +156,23 @@ def store_subtitles_movie(file):
if str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese)) is True:
logging.debug("BAZARR external subtitles detected: " + "pb")
actual_subtitles.append(
[str("pb"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
[str("pb"),
path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
elif str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese_forced)) is True:
logging.debug("BAZARR external subtitles detected: " + "pb:forced")
actual_subtitles.append(
[str("pb:forced"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
[str("pb:forced"),
path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
elif str(language) != 'und':
logging.debug("BAZARR external subtitles detected: " + str(language))
actual_subtitles.append(
[str(language), path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
[str(language),
path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
else:
if os.path.splitext(subtitle)[1] != ".sub":
logging.debug("BAZARR falling back to file content analysis to detect language.")
with open(path_replace_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle)), 'r') as f:
with open(path_replace_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle)),
'r') as f:
text = list(islice(f, 100))
text = ' '.join(text)
encoding = UnicodeDammit(text)
@ -270,7 +276,8 @@ def list_missing_subtitles_movies(*no):
pass
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c_db = conn_db.cursor()
movies_subtitles = c_db.execute("SELECT radarrId, subtitles, languages, forced FROM table_movies" + query_string).fetchall()
movies_subtitles = c_db.execute(
"SELECT radarrId, subtitles, languages, forced FROM table_movies" + query_string).fetchall()
c_db.close()
missing_subtitles_global = []

@ -94,7 +94,6 @@ def configure_logging(debug=False):
logging.getLogger("geventwebsocket.handler").setLevel(logging.WARNING)
class MyFilter(logging.Filter):
def __init__(self):
super(MyFilter, self).__init__()

@ -17,7 +17,6 @@ import warnings
import queueconfig
import platform
import apprise
import re
from get_args import args
from init import *
@ -31,10 +30,12 @@ try:
import gevent
except ImportError:
import logging
logging.exception('BAZARR require gevent Python module to be installed using pip.')
try:
import os
from get_args import args
stop_file = open(os.path.join(args.config_dir, "bazarr.stop"), "w")
except Exception as e:
logging.error('BAZARR Cannot create bazarr.stop file.')
@ -43,7 +44,6 @@ except ImportError:
stop_file.close()
os._exit(0)
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
@ -51,8 +51,8 @@ from io import BytesIO
from six import text_type
from beaker.middleware import SessionMiddleware
from cork import Cork
from bottle import route, run, template, static_file, request, redirect, response, HTTPError, app, hook, abort
from datetime import datetime, timedelta
from bottle import route, template, static_file, request, redirect, response, HTTPError, app, hook
from datetime import timedelta
from get_languages import load_language_in_db, language_from_alpha3
from get_providers import get_providers, get_providers_auth, list_throttled_providers
from get_series import *
@ -61,12 +61,12 @@ from get_episodes import *
from list_subtitles import store_subtitles, store_subtitles_movie, series_scan_subtitles, movies_scan_subtitles, \
list_missing_subtitles, list_missing_subtitles_movies
from get_subtitle import download_subtitle, series_download_subtitles, movies_download_subtitles, \
wanted_download_subtitles, wanted_search_missing_subtitles, manual_search, manual_download_subtitle, upgrade_subtitles
manual_search, manual_download_subtitle
from utils import history_log, history_log_movie
from scheduler import *
from notifier import send_notifications, send_notifications_movie
from config import settings, url_sonarr, url_radarr, url_radarr_short, url_sonarr_short, base_url
from helper import path_replace_movie, get_subtitle_destination_folder
from helper import path_replace_movie
from subliminal_patch.extensions import provider_registry as provider_manager
reload(sys)
@ -614,13 +614,16 @@ def search_json(query):
('%' + query + '%',))
series = c.fetchall()
for serie in series:
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', serie[0]) + ' (' + serie[2] + ')'), ('url', base_url + 'episodes/' + str(serie[1]))]))
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', serie[0]) + ' (' + serie[2] + ')'),
('url', base_url + 'episodes/' + str(serie[1]))]))
if settings.general.getboolean('use_radarr'):
c.execute("SELECT title, radarrId, year FROM table_movies WHERE title LIKE ? ORDER BY title", ('%' + query + '%',))
c.execute("SELECT title, radarrId, year FROM table_movies WHERE title LIKE ? ORDER BY title",
('%' + query + '%',))
movies = c.fetchall()
for movie in movies:
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', movie[0]) + ' (' + movie[2] + ')'), ('url', base_url + 'movie/' + str(movie[1]))]))
search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', movie[0]) + ' (' + movie[2] + ')'),
('url', base_url + 'movie/' + str(movie[1]))]))
c.close()
response.content_type = 'application/json'
@ -864,7 +867,8 @@ def edit_movie(no):
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = conn.cursor()
c.execute("UPDATE table_movies SET languages = ?, hearing_impaired = ?, forced = ? WHERE radarrId LIKE ?", (str(lang), hi, forced, no))
c.execute("UPDATE table_movies SET languages = ?, hearing_impaired = ?, forced = ? WHERE radarrId LIKE ?",
(str(lang), hi, forced, no))
conn.commit()
c.close()
@ -877,7 +881,6 @@ def edit_movie(no):
@custom_auth_basic(check_credentials)
def movie(no):
authorize()
# single_language = settings.general.getboolean('single_language')
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
conn.create_function("path_substitution", 1, path_replace_movie)
@ -1598,7 +1601,6 @@ def save_settings():
logging.info('BAZARR Settings saved succesfully.')
if ref.find('saved=true') > 0:
redirect(ref)
else:
@ -1712,7 +1714,8 @@ def system():
releases = ast.literal_eval(f.read())
except Exception as e:
releases = []
logging.exception('BAZARR cannot parse releases caching file: ' + os.path.join(args.config_dir, 'config', 'releases.txt'))
logging.exception(
'BAZARR cannot parse releases caching file: ' + os.path.join(args.config_dir, 'config', 'releases.txt'))
use_sonarr = settings.general.getboolean('use_sonarr')
apikey_sonarr = settings.sonarr.apikey
@ -1821,7 +1824,6 @@ def get_subtitle():
sonarrSeriesId = request.forms.get('sonarrSeriesId')
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
title = request.forms.get('title')
# tvdbid = request.forms.get('tvdbid')
providers_list = get_providers()
providers_auth = get_providers_auth()
@ -1881,11 +1883,11 @@ def manual_get_subtitle():
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
title = request.forms.get('title')
providers_list = get_providers()
providers_auth = get_providers_auth()
try:
result = manual_download_subtitle(episodePath, language, hi, forced, subtitle, selected_provider, providers_auth,
result = manual_download_subtitle(episodePath, language, hi, forced, subtitle, selected_provider,
providers_auth,
sceneName, title, 'series')
if result is not None:
message = result[0]
@ -1915,14 +1917,14 @@ def get_subtitle_movie():
hi = request.forms.get('hi')
forced = request.forms.get('forced')
radarrId = request.forms.get('radarrId')
# tmdbid = request.forms.get('tmdbid')
title = request.forms.get('title')
providers_list = get_providers()
providers_auth = get_providers_auth()
try:
result = download_subtitle(moviePath, language, hi, forced, providers_list, providers_auth, sceneName, title, 'movie')
result = download_subtitle(moviePath, language, hi, forced, providers_list, providers_auth, sceneName, title,
'movie')
if result is not None:
message = result[0]
path = result[1]
@ -1943,7 +1945,6 @@ def get_subtitle_movie():
@custom_auth_basic(check_credentials)
def manual_search_movie_json():
authorize()
ref = request.environ['HTTP_REFERER']
moviePath = request.forms.get('moviePath')
sceneName = request.forms.get('sceneName')
@ -1975,7 +1976,6 @@ def manual_get_subtitle_movie():
radarrId = request.forms.get('radarrId')
title = request.forms.get('title')
providers_list = get_providers()
providers_auth = get_providers_auth()
try:
@ -2084,9 +2084,11 @@ def notifications():
def running_tasks_list():
return dict(tasks=running_tasks)
# Mute DeprecationWarning
warnings.simplefilter("ignore", DeprecationWarning)
server = WSGIServer((str(settings.general.ip), (int(args.port) if args.port else int(settings.general.port))), app, handler_class=WebSocketHandler)
server = WSGIServer((str(settings.general.ip), (int(args.port) if args.port else int(settings.general.port))), app,
handler_class=WebSocketHandler)
try:
logging.info('BAZARR is started and waiting for request on http://' + str(settings.general.ip) + ':' + (str(
args.port) if args.port else str(settings.general.port)) + str(base_url))

@ -67,7 +67,6 @@ if str(get_localzone()) == "local":
else:
scheduler = BackgroundScheduler()
global running_tasks
running_tasks = []
@ -81,19 +80,25 @@ def task_listener(event):
scheduler.add_listener(task_listener, EVENT_JOB_SUBMITTED | EVENT_JOB_EXECUTED)
def schedule_update_job():
if not args.no_update:
if settings.general.getboolean('auto_update'):
scheduler.add_job(check_and_apply_update, IntervalTrigger(hours=6), max_instances=1, coalesce=True,
misfire_grace_time=15, id='update_bazarr', name='Update bazarr from source on Github' if not args.release_update else 'Update bazarr from release on Github', replace_existing=True)
misfire_grace_time=15, id='update_bazarr',
name='Update bazarr from source on Github' if not args.release_update else 'Update bazarr from release on Github',
replace_existing=True)
else:
scheduler.add_job(check_and_apply_update, CronTrigger(year='2100'), hour=4, id='update_bazarr',
name='Update bazarr from source on Github' if not args.release_update else 'Update bazarr from release on Github', replace_existing=True)
name='Update bazarr from source on Github' if not args.release_update else 'Update bazarr from release on Github',
replace_existing=True)
scheduler.add_job(check_releases, IntervalTrigger(hours=6), max_instances=1, coalesce=True,
misfire_grace_time=15, id='update_release', name='Update release info', replace_existing=True)
misfire_grace_time=15, id='update_release', name='Update release info',
replace_existing=True)
else:
scheduler.add_job(check_releases, IntervalTrigger(hours=6), max_instances=1, coalesce=True, misfire_grace_time=15,
scheduler.add_job(check_releases, IntervalTrigger(hours=6), max_instances=1, coalesce=True,
misfire_grace_time=15,
id='update_release', name='Update release info', replace_existing=True)
@ -123,7 +128,6 @@ scheduler.start()
def add_job(job, name=None, max_instances=1, coalesce=True, args=None):
scheduler.add_job(job, DateTrigger(run_date=datetime.now()), name=name, id=name, max_instances=max_instances,
coalesce=coalesce, args=args)

@ -9,7 +9,8 @@ from whichcraft import which
from get_args import args
def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path=None, language=None, provider=None, score=None, forced=False):
def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path=None, language=None, provider=None,
score=None, forced=False):
# Open database connection
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
@ -29,7 +30,8 @@ def history_log(action, sonarrSeriesId, sonarrEpisodeId, description, video_path
db.close()
def history_log_movie(action, radarrId, description, video_path=None, language=None, provider=None, score=None, forced=False):
def history_log_movie(action, radarrId, description, video_path=None, language=None, provider=None, score=None,
forced=False):
# Open database connection
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
@ -47,6 +49,7 @@ def history_log_movie(action, radarrId, description, video_path=None, language=N
# Close database connection
db.close()
def get_binary(name):
binaries_dir = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'bin'))

Loading…
Cancel
Save