From 7e0c298dd7d1b2bcf0d720c0554fa3cdaf8a02d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 18 May 2020 08:21:16 -0400 Subject: [PATCH] WIP --- bazarr/api.py | 5 +---- bazarr/get_subtitle.py | 1 - bazarr/list_subtitles.py | 2 -- bazarr/main.py | 4 ---- bazarr/scheduler.py | 7 ++++--- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/bazarr/api.py b/bazarr/api.py index 0cd7cddfb..6ddcc39b9 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -2,7 +2,6 @@ import os import ast -import libs from datetime import timedelta import datetime import pretty @@ -31,7 +30,7 @@ from list_subtitles import store_subtitles, store_subtitles_movie, series_scan_s from utils import history_log, history_log_movie, get_sonarr_version, get_radarr_version from get_providers import get_providers, get_providers_auth, list_throttled_providers, reset_throttled_providers from event_handler import event_stream -from scheduler import Scheduler +from scheduler import scheduler from subliminal_patch.core import SUBTITLE_EXTENSIONS @@ -43,8 +42,6 @@ from functools import wraps api_bp = Blueprint('api', __name__, url_prefix=base_url.rstrip('/')+'/api') api = Api(api_bp) -scheduler = Scheduler() - def authenticate(actual_method): @wraps(actual_method) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 4b845bfc9..1d8d91984 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -18,7 +18,6 @@ from subliminal import region, score as subliminal_scores, \ from subliminal_patch.core import SZAsyncProviderPool, download_best_subtitles, save_subtitles, download_subtitles, \ list_all_subtitles, get_subtitle_path from subliminal_patch.score import compute_score -from subliminal.refiners.tvdb import series_re from get_languages import language_from_alpha3, alpha2_from_alpha3, alpha3_from_alpha2, language_from_alpha2, \ alpha2_from_language, alpha3_from_language from config import settings diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index dd44bd859..6ac17e482 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -5,12 +5,10 @@ import os import logging import ast from guess_language import guess_language -import subliminal import subliminal_patch from subliminal import core from subliminal_patch import search_external_subtitles from subzero.language import Language -import six from database import database from get_languages import alpha2_from_alpha3, get_language_set diff --git a/bazarr/main.py b/bazarr/main.py index 7b37f9bc3..68b26f4d3 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -3,7 +3,6 @@ bazarr_version = '0.9' import os -os.environ["SZ_USER_AGENT"] = "Bazarr/1" os.environ["BAZARR_VERSION"] = bazarr_version import gc @@ -34,13 +33,10 @@ from get_series import * from get_episodes import * from get_movies import * -from scheduler import Scheduler from check_update import check_and_apply_update from server import app, webserver from functools import wraps -scheduler = Scheduler() - # Check and install update on startup when running on Windows from installer if args.release_update: check_and_apply_update() diff --git a/bazarr/scheduler.py b/bazarr/scheduler.py index c1f48cfb7..b9477d84f 100644 --- a/bazarr/scheduler.py +++ b/bazarr/scheduler.py @@ -16,9 +16,7 @@ from apscheduler.triggers.interval import IntervalTrigger from apscheduler.triggers.cron import CronTrigger from apscheduler.triggers.date import DateTrigger from apscheduler.events import EVENT_JOB_SUBMITTED, EVENT_JOB_EXECUTED, EVENT_JOB_ERROR -from datetime import datetime, timedelta, date -import pytz -from tzlocal import get_localzone +from datetime import datetime, timedelta from calendar import day_name import pretty from random import randrange @@ -251,3 +249,6 @@ class Scheduler: def __no_task(self): for job in self.aps_scheduler.get_jobs(): self.aps_scheduler.modify_job(job.id, next_run_time=None) + + +scheduler = Scheduler()