top of page

Python script to create lower 3rds from a spreadsheet


If you've ever had to create a load of end cards or lower 3rds for an edit, then you'll appreciate any tool which can make that process easier and more automatic.

I've finally written a program in Python - and it even works, for the most part so I'm quite pleased with myself. I'm sure that anyone who knows what they're doing in Python would think it's a terrible mess.

This script will take a .csv (exported from a spreadsheet) containing a list of names and it will create multiple Fusion graphics, one graphic for each name. It actually takes two items, one for Name and one for Designation. It doesn't actually run in Resolve - it just creates Fusion .settings files based on a template for Lower 3rd text.

To use this program, first you need to edit and save our chosen Fusion template. Select one which has two separate text items (Top Text and Bottom text). Then change one to be "xx_NAME" and the other to "xx_DESIGNATION". These are the items which my script searches for and replaces with all the names from your .csv. Then right click on the node in Fusion and Save>Save As. Save it in a folder along with your .csv file. Copy my Python script into that folder too and run it from there.

You'll be prompted to input the name of the setting file you want to use (just the name, not the '.setting' extension) and also input which .csv file you want to use (including the '.csv' extension).

Once the files are created, you can drag them straight into Fusion or you can copy them into the Resolve's Template folder (restart Resolve if you do this) Users⁩ ▸ ⁨YOUR USER⁩ ▸ ⁨Library⁩ ▸ ⁨Application Support⁩ ▸ ⁨Blackmagic Design⁩ ▸ ⁨DaVinci Resolve⁩ ▸ ⁨Fusion⁩ ▸ ⁨Templates⁩ ▸ ⁨Edit⁩ ▸ ⁨Titles⁩.

I'll upload my 'Bulk Lower 3rds.py' somewhere if anyone wants it. Let me know and I'll figure out where to put it (WeTransfer or maybe just paste it here).

There are a few bugs with this - it doesn't like special characters in the text and it's currently limited to certain types of Fusion/Resolve templates.

This was partly inspired by my pal Igor Riđanović

https://www.youtube.com/user/reglan232/about

Bulk Lower 3rds.py

import os

# Open a file

pleaseOpen = raw_input ("Fusion setting to open: ")

ReNameWith = raw_input ("CSV file to use: ")

#newFileOut = raw_input ("filename to save: ")

FindName = "xx_NAME"

FindDesig = "xx_DESIGNATION"

#ReplaceN = raw_input ("Replace NAME with : ")

#ReplaceD = raw_input ("Replace DESIGNATION with : ")

#To split to a list

orig_csv = open(ReNameWith, "r+")

textfile = (orig_csv.read ())

print (textfile)

list = textfile.split (",")

namePlace = 0

desigPlace = 1

print len(list)

while desigPlace < len(list):

if list [namePlace] == "":

print ("Space after N")

else:

#To replace text

if list [namePlace][0] == '\n' or list [namePlace][0] == '\r':

list[namePlace] = list[namePlace].split("\n")[1]

print "cr before N"

newFileOut = list [namePlace] # To set each setting file name

ReplaceN = list [namePlace] # current Name to use

ReplaceD = list [desigPlace] # current Desigation to use

#input file to change Name

fin = open(pleaseOpen + ".setting", "rt")

#output file to write the result to

fout = open("temp.txt", "wt")

#for each line in the input file

for line in fin:

#read replace the string and write to output file

fout.write(line.replace(FindName, ReplaceN))

#close input and output files

fin.close()

fout.close()

#input file to change Designation

fin2 = open("temp.txt", "rt")

#output file to write the result to

fout2 = open("temp2.txt", "wt")

#for each line in the input file

for line in fin2:

#read replace the Macro name and write to output file

fout2.write(line.replace(FindDesig, ReplaceD))

#close input and output files

#os.remove("temp.txt")

fin2.close()

fout2.close()

#input file to label the macro

fin3 = open("temp2.txt", "rt")

#output file to write the result to

fout3 = open(newFileOut +".setting", "wt")

#for each line in the input file

for line in fin3:

#read replace the Macro name and write to output file

newFileOut = newFileOut.replace(" ", "_") # Replace space with _ for Macro name

fout3.write(line.replace(pleaseOpen + " = GroupOperator", newFileOut + " = MacroOperator"))

#close input and output files

os.remove("temp.txt")

os.remove("temp2.txt")

fin3.close()

fout3.close()

#from To split to a list

print list [namePlace]

if list [desigPlace] == "":

print ("Space after D")

else:

print list [desigPlace]

namePlace = namePlace +2

desigPlace = desigPlace +2

print ("Done")

Recent Posts
Search By Tags
Follow Us
  • Twitter Classic
bottom of page