summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bazarr/app/announcements.py10
-rw-r--r--bazarr/app/check_update.py25
2 files changed, 32 insertions, 3 deletions
diff --git a/bazarr/app/announcements.py b/bazarr/app/announcements.py
index 755c8d157..6ede24bbe 100644
--- a/bazarr/app/announcements.py
+++ b/bazarr/app/announcements.py
@@ -15,6 +15,7 @@ from app.database import TableAnnouncements, database, insert, select
from .get_args import args
from sonarr.info import get_sonarr_info
from radarr.info import get_radarr_info
+from app.check_update import deprecated_python_version
# Announcements as receive by browser must be in the form of a list of dicts converted to JSON
@@ -104,6 +105,15 @@ def get_local_announcements():
'timestamp': 1679606309,
})
+ # deprecated Python versions
+ if deprecated_python_version:
+ announcements.append({
+ 'text': 'Starting with Bazarr 1.4, support for Python 3.7 will get dropped. Upgrade your current version of'
+ ' Python ASAP to get further updates.',
+ 'dismissible': False,
+ 'timestamp': 1691162383,
+ })
+
for announcement in announcements:
if 'enabled' not in announcement:
announcement['enabled'] = True
diff --git a/bazarr/app/check_update.py b/bazarr/app/check_update.py
index 63a8b7429..3283daa8e 100644
--- a/bazarr/app/check_update.py
+++ b/bazarr/app/check_update.py
@@ -6,6 +6,7 @@ import logging
import json
import requests
import semver
+import sys
from shutil import rmtree
from zipfile import ZipFile
@@ -14,6 +15,11 @@ from .get_args import args
from .config import settings
+def deprecated_python_version():
+ # return True if Python version is deprecated
+ return sys.version_info.major == 2 or (sys.version_info.major == 3 and sys.version_info.minor < 8)
+
+
def check_releases():
releases = []
url_releases = 'https://api.github.com/repos/morpheus65535/Bazarr/releases?per_page=100'
@@ -62,13 +68,26 @@ def check_if_new_update():
with open(os.path.join(args.config_dir, 'config', 'releases.txt'), 'r') as f:
data = json.load(f)
if not args.no_update:
+ release = None
if use_prerelease:
- release = next((item for item in data), None)
+ if deprecated_python_version:
+ release = next((item['name'].lstrip('v') for item in data if
+ semver.VersionInfo.parse('1.3.1') > semver.VersionInfo.parse(item['name'].lstrip('v'))))
+ else:
+ release = next((item for item in data), None)
else:
- release = next((item for item in data if not item["prerelease"]), None)
+ if deprecated_python_version:
+ next((item['name'].lstrip('v') for item in data if
+ not item['prerelease'] and semver.VersionInfo.parse('1.3.1') > semver.VersionInfo.parse(
+ item['name'].lstrip('v'))))
+ else:
+ release = next((item for item in data if not item["prerelease"]), None)
- if release:
+ if release and 'name' in release:
logging.debug('BAZARR last release available is {}'.format(release['name']))
+ if deprecated_python_version:
+ logging.warning('BAZARR is using a deprecated Python version, you must update Python to get latest '
+ 'version available.')
current_version = None
try: