mirror of https://github.com/morpheus65535/bazarr
Merge pull request #944 from Aurel004/patch-1
Adding Post Processing to manual upload
This commit is contained in:
commit
828a1baf2e
|
@ -473,11 +473,14 @@ def manual_download_subtitle(path, language, audio_language, hi, forced, subtitl
|
|||
logging.debug('BAZARR Ended manually downloading Subtitles for file: ' + path)
|
||||
|
||||
|
||||
def manual_upload_subtitle(path, language, forced, title, scene_name, media_type, subtitle):
|
||||
def manual_upload_subtitle(path, language, forced, title, scene_name, media_type, subtitle, audio_language):
|
||||
logging.debug('BAZARR Manually uploading subtitles for this file: ' + path)
|
||||
|
||||
single = settings.general.getboolean('single_language')
|
||||
|
||||
use_postprocessing = settings.general.getboolean('use_postprocessing')
|
||||
postprocessing_cmd = settings.general.postprocessing_cmd
|
||||
|
||||
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith(
|
||||
'win') and settings.general.getboolean('chmod_enabled') else None
|
||||
|
||||
|
@ -540,6 +543,20 @@ def manual_upload_subtitle(path, language, forced, title, scene_name, media_type
|
|||
os.chmod(subtitle_path, chmod)
|
||||
|
||||
message = language_from_alpha3(language) + (" forced" if forced else "") + " Subtitles manually uploaded."
|
||||
|
||||
uploaded_language_code3 = language
|
||||
uploaded_language = language_from_alpha3(uploaded_language_code3)
|
||||
uploaded_language_code2 = alpha2_from_alpha3(uploaded_language_code3)
|
||||
audio_language_code2 = alpha2_from_language(audio_language)
|
||||
audio_language_code3 = alpha3_from_language(audio_language)
|
||||
|
||||
|
||||
if use_postprocessing is True:
|
||||
command = pp_replace(postprocessing_cmd, path, subtitle_path, uploaded_language,
|
||||
uploaded_language_code2, uploaded_language_code3, audio_language,
|
||||
audio_language_code2, audio_language_code3, forced)
|
||||
postprocessing(command, path)
|
||||
|
||||
|
||||
if media_type == 'series':
|
||||
reversed_path = path_replace_reverse(path)
|
||||
|
|
|
@ -1856,6 +1856,9 @@ def perform_manual_upload_subtitle():
|
|||
sonarrSeriesId = request.forms.get('sonarrSeriesId')
|
||||
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
|
||||
title = request.forms.get('title')
|
||||
|
||||
data = database.execute("SELECT audio_language FROM table_shows WHERE sonarrSeriesId=?", (sonarrSeriesId,), only_one=True)
|
||||
audio_language = data['audio_language']
|
||||
|
||||
_, ext = os.path.splitext(upload.filename)
|
||||
|
||||
|
@ -1869,7 +1872,8 @@ def perform_manual_upload_subtitle():
|
|||
title=title,
|
||||
scene_name=sceneName,
|
||||
media_type='series',
|
||||
subtitle=upload)
|
||||
subtitle=upload,
|
||||
audio_language=audio_language))
|
||||
|
||||
if result is not None:
|
||||
message = result[0]
|
||||
|
@ -1995,6 +1999,9 @@ def perform_manual_upload_subtitle_movie():
|
|||
upload = request.files.get('upload')
|
||||
radarrId = request.forms.get('radarrId')
|
||||
title = request.forms.get('title')
|
||||
|
||||
data = database.execute("SELECT audio_language FROM table_movies WHERE radarrId=?", (radarrId,), only_one=True)
|
||||
audio_language = data['audio_language']
|
||||
|
||||
_, ext = os.path.splitext(upload.filename)
|
||||
|
||||
|
@ -2008,7 +2015,8 @@ def perform_manual_upload_subtitle_movie():
|
|||
title=title,
|
||||
scene_name=sceneName,
|
||||
media_type='movie',
|
||||
subtitle=upload)
|
||||
subtitle=upload,
|
||||
audio_language=audio_language)
|
||||
|
||||
if result is not None:
|
||||
message = result[0]
|
||||
|
|
Loading…
Reference in New Issue