2019-01-26 21:12:19 +00:00
|
|
|
# coding=utf-8
|
2018-10-03 10:53:22 +00:00
|
|
|
|
2019-10-28 20:16:33 +00:00
|
|
|
import os
|
2020-10-18 15:25:14 +00:00
|
|
|
|
2022-09-22 21:16:18 +00:00
|
|
|
from threading import Thread
|
|
|
|
|
2021-04-05 14:09:55 +00:00
|
|
|
bazarr_version = 'unknown'
|
2021-02-26 15:57:47 +00:00
|
|
|
|
|
|
|
version_file = os.path.join(os.path.dirname(__file__), '..', 'VERSION')
|
|
|
|
if os.path.isfile(version_file):
|
|
|
|
with open(version_file, 'r') as f:
|
2021-04-05 14:09:55 +00:00
|
|
|
bazarr_version = f.readline()
|
|
|
|
bazarr_version = bazarr_version.rstrip('\n')
|
2021-02-26 15:57:47 +00:00
|
|
|
|
2021-05-11 03:00:47 +00:00
|
|
|
os.environ["BAZARR_VERSION"] = bazarr_version.lstrip('v')
|
2019-09-18 15:30:46 +00:00
|
|
|
|
2022-05-01 12:00:20 +00:00
|
|
|
import app.libs # noqa W0611
|
2019-02-24 03:21:40 +00:00
|
|
|
|
2022-05-01 12:00:20 +00:00
|
|
|
from app.get_args import args # noqa E402
|
2022-09-22 21:16:18 +00:00
|
|
|
from app.check_update import apply_update, check_releases, check_if_new_update # noqa E402
|
2022-05-01 12:00:20 +00:00
|
|
|
from app.config import settings, configure_proxy_func, base_url # noqa E402
|
2022-09-22 21:22:55 +00:00
|
|
|
from init import * # noqa E402
|
2022-09-22 21:16:18 +00:00
|
|
|
|
|
|
|
# Install downloaded update
|
|
|
|
if bazarr_version != '':
|
|
|
|
apply_update()
|
|
|
|
|
|
|
|
# Check for new update and install latest
|
|
|
|
if args.no_update or not settings.general.getboolean('auto_update'):
|
|
|
|
# user have explicitly requested that we do not update or is using some kind of package/docker that prevent it
|
|
|
|
check_releases()
|
|
|
|
else:
|
|
|
|
# we want to update to the latest version before loading too much stuff. This should prevent deadlock when
|
|
|
|
# there's missing embedded packages after a commit
|
|
|
|
check_if_new_update()
|
|
|
|
|
2022-05-01 12:00:20 +00:00
|
|
|
from app.database import System # noqa E402
|
|
|
|
from app.notifier import update_notifier # noqa E402
|
|
|
|
from languages.get_languages import load_language_in_db # noqa E402
|
|
|
|
from app.signalr_client import sonarr_signalr_client, radarr_signalr_client # noqa E402
|
2022-06-10 01:02:40 +00:00
|
|
|
from app.server import webserver # noqa E402
|
2023-02-20 21:04:09 +00:00
|
|
|
from app.announcements import get_announcements_to_file # noqa E402
|
2018-10-03 10:53:22 +00:00
|
|
|
|
2020-05-08 04:22:14 +00:00
|
|
|
configure_proxy_func()
|
2018-10-03 10:53:22 +00:00
|
|
|
|
2023-02-20 21:04:09 +00:00
|
|
|
get_announcements_to_file()
|
|
|
|
|
2021-02-26 15:57:47 +00:00
|
|
|
# Reset the updated once Bazarr have been restarted after an update
|
2021-05-26 20:47:14 +00:00
|
|
|
System.update({System.updated: '0'}).execute()
|
2018-10-03 10:53:22 +00:00
|
|
|
|
|
|
|
# Load languages in database
|
|
|
|
load_language_in_db()
|
|
|
|
|
2018-12-15 00:36:28 +00:00
|
|
|
login_auth = settings.auth.type
|
2018-10-03 10:53:22 +00:00
|
|
|
|
2019-08-09 00:39:30 +00:00
|
|
|
update_notifier()
|
|
|
|
|
2022-11-24 18:53:22 +00:00
|
|
|
if not args.no_signalr:
|
|
|
|
if settings.general.getboolean('use_sonarr'):
|
|
|
|
Thread(target=sonarr_signalr_client.start).start()
|
|
|
|
if settings.general.getboolean('use_radarr'):
|
|
|
|
Thread(target=radarr_signalr_client.start).start()
|
2021-05-08 14:39:00 +00:00
|
|
|
|
|
|
|
|
2020-04-16 11:52:35 +00:00
|
|
|
if __name__ == "__main__":
|
2020-05-18 01:51:16 +00:00
|
|
|
webserver.start()
|