Skip to content

Commit b4bc46f

Browse files
committedSep 14, 2024
fix
1 parent 799f2d1 commit b4bc46f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎translator/sdh.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
def remove_sdh_from_subtitle(input_filename):
66
with open(input_filename, "r", encoding="utf-8") as infile:
77
for line in infile:
8-
# Remove text within brackets []
9-
cleaned_line = re.sub(r'\[.*?\]', '', line)
10-
sys.stdout.write(cleaned_line)
8+
for exp in [r'\[.*?\]', r'\(.*?\)', r'--(?!>)']:
9+
line = re.sub(exp, '', line)
10+
sys.stdout.write(line)
1111

1212
if __name__ == "__main__":
1313
parser = argparse.ArgumentParser(description='Remove SDH tags from an SRT subtitle file.')

0 commit comments

Comments
 (0)
Please sign in to comment.