Skip to content

Commit

Permalink
use lang names in post prcessor comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
yajrendrag committed Oct 15, 2024
1 parent 807f9cd commit 32c6a00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 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.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

**<span style="color:#56adda">0.0.9</span>**
- change language code to language name in whisper command

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.9"
"version": "0.0.10"
}
8 changes: 7 additions & 1 deletion source/subtitle_from_audio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,13 @@ def on_postprocessor_task_results(data):
probe_streams=probe_data.get_probe()["streams"]
else:
probe_streams=[]
astreams = [i for i in range(len(probe_streams)) if probe_streams[i]['codec_type'] == 'audio' and 'tags' in probe_streams[i] and 'language' in probe_streams[i]['tags'] and probe_streams[i]['tags']['language'] == audio_language_to_convert]
astreams = []
for i in range(len(probe_streams)):
if probe_streams[i]['codec_type'] == 'audio' and 'tags' in probe_streams[i] and 'language' in probe_streams[i]['tags']:
stream_lang_name = lang_code_to_name(probe_streams[i]['tags']['language'])
configured_lang_name = lang_code_to_name(audio_language_to_convert)
if stream_lang_name == configured_lang_name:
astreams.append(i)
if astreams == []:
audio_language_to_convert = '0'
base = os.path.splitext(abspath)[0]
Expand Down

0 comments on commit 32c6a00

Please sign in to comment.