mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-31 03:12:12 +00:00
Merge pull request #944 from Aurel004/patch-1
Adding Post Processing to manual upload
This commit is contained in:
commit
828a1baf2e
2 changed files with 28 additions and 3 deletions
|
@ -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)
|
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)
|
logging.debug('BAZARR Manually uploading subtitles for this file: ' + path)
|
||||||
|
|
||||||
single = settings.general.getboolean('single_language')
|
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(
|
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith(
|
||||||
'win') and settings.general.getboolean('chmod_enabled') else None
|
'win') and settings.general.getboolean('chmod_enabled') else None
|
||||||
|
|
||||||
|
@ -541,6 +544,20 @@ def manual_upload_subtitle(path, language, forced, title, scene_name, media_type
|
||||||
|
|
||||||
message = language_from_alpha3(language) + (" forced" if forced else "") + " Subtitles manually uploaded."
|
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':
|
if media_type == 'series':
|
||||||
reversed_path = path_replace_reverse(path)
|
reversed_path = path_replace_reverse(path)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1857,6 +1857,9 @@ def perform_manual_upload_subtitle():
|
||||||
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
|
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
|
||||||
title = request.forms.get('title')
|
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)
|
_, ext = os.path.splitext(upload.filename)
|
||||||
|
|
||||||
if ext not in SUBTITLE_EXTENSIONS:
|
if ext not in SUBTITLE_EXTENSIONS:
|
||||||
|
@ -1869,7 +1872,8 @@ def perform_manual_upload_subtitle():
|
||||||
title=title,
|
title=title,
|
||||||
scene_name=sceneName,
|
scene_name=sceneName,
|
||||||
media_type='series',
|
media_type='series',
|
||||||
subtitle=upload)
|
subtitle=upload,
|
||||||
|
audio_language=audio_language))
|
||||||
|
|
||||||
if result is not None:
|
if result is not None:
|
||||||
message = result[0]
|
message = result[0]
|
||||||
|
@ -1996,6 +2000,9 @@ def perform_manual_upload_subtitle_movie():
|
||||||
radarrId = request.forms.get('radarrId')
|
radarrId = request.forms.get('radarrId')
|
||||||
title = request.forms.get('title')
|
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)
|
_, ext = os.path.splitext(upload.filename)
|
||||||
|
|
||||||
if ext not in SUBTITLE_EXTENSIONS:
|
if ext not in SUBTITLE_EXTENSIONS:
|
||||||
|
@ -2008,7 +2015,8 @@ def perform_manual_upload_subtitle_movie():
|
||||||
title=title,
|
title=title,
|
||||||
scene_name=sceneName,
|
scene_name=sceneName,
|
||||||
media_type='movie',
|
media_type='movie',
|
||||||
subtitle=upload)
|
subtitle=upload,
|
||||||
|
audio_language=audio_language)
|
||||||
|
|
||||||
if result is not None:
|
if result is not None:
|
||||||
message = result[0]
|
message = result[0]
|
||||||
|
|
Loading…
Reference in a new issue