diff options
author | morpheus65535 <[email protected]> | 2024-09-26 21:49:38 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2024-09-26 21:49:38 -0400 |
commit | 6297b4b83cbae86cfefb31eb8455fb2a1e83bedf (patch) | |
tree | 7e9671cd8796c620e9b17e96673344c0c4776891 | |
parent | 25098e5e07533f9eea9602d6a37380aa68a86bbb (diff) | |
download | bazarr-6297b4b83cbae86cfefb31eb8455fb2a1e83bedf.tar.gz bazarr-6297b4b83cbae86cfefb31eb8455fb2a1e83bedf.zip |
Added database type, version and migration to System-->Status page.
-rw-r--r-- | bazarr/api/system/status.py | 14 | ||||
-rw-r--r-- | frontend/src/pages/System/Status/index.tsx | 2 | ||||
-rw-r--r-- | frontend/src/types/system.d.ts | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/bazarr/api/system/status.py b/bazarr/api/system/status.py index 325f2fb61..cbc54949d 100644 --- a/bazarr/api/system/status.py +++ b/bazarr/api/system/status.py @@ -6,10 +6,12 @@ import logging from flask_restx import Resource, Namespace from tzlocal import get_localzone_name +from alembic.migration import MigrationContext from radarr.info import get_radarr_info from sonarr.info import get_sonarr_info from app.get_args import args +from app.database import engine, database, select from init import startTime from ..utils import authenticate @@ -34,6 +36,16 @@ class SystemStatus(Resource): timezone = "Exception while getting time zone name." logging.exception("BAZARR is unable to get configured time zone name.") + try: + database_version = ".".join([str(x) for x in engine.dialect.server_version_info]) + except Exception: + database_version = "" + + try: + database_migration = MigrationContext.configure(engine.connect()).get_current_revision() + except Exception: + database_migration = "unknown" + system_status = {} system_status.update({'bazarr_version': os.environ["BAZARR_VERSION"]}) system_status.update({'package_version': package_version}) @@ -41,6 +53,8 @@ class SystemStatus(Resource): system_status.update({'radarr_version': get_radarr_info.version()}) system_status.update({'operating_system': platform.platform()}) system_status.update({'python_version': platform.python_version()}) + system_status.update({'database_engine': f'{engine.dialect.name.capitalize()} {database_version}'}) + system_status.update({'database_migration': database_migration}) system_status.update({'bazarr_directory': os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(__file__))))}) system_status.update({'bazarr_config_directory': args.config_dir}) diff --git a/frontend/src/pages/System/Status/index.tsx b/frontend/src/pages/System/Status/index.tsx index bcd0e175d..157935dfb 100644 --- a/frontend/src/pages/System/Status/index.tsx +++ b/frontend/src/pages/System/Status/index.tsx @@ -144,6 +144,8 @@ const SystemStatusView: FunctionComponent = () => { <Row title="Radarr Version">{status?.radarr_version}</Row> <Row title="Operating System">{status?.operating_system}</Row> <Row title="Python Version">{status?.python_version}</Row> + <Row title="Database Engine">{status?.database_engine}</Row> + <Row title="Database Version">{status?.database_migration}</Row> <Row title="Bazarr Directory">{status?.bazarr_directory}</Row> <Row title="Bazarr Config Directory"> {status?.bazarr_config_directory} diff --git a/frontend/src/types/system.d.ts b/frontend/src/types/system.d.ts index 544d969ae..5a477fb54 100644 --- a/frontend/src/types/system.d.ts +++ b/frontend/src/types/system.d.ts @@ -20,6 +20,8 @@ declare namespace System { bazarr_config_directory: string; bazarr_directory: string; bazarr_version: string; + database_engine: string; + database_migration: string; operating_system: string; package_version: string; python_version: string; |