summaryrefslogtreecommitdiffhomepage
path: root/bazarr/sonarr/sync/series.py
diff options
context:
space:
mode:
Diffstat (limited to 'bazarr/sonarr/sync/series.py')
-rw-r--r--bazarr/sonarr/sync/series.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/bazarr/sonarr/sync/series.py b/bazarr/sonarr/sync/series.py
index 92c819a71..09ee8e43b 100644
--- a/bazarr/sonarr/sync/series.py
+++ b/bazarr/sonarr/sync/series.py
@@ -8,7 +8,7 @@ from app.config import settings
from sonarr.info import url_sonarr
from subtitles.indexer.series import list_missing_subtitles
from sonarr.rootfolder import check_sonarr_rootfolder
-from app.database import TableShows, database, insert, update, delete, select
+from app.database import TableShows, TableLanguagesProfiles, database, insert, update, delete, select
from utilities.path_mappings import path_mappings
from app.event_handler import event_stream, show_progress, hide_progress
@@ -32,6 +32,13 @@ def update_series(send_event=True):
else:
serie_default_profile = None
+ # Prevent trying to insert a series with a non-existing languages profileId
+ if (serie_default_profile and not database.execute(
+ select(TableLanguagesProfiles)
+ .where(TableLanguagesProfiles.profileId == serie_default_profile))
+ .first()):
+ serie_default_profile = None
+
audio_profiles = get_profile_list()
tagsDict = get_tags()