1
0
Fork 0
mirror of https://github.com/MatomoCamp/recording-subtitles.git synced 2024-09-19 16:03:52 +02:00

Merge branch 'main' of github.com:MatomoCamp/recording-subtitles

This commit is contained in:
Lukas Winkler 2022-10-26 18:15:29 +02:00
commit 8d357c3211
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -13,13 +13,13 @@ replacements = {
"Mitoma": "Matomo",
"Matoma": "Matomo",
"matoma": "matomo",
"Matomo Camp":"MatomoCamp"
"Matomo Camp": "MatomoCamp",
"Big Blue Button": "BigBlueButton"
}
search_strings = [re.escape(k) for k in sorted(replacements, key=len, reverse=True)]
pattern = re.compile("|".join(search_strings), flags=re.DOTALL)
for srt_file in current_dir.glob("**/*.srt"):
text = srt_file.read_text()
fixed_text=pattern.sub(lambda x: replacements[x.group(0)], text)
fixed_text = pattern.sub(lambda x: replacements[x.group(0)], text)
srt_file.write_text(fixed_text)