|
|
|
@ -10,6 +10,7 @@ from languages.get_languages import language_from_alpha2
|
|
|
|
|
from utilities.path_mappings import path_mappings
|
|
|
|
|
from subtitles.indexer.series import store_subtitles
|
|
|
|
|
from subtitles.indexer.movies import store_subtitles_movie
|
|
|
|
|
from subtitles.processing import ProcessSubtitlesResult
|
|
|
|
|
from sonarr.history import history_log
|
|
|
|
|
from radarr.history import history_log_movie
|
|
|
|
|
from sonarr.notify import notify_sonarr
|
|
|
|
@ -35,7 +36,15 @@ def delete_subtitles(media_type, language, forced, hi, media_path, subtitles_pat
|
|
|
|
|
language_log += ':forced'
|
|
|
|
|
language_string += ' forced'
|
|
|
|
|
|
|
|
|
|
result = language_string + " subtitles deleted from disk."
|
|
|
|
|
result = ProcessSubtitlesResult(message=language_string + " subtitles deleted from disk.",
|
|
|
|
|
reversed_path=path_mappings.path_replace_reverse(media_path),
|
|
|
|
|
downloaded_language_code2=language_log,
|
|
|
|
|
downloaded_provider=None,
|
|
|
|
|
score=None,
|
|
|
|
|
forced=None,
|
|
|
|
|
subtitle_id=None,
|
|
|
|
|
reversed_subtitles_path=path_mappings.path_replace_reverse(subtitles_path),
|
|
|
|
|
hearing_impaired=None)
|
|
|
|
|
|
|
|
|
|
if media_type == 'series':
|
|
|
|
|
try:
|
|
|
|
@ -45,9 +54,7 @@ def delete_subtitles(media_type, language, forced, hi, media_path, subtitles_pat
|
|
|
|
|
store_subtitles(path_mappings.path_replace_reverse(media_path), media_path)
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
history_log(0, sonarr_series_id, sonarr_episode_id, result, language=language_log,
|
|
|
|
|
video_path=path_mappings.path_replace_reverse(media_path),
|
|
|
|
|
subtitles_path=path_mappings.path_replace_reverse(subtitles_path))
|
|
|
|
|
history_log(0, sonarr_series_id, sonarr_episode_id, result)
|
|
|
|
|
store_subtitles(path_mappings.path_replace_reverse(media_path), media_path)
|
|
|
|
|
notify_sonarr(sonarr_series_id)
|
|
|
|
|
event_stream(type='series', action='update', payload=sonarr_series_id)
|
|
|
|
@ -61,9 +68,7 @@ def delete_subtitles(media_type, language, forced, hi, media_path, subtitles_pat
|
|
|
|
|
store_subtitles_movie(path_mappings.path_replace_reverse_movie(media_path), media_path)
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
history_log_movie(0, radarr_id, result, language=language_log,
|
|
|
|
|
video_path=path_mappings.path_replace_reverse_movie(media_path),
|
|
|
|
|
subtitles_path=path_mappings.path_replace_reverse_movie(subtitles_path))
|
|
|
|
|
history_log_movie(0, radarr_id, result)
|
|
|
|
|
store_subtitles_movie(path_mappings.path_replace_reverse_movie(media_path), media_path)
|
|
|
|
|
notify_radarr(radarr_id)
|
|
|
|
|
event_stream(type='movie-wanted', action='update', payload=radarr_id)
|
|
|
|
|