Skip to content

Commit

Permalink
Add 'maximum subtitle duration' config option to override phrases dur…
Browse files Browse the repository at this point in the history
…ation limit
  • Loading branch information
kelciour committed Feb 7, 2025
1 parent 8f4adcd commit eba18e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"video encoding settings (webm)": "-c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus -b:a 64k",
"audio encoding settings (mp3)": "-ac 1 -c:a libmp3lame -b:a 64k",
"join lines with": "<br>",
"join sentences with": "<br>"
"join sentences with": "<br>",
"maximum subtitle duration": 0
}
6 changes: 6 additions & 0 deletions movies2anki.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ def convert_into_sentences(en_subs, phrases_duration_limit, join_lines_that_end_
else:
sentence_duration_limit = 20

if config["maximum subtitle duration"] != 0:
sentence_duration_limit = config["maximum subtitle duration"]

subs = []
for sub in en_subs:
sub_start = sub[0]
Expand Down Expand Up @@ -449,6 +452,9 @@ def join_questions(en_subs, ru_subs, is_gap_phrases, is_split_long_phrases, phra
else:
sentence_duration_limit = 20

if config["maximum subtitle duration"] != 0:
sentence_duration_limit = config["maximum subtitle duration"]

subs2 = []
for i, sub in enumerate(en_subs):
sub_start = sub[0]
Expand Down

0 comments on commit eba18e6

Please sign in to comment.