Skip to content

Commit

Permalink
write srt file to dest directory
Browse files Browse the repository at this point in the history
  • Loading branch information
yajrendrag committed Oct 15, 2024
1 parent 32c6a00 commit f8f97e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions source/subtitle_from_audio/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

**<span style="color:#56adda">0.0.11</span>**
- writ srt file to the destination directory

**<span style="color:#56adda">0.0.10</span>**
- use lang names in post processor to determine if configured lang is in file so that srt file is saved with lang code

Expand Down
2 changes: 1 addition & 1 deletion source/subtitle_from_audio/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"on_worker_process": 2
},
"tags": "subtitle",
"version": "0.0.10"
"version": "0.0.11"
}
6 changes: 4 additions & 2 deletions source/subtitle_from_audio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ def on_postprocessor_task_results(data):

audio_language_to_convert = settings.get_setting('audio_stream_lang_to_text')
abspath = data.get('source_data').get('abspath')
destfile = data.get('destination_files')[0]
probe_data=Probe(logger, allowed_mimetypes=['video'])
if probe_data.file(abspath):
if probe_data.file(destfile):
probe_streams=probe_data.get_probe()["streams"]
else:
probe_streams=[]
Expand All @@ -332,7 +333,8 @@ def on_postprocessor_task_results(data):
audio_language_to_convert = '0'
base = os.path.splitext(abspath)[0]
srt_file_sans_lang = base + '.srt'
srt_file = base + '.' + audio_language_to_convert + '.srt'
base_dest = os.path.splitext(destfile)[0]
srt_file = base_dest + '.' + audio_language_to_convert + '.srt'
path = Path(srt_file_sans_lang)
if path.is_file():
os.rename(srt_file_sans_lang,srt_file)
Expand Down

0 comments on commit f8f97e4

Please sign in to comment.