Set default values for languages, HI and forced subtitles

Set default values for languages, HI and forced when adding new movies and tv shows to the database.
pull/887/head
josdion 5 years ago
parent 3ed36eeb8a
commit c0faf08c52

@ -25,10 +25,16 @@ def update_movies():
radarr_version = get_radarr_version()
movie_default_enabled = settings.general.getboolean('movie_default_enabled')
movie_default_language = settings.general.movie_default_language
movie_default_hi = settings.general.movie_default_hi
movie_default_forced = settings.general.movie_default_forced
if movie_default_enabled is True:
movie_default_language = settings.general.movie_default_language
movie_default_hi = settings.general.movie_default_hi
movie_default_forced = settings.general.movie_default_forced
else:
movie_default_language = '[]'
movie_default_hi = 'False'
movie_default_forced = 'False'
if apikey_radarr is None:
pass
else:
@ -155,54 +161,29 @@ def update_movies():
'imdbId': imdbId,
'movie_file_id': int(movie['movieFile']['id'])})
else:
if movie_default_enabled is True:
movies_to_add.append({'radarrId': int(movie["id"]),
'title': movie["title"],
'path': movie["path"] + separator + movie['movieFile']['relativePath'],
'tmdbId': str(movie["tmdbId"]),
'languages': movie_default_language,
'subtitles': '[]',
'hearing_impaired': movie_default_hi,
'overview': overview,
'poster': poster,
'fanart': fanart,
'audio_language': audio_language,
'sceneName': sceneName,
'monitored': str(bool(movie['monitored'])),
'sortTitle': movie['sortTitle'],
'year': str(movie['year']),
'alternativeTitles': alternativeTitles,
'format': format,
'resolution': resolution,
'video_codec': videoCodec,
'audio_codec': audioCodec,
'imdbId': imdbId,
'forced': movie_default_forced,
'movie_file_id': int(movie['movieFile']['id'])})
else:
movies_to_add.append({'radarrId': int(movie["id"]),
'title': movie["title"],
'path': movie["path"] + separator + movie['movieFile']['relativePath'],
'tmdbId': str(movie["tmdbId"]),
'languages': None,
'subtitles': '[]',
'hearing_impaired': None,
'overview': overview,
'poster': poster,
'fanart': fanart,
'audio_language': audio_language,
'sceneName': sceneName,
'monitored': str(bool(movie['monitored'])),
'sortTitle': movie['sortTitle'],
'year': str(movie['year']),
'alternativeTitles': alternativeTitles,
'format': format,
'resolution': resolution,
'video_codec': videoCodec,
'audio_codec': audioCodec,
'imdbId': imdbId,
'forced': None,
'movie_file_id': int(movie['movieFile']['id'])})
movies_to_add.append({'radarrId': int(movie["id"]),
'title': movie["title"],
'path': movie["path"] + separator + movie['movieFile']['relativePath'],
'tmdbId': str(movie["tmdbId"]),
'languages': movie_default_language,
'subtitles': '[]',
'hearing_impaired': movie_default_hi,
'overview': overview,
'poster': poster,
'fanart': fanart,
'audio_language': audio_language,
'sceneName': sceneName,
'monitored': str(bool(movie['monitored'])),
'sortTitle': movie['sortTitle'],
'year': str(movie['year']),
'alternativeTitles': alternativeTitles,
'format': format,
'resolution': resolution,
'video_codec': videoCodec,
'audio_codec': audioCodec,
'imdbId': imdbId,
'forced': movie_default_forced,
'movie_file_id': int(movie['movieFile']['id'])})
else:
logging.error(
'BAZARR Radarr returned a movie without a file path: ' + movie["path"] + separator +

@ -21,9 +21,16 @@ def update_series():
sonarr_version = get_sonarr_version()
serie_default_enabled = settings.general.getboolean('serie_default_enabled')
serie_default_language = settings.general.serie_default_language
serie_default_hi = settings.general.serie_default_hi
serie_default_forced = settings.general.serie_default_forced
if serie_default_enabled is True:
serie_default_language = settings.general.serie_default_language
serie_default_hi = settings.general.serie_default_hi
serie_default_forced = settings.general.serie_default_forced
else:
serie_default_language = '[]'
serie_default_hi = 'Flase'
serie_default_forced = 'False'
audio_profiles = get_profile_list()
# Get shows data from Sonarr
@ -93,33 +100,20 @@ def update_series():
'year': str(show['year']),
'alternateTitles': alternate_titles})
else:
if serie_default_enabled is True:
series_to_add.append({'title': show["title"],
'path': show["path"],
'tvdbId': show["tvdbId"],
'languages': serie_default_language,
'hearing_impaired': serie_default_hi,
'sonarrSeriesId': show["id"],
'overview': overview,
'poster': poster,
'fanart': fanart,
'audio_language': audio_language,
'sortTitle': show['sortTitle'],
'year': str(show['year']),
'alternateTitles': alternate_titles,
'forced': serie_default_forced})
else:
series_to_add.append({'title': show["title"],
'path': show["path"],
'tvdbId': show["tvdbId"],
'sonarrSeriesId': show["id"],
'overview': overview,
'poster': poster,
'fanart': fanart,
'audio_language': audio_language,
'sortTitle': show['sortTitle'],
'year': str(show['year']),
'alternateTitles': alternate_titles})
series_to_add.append({'title': show["title"],
'path': show["path"],
'tvdbId': show["tvdbId"],
'languages': serie_default_language,
'hearing_impaired': serie_default_hi,
'sonarrSeriesId': show["id"],
'overview': overview,
'poster': poster,
'fanart': fanart,
'audio_language': audio_language,
'sortTitle': show['sortTitle'],
'year': str(show['year']),
'alternateTitles': alternate_titles,
'forced': serie_default_forced})
# Remove old series from DB
removed_series = list(set(current_shows_db_list) - set(current_shows_sonarr))

Loading…
Cancel
Save