mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-19 12:24:59 -04:00
Added languages profile creation and assignment to health check.
This commit is contained in:
parent
c8e2894b2b
commit
43d9d43224
1 changed files with 19 additions and 1 deletions
|
@ -2,8 +2,11 @@
|
|||
|
||||
import json
|
||||
|
||||
from sqlalchemy import func
|
||||
|
||||
from app.config import settings
|
||||
from app.database import TableShowsRootfolder, TableMoviesRootfolder, TableLanguagesProfiles, database, select
|
||||
from app.database import (TableShowsRootfolder, TableMoviesRootfolder, TableLanguagesProfiles, database, select,
|
||||
TableShows, TableMovies)
|
||||
from app.event_handler import event_stream
|
||||
from .path_mappings import path_mappings
|
||||
from sonarr.rootfolder import check_sonarr_rootfolder
|
||||
|
@ -66,4 +69,19 @@ def get_health_issues():
|
|||
else:
|
||||
languages_profile_ids.append(items['id'])
|
||||
|
||||
# check if there's at least one languages profile created
|
||||
languages_profiles_count = database.execute(select(func.count(TableLanguagesProfiles.profileId))).scalar()
|
||||
series_with_profile = database.execute(select(func.count(TableShows.sonarrSeriesId))
|
||||
.where(TableShows.profileId.is_not(None))).scalar()
|
||||
movies_with_profile = database.execute(select(func.count(TableMovies.radarrId))
|
||||
.where(TableMovies.profileId.is_not(None))).scalar()
|
||||
if languages_profiles_count == 0:
|
||||
health_issues.append({'object': 'Missing languages profile',
|
||||
'issue': 'You must create at least one languages profile and assign it to your content.'})
|
||||
elif languages_profiles_count > 0 and ((settings.general.use_sonarr and series_with_profile == 0) or
|
||||
(settings.general.use_radarr and movies_with_profile == 0)):
|
||||
health_issues.append({'object': 'No assigned languages profile',
|
||||
'issue': 'Although you have created at least one languages profile, you must assign it '
|
||||
'to your content.'})
|
||||
|
||||
return health_issues
|
||||
|
|
Loading…
Add table
Reference in a new issue