-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
morpheus65535
Author
Owner
|
||
(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 |
This should be an AND instead of an OR. Otherwise you need to assign your profiles to at least one series AND one movie.