Checks requirement versions to print a message if one needs to be updated

This commit is contained in:
meisnate12 2024-05-03 13:38:36 -04:00
parent 815f1fe43f
commit 8e52a84293
2 changed files with 25 additions and 17 deletions

View file

@ -3,19 +3,12 @@
# Removed Features
# New Features
Added `overlay_artwork_filetype` and `overlay_artwork_quality` settings to control the filetype and quality of overlay images. Users can select from JPG, PNG and WEBP.
Checks requirement versions to print a message if one needs to be updated
# Updates
# Defaults
Added `starting_only` template variable to the `mal` Collection Default.
Changed streaming defaults to use names as their keys vs their TMDb IDs as keys
Fixed `amazon` ID in `streaming` when region is `CA`
# Bug Fixes
Catch bad ID data from Plex
Fixes `- git` file calls
Ignore empty Environment Variables
Fixes collections being deleted under certain conditions when using translations
Various other Minor Fixes

View file

@ -9,8 +9,8 @@ if sys.version_info[0] != 3 or sys.version_info[1] < 8:
sys.exit(0)
try:
import plexapi, psutil, requests, schedule
from dotenv import load_dotenv
import arrapi, git, lxml, pathvalidate, PIL, plexapi, psutil, dateutil, requests, ruamel.yaml, schedule, setuptools, tmdbapis
from dotenv import load_dotenv, version as dotenv_version
from PIL import ImageFile
from plexapi import server
from plexapi.exceptions import NotFound
@ -19,6 +19,22 @@ except (ModuleNotFoundError, ImportError):
print("Requirements Error: Requirements are not installed")
sys.exit(0)
system_versions = {
"arrapi": arrapi.__version__,
"GitPython": git.__version__,
"lxml": lxml.__version__,
"pathvalidate": pathvalidate.__version__,
"pillow": PIL.__version__,
"PlexAPI": plexapi.__version__,
"psutil": psutil.__version__,
"python-dotenv": dotenv_version.__version__,
"python-dateutil": dateutil.__version__, # noqa
"requests": requests.__version__,
"ruamel.yaml": ruamel.yaml.__version__,
"setuptools": setuptools.__version__,
"tmdbapis": tmdbapis.__version__
}
default_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config")
load_dotenv(os.path.join(default_dir, ".env"))
@ -257,18 +273,17 @@ def start(attrs):
new_version = latest_version[0] if latest_version and (version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2])) else None
if new_version:
logger.info(f" Newest Version: {new_version}")
required_version = None
logger.info(f" Platform: {platform.platform()}")
logger.info(f" Memory: {round(psutil.virtual_memory().total / (1024.0 ** 3))} GB")
if not is_docker and not is_linuxserver:
try:
with open(os.path.abspath(os.path.join(os.path.dirname(__file__), "requirements.txt")), "r") as file:
required_version = next(ln.strip()[9:] for ln in file.readlines() if ln.strip().startswith("PlexAPI=="))
required_versions = {ln.split("==")[0]: ln.split("==")[1].strip() for ln in file.readlines()}
for req_name, sys_ver in system_versions.items():
if sys_ver != required_versions[req_name]:
logger.info(f" {req_name} version: {sys_ver} requires an update to: {required_versions[req_name]}")
except FileNotFoundError:
logger.error(" File Error: requirements.txt not found")
logger.info(f" PlexAPI Version: {plexapi.VERSION}")
if required_version is not None and required_version != plexapi.VERSION:
logger.info(f" PlexAPI Requires an Update to Version: {required_version}")
logger.info(f" Platform: {platform.platform()}")
logger.info(f" Memory: {round(psutil.virtual_memory().total / (1024.0 ** 3))} GB")
if "time" in attrs and attrs["time"]: start_type = f"{attrs['time']} "
elif run_args["tests"]: start_type = "Test "
elif "collections" in attrs and attrs["collections"]: start_type = "Collections "