We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 799f2d1 commit b4bc46fCopy full SHA for b4bc46f
translator/sdh.py
@@ -5,9 +5,9 @@
5
def remove_sdh_from_subtitle(input_filename):
6
with open(input_filename, "r", encoding="utf-8") as infile:
7
for line in infile:
8
- # Remove text within brackets []
9
- cleaned_line = re.sub(r'\[.*?\]', '', line)
10
- sys.stdout.write(cleaned_line)
+ for exp in [r'\[.*?\]', r'\(.*?\)', r'--(?!>)']:
+ line = re.sub(exp, '', line)
+ sys.stdout.write(line)
11
12
if __name__ == "__main__":
13
parser = argparse.ArgumentParser(description='Remove SDH tags from an SRT subtitle file.')
0 commit comments