Skip to content

@tsugden /example_edl_1 secret
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Using the media names extracted from an edit decision list, create a 'pull list' for a human to manually search from.
000035 A017C002_120720DE V C 12:30:14:17 12:30:19:14 03:06:20:17 03:06:25:14
*FROM CLIP NAME: 033-1_SC22*
*SOURCE FILE: 003
000036 A022C002_110820H5 V C 13:18:56:19 13:18:59:06 03:06:25:14 03:06:28:01
*FROM CLIP NAME: 023-2_SC11
*SOURCE FILE: 003
000037 A031C001_110820AR V C 12:44:25:23 12:44:34:17 03:06:28:01 03:06:36:19
*FROM CLIP NAME: 058-2 B_SC30
*SOURCE FILE: 003
110 B013R5K6 V C 15:23:39:07 15:23:41:13 06:14:51:17 06:14:53:23
* FROM CLIP NAME: B013C002_120706_R5K6.MOV
* COMMENT:
111 A092R5K6 V C 15:44:25:09 15:44:33:22 06:14:53:23 06:15:02:12
* FROM CLIP NAME: A092C008_120706_R5K6.MOV
* COMMENT:
M2 A092R5K6 048.0 15:44:25:09
112 A088R5K6 V C 15:09:40:21 15:09:43:20 06:15:02:12 06:15:05:11
* FROM CLIP NAME: A088C003_120706_R5K6.MOV
* COMMENT:
113 A098R5K6 V C 16:54:55:06 16:55:00:20 06:15:05:11 06:15:11:01
* FROM CLIP NAME: A098C013_120706_R5K6.MOV
* COMMENT:
#!/usr/bin/python3
'''Create a Mac or PC formatted pull list from an edl'''
import os
import datetime
date = datetime.datetime.now().strftime('%y%m%d')
tapename_list = []
clipname_list = []
formatted_pull_list = []
mac_format = '{}\tOR\n\n', '{}\tOR\n'
pc_format = '{}\tOR\n\n', '{}\tOR\t'
line_break = 30 # line break after n items in the formatted pull list
null_events = ['BL', 'GEN', 'AX', 'SOLID'] # not media - remove these events
def main():
print('\nPull List Maker\n')
import_edl()
extract_media_from_edl()
format_menu()
def format_menu():
media = None
op_sys = None
# default to tapename events if no clipname events are found
if not clipname_list:
if not tapename_list:
print("\nNo media found (╯°□°)╯︵ ┻━┻ \n")
raise SystemExit
media = tapename_list
# select tapename or clipname events
while not media:
print("\n[1] Use Tapename\n[2] Use Clipname")
answer = input("Select option: ")
if answer == "1":
media = tapename_list
elif answer == "2":
media = clipname_list
else:
media = None
# format pull list for mac or pc
while not op_sys:
print("\n[1] Format for Mac\n[2] Format for PC")
answer = input("Select option: ")
if answer == "1":
op_sys = mac_format
elif answer == "2":
op_sys = pc_format
else:
op_sys = None
if media and op_sys:
format_pull_list(op_sys, media)
# not happy with how print_to_file() is called
if op_sys == mac_format:
print_to_file('mac_')
else:
print_to_file('pc_')
def import_edl():
global edl
edl = None
while not edl:
edl = input('Drag edl into shell and press enter:\n').replace("'", "")
# edl = input('Drag edl into shell and press enter:\n').replace("\ ", " ").split() # for os x
if not os.path.isfile(edl):
edl = None
def extract_media_from_edl():
# media in the tapename column always follows the event number
# clipname is optional, usually only used if tapename is truncated
with open(edl, encoding='utf-8') as f:
file = list(f)
tapename = {
line.split()[1] for line in file
if line.split()
if line.split()[0].isdigit()
}
tapename_sorted = sorted([
m for m in tapename
if m not in null_events
])
clipname = {
line.split()[-1] for line in file
if "CLIP NAME" in line
if not line.split()[-1] == "NAME:"
}
clipname_sorted = sorted([
m for m in clipname
if m not in null_events
])
tapename_list.extend(tapename_sorted)
clipname_list.extend(clipname_sorted)
def format_pull_list(op_sys, media_list):
# to search for media in batches:
# mac = media\tOR\n pc = media\tOR\t
a, b = op_sys
formatted = [
a.format(m)
if (((media_list.index(m)+1) % line_break) == 0)
else b.format(m) for m in media_list
]
formatted_pull_list.extend(formatted)
def print_to_file(op_sys):
edl_path, edl_filename = os.path.split(edl)
edl_shortname, edl_extension = os.path.splitext(edl_filename)
pull_list_path = edl_path + '/_pull_lists/'
pull_list_filename = (date + '_pull_list_' + op_sys
+ edl_shortname + '.txt').replace(' ', '_')
if not os.path.exists(pull_list_path):
os.makedirs(pull_list_path)
with open(pull_list_path + pull_list_filename, mode='w', encoding='utf-8') as f:
f.write(''.join(formatted_pull_list))
print("\nPull list created in " + pull_list_path + pull_list_filename)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.