Skip to content

Commit

Permalink
Added database type, version and migration to System-->Status page.
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Sep 27, 2024
1 parent 25098e5 commit 6297b4b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bazarr/api/system/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

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
Expand All @@ -34,13 +36,25 @@ def get(self):
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})
system_status.update({'sonarr_version': get_sonarr_info.version()})
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})
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/System/Status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/types/system.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6297b4b

Please sign in to comment.