Skip to content

Instantly share code, notes, and snippets.

@solace
Last active April 5, 2022 08:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solace/fe15ae724b1cc92bb88f7b6c7e5ac274 to your computer and use it in GitHub Desktop.
Save solace/fe15ae724b1cc92bb88f7b6c7e5ac274 to your computer and use it in GitHub Desktop.
Convert DaVinci Resolve marker edl to YouTube usable timeline
"""
Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations
with women in STEAM to learn a bit about what they do and who they are.
https://www.steampoweredshow.com/learn-more
"""
from pprint import pprint
from collections import OrderedDict
import sys
import re
with open(sys.argv[1], 'r') as f:
data = f.read()
lines = data.splitlines()
cases = ['\n'.join(lines[i:i+2]) for i in range(3, len(lines), 3)]
plain = []
for case in cases:
parts = re.split('\n', case)
times = re.split('\s+', parts[0].strip())
timestamp = re.split(':', times[4])[0:3]
# Fixes where timestamp starts at 1 not 0.
timestamp[0] = "%02d" % (int(timestamp[0]) - 1)
meta = re.split('\|', parts[1].strip())
metadict = dict(s.strip().split(':', 1) for s in filter(len, meta))
# Only outputs blue markers (default marker colour). Remove condition to output all, or replace with your preferred colour.
if metadict.get('C').strip() == 'ResolveColorBlue':
plain.append("[%s] %s" % (':'.join(timestamp), metadict.get('M').strip()))
# Omit markup if not required or replace with whatever you need.
print("+++--- MARKUP ---+++")
for i, row in enumerate(plain):
print(row + "<br />")
print("+++--- PLAIN ---+++")
for i, row in enumerate(plain):
print(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment