diff --git a/bazarr/api.py b/bazarr/api.py
index 8d4042da9..ebff79264 100644
--- a/bazarr/api.py
+++ b/bazarr/api.py
@@ -18,7 +18,7 @@ import logging
from database import database, get_exclusion_clause, get_profiles_list, get_desired_languages, get_profile_id_name, \
get_audio_profile_languages, update_profile_id_list
from helper import path_mappings
-from get_languages import language_from_alpha2, alpha3_from_alpha2
+from get_languages import language_from_alpha2, language_from_alpha3, alpha2_from_alpha3, alpha3_from_alpha2
from get_subtitle import download_subtitle, series_download_subtitles, manual_search, manual_download_subtitle, \
manual_upload_subtitle, wanted_search_missing_subtitles_series, wanted_search_missing_subtitles_movies, \
episode_download_subtitles, movies_download_subtitles
@@ -1375,7 +1375,7 @@ class HistorySeries(Resource):
datetime.datetime(1970, 1, 1)).total_seconds()
if settings.general.getboolean('upgrade_manual'):
- query_actions = [1, 2, 3]
+ query_actions = [1, 2, 3, 6]
else:
query_actions = [1, 3]
@@ -1481,7 +1481,7 @@ class HistoryMovies(Resource):
datetime.datetime(1970, 1, 1)).total_seconds()
if settings.general.getboolean('upgrade_manual'):
- query_actions = [1, 2, 3]
+ query_actions = [1, 2, 3, 6]
else:
query_actions = [1, 3]
@@ -1947,10 +1947,37 @@ class SubTranslate(Resource):
forced=forced, hi=hi)
if result:
+ message = 'Subtitles translated to {}'.format(language_from_alpha3(dest_language))
+
if media_type == 'series':
+ episode_metadata = database.execute("SELECT sonarrSeriesId, sonarrEpisodeId FROM table_episodes"
+ " WHERE path = ?",
+ (path_mappings.path_replace_reverse(video_path),), only_one=True)
store_subtitles(path_mappings.path_replace_reverse(video_path), video_path)
+ history_log(action=6,
+ sonarr_series_id=episode_metadata['sonarrSeriesId'],
+ sonarr_episode_id=episode_metadata['sonarrEpisodeId'],
+ description=message,
+ video_path=path_mappings.path_replace_reverse(video_path),
+ language=alpha2_from_alpha3(dest_language),
+ provider=None,
+ score=0,
+ subs_id=None,
+ subtitles_path=path_mappings.path_replace_reverse(result))
else:
+ movie_metadata = database.execute("SELECT radarrId FROM table_movies WHERE path = ?",
+ (path_mappings.path_replace_reverse_movie(video_path),),
+ only_one=True)
store_subtitles_movie(path_mappings.path_replace_reverse_movie(video_path), video_path)
+ history_log_movie(action=6,
+ radarr_id=movie_metadata['radarrId'],
+ description=message,
+ video_path=path_mappings.path_replace_reverse_movie(video_path),
+ language=alpha2_from_alpha3(dest_language),
+ provider=None,
+ score=0,
+ subs_id=None,
+ subtitles_path=path_mappings.path_replace_reverse_movie(result))
return '', 200
else:
return '', 500
diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py
index 810bd081e..a81352f33 100644
--- a/bazarr/get_subtitle.py
+++ b/bazarr/get_subtitle.py
@@ -1195,7 +1195,7 @@ def upgrade_subtitles():
datetime(1970, 1, 1)).total_seconds()
if settings.general.getboolean('upgrade_manual'):
- query_actions = [1, 2, 3]
+ query_actions = [1, 2, 3, 6]
else:
query_actions = [1, 3]
diff --git a/bazarr/utils.py b/bazarr/utils.py
index a329d1c8f..19381c4bc 100644
--- a/bazarr/utils.py
+++ b/bazarr/utils.py
@@ -334,4 +334,4 @@ def translate_subtitles_file(video_path, source_srt_file, to_lang, forced, hi):
line.plaintext = translated_lines_list[i]
subs.save(dest_srt_file)
- return True
\ No newline at end of file
+ return dest_srt_file
diff --git a/views/episodes.html b/views/episodes.html
index 30aac1aa5..97d685835 100644
--- a/views/episodes.html
+++ b/views/episodes.html
@@ -1502,6 +1502,8 @@
return "";
} else if (data === 5) {
return "";
+ } else if (data === 6) {
+ return "";
}
}
},
diff --git a/views/historymovies.html b/views/historymovies.html
index 88667f176..dcfb002a3 100644
--- a/views/historymovies.html
+++ b/views/historymovies.html
@@ -56,6 +56,8 @@
return "";
} else if (data === 5) {
return "";
+ } else if (data === 6) {
+ return "";
}
}
},
diff --git a/views/historyseries.html b/views/historyseries.html
index c9b230845..1922d9fea 100644
--- a/views/historyseries.html
+++ b/views/historyseries.html
@@ -58,6 +58,8 @@
return "";
} else if (data === 5) {
return "";
+ } else if (data === 6) {
+ return "";
}
}
},
diff --git a/views/movie.html b/views/movie.html
index 53c62e699..dbf96c6d1 100644
--- a/views/movie.html
+++ b/views/movie.html
@@ -904,6 +904,7 @@
else if (data === 3) {return "";}
else if (data === 4) {return "";}
else if (data === 5) {return "";}
+ else if (data === 6) {return "";}
}
},
{
diff --git a/views/settingssubtitles.html b/views/settingssubtitles.html
index 0de71fd19..d24f2ecb8 100644
--- a/views/settingssubtitles.html
+++ b/views/settingssubtitles.html
@@ -85,7 +85,7 @@