Created
September 1, 2023 22:21
-
-
Save skarfie123/b5241f64ee7faed7e715c6931c1c13fb to your computer and use it in GitHub Desktop.
Convert Davinci Resolve timeline markers EDL to YouTube timestamps. Based on https://github.com/MaximRouiller/edl-to-ytjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import typer | |
def main(edl_file: str): | |
with open(edl_file, encoding="utf-8") as f: | |
lines = f.readlines() | |
regex_timestamp = r"\d{3,4} \d{3,4} V C \d{2}:(?P<marker_timestamp>\d{2}:\d{2}):\d{2} \d{2}:\d{2}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}:\d{2}" | |
regex_marker_name = r" \|C:\w+ \|M:(?P<marker_name>.+) \|D:1" | |
for i, line in enumerate(lines[:-1]): | |
if re.match(regex_timestamp, line): | |
marker_timestamp = re.search(regex_timestamp, lines[i]).group( | |
"marker_timestamp" | |
) | |
if re.match(regex_marker_name, lines[i + 1]): | |
marker_name = re.search(regex_marker_name, lines[i + 1]).group( | |
"marker_name" | |
) | |
print(marker_timestamp, marker_name) | |
if __name__ == "__main__": | |
typer.run(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment