diff options
author | morpheus65535 <[email protected]> | 2023-11-14 22:54:43 -0500 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2023-11-14 22:54:43 -0500 |
commit | f2bb48ac9a47e738e09fa5386cbf5189f3b51210 (patch) | |
tree | c5687e5eaf699de45c220e72a0c41da01c892b25 | |
parent | ad6557357d3d3a46d5692e707b3df90c4a20d777 (diff) | |
download | bazarr-f2bb48ac9a47e738e09fa5386cbf5189f3b51210.tar.gz bazarr-f2bb48ac9a47e738e09fa5386cbf5189f3b51210.zip |
Fixed issue with series/movies import using a deleted default languages profile.
-rw-r--r-- | bazarr/radarr/sync/movies.py | 9 | ||||
-rw-r--r-- | bazarr/sonarr/sync/series.py | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/bazarr/radarr/sync/movies.py b/bazarr/radarr/sync/movies.py index eb951f251..909b7a5a4 100644 --- a/bazarr/radarr/sync/movies.py +++ b/bazarr/radarr/sync/movies.py @@ -10,7 +10,7 @@ from utilities.path_mappings import path_mappings from subtitles.indexer.movies import store_subtitles_movie, movies_full_scan_subtitles from radarr.rootfolder import check_radarr_rootfolder from subtitles.mass_download import movies_download_subtitles -from app.database import TableMovies, database, insert, update, delete, select +from app.database import TableMovies, TableLanguagesProfiles, database, insert, update, delete, select from app.event_handler import event_stream, show_progress, hide_progress from .utils import get_profile_list, get_tags, get_movies_from_radarr_api @@ -74,6 +74,13 @@ def update_movies(send_event=True): else: movie_default_profile = None + # Prevent trying to insert a movie with a non-existing languages profileId + if (movie_default_profile and not database.execute( + select(TableLanguagesProfiles) + .where(TableLanguagesProfiles.profileId == movie_default_profile)) + .first()): + movie_default_profile = None + if apikey_radarr is None: pass else: 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() |