Closed JonD0t closed 1 year ago
Premiere version: 23.0 Python: 3.10.8
After much testing and amateur level coding, Premiere seems to change the order in which it holds the sequences. so I created a means to find the index values for each time the project is opened.
##############################################################################
#GETTING SEQUENCE IDS, IDEX, AND NAME STRING
##############################################################################
#sets list of sequences in project
seqList = pym.objects.app.project.sequences
#enumerates list
i = 0
sLenumerated = enumerate(seqList)
for i in sLenumerated:
print("pymiere ID of sequences ")
print(i)
print("Sequence Name: " + seqList[i[0]].name)
print("")
#loops through sequences looking for Tempseq
i = 0
tempSeqNamestr = pym.objects.app.project.sequences[0].name
renderSeqName = pym.objects.app.project.sequences[0].name
print(tempSeqNamestr)
tempSeqID = pym.objects.app.project.sequences[0]
print("")
while tempSeqNamestr != "Tempseq":
tempSeqNamestr = pym.objects.app.project.sequences[i].name
tempSeqID = pym.objects.app.project.sequences[i]
tempSeqIndex = i
i += 1
if i > numOfSequences:
print("No sequence found with name: Tempseq. Please ensure you have the correct proj file.")
quit()
#cements variables
tempSeqIndex = tempSeqIndex
tempSeqID = tempSeqID
tempSeqNamestr = tempSeqNamestr
#loops through sequences looking for render sequence
i = 0
while renderSeqName != "2. TRIM LENGTH CAPTION AND EXPORT":
renderSeqName = pym.objects.app.project.sequences[i].name
renderSeqIndex = i
renderSeqID = pym.objects.app.project.sequences[i]
i += 1
if i > numOfSequences:
print("No sequence found with name: Tempseq. Please ensure you have the correct proj file.")
quit()
renderSeqID = renderSeqID
renderSeqIndex = renderSeqIndex
renderSeqName = renderSeqName
##################################################################################
Hello,
Here is how I find sequences in PPro, with a function to create dictionaries.
proj = pymiere.objects.app.project
ALL_SEQ = {}
#this is a function to create a dictionary of all sequences in the project.
def sequences_to_dict():
for s in range(0, proj.sequences.__len__()):
ALL_SEQ[proj.sequences[s].name] = proj.sequences[s].sequenceID
return ALL_SEQ
#runs the function
sequences_to_dict()
#this will give you the sequenceID of all your sequences
print(ALL_SEQ)
#you can specify the seq you're looking for like this
print(ALL_SEQ['Temp Seq'])
#this is how you can render something based on the name in the bin
renderSeqName = (ALL_SEQ['Temp Seq'])
then I can call sequences by name no matter where they are.
For some reason when i run this it will say that the Tempseq is 3 mins long, when the clip i am importing is 11 seconds long. The tick count is correct only when i recreate an error (See below) after the code that is supposed to grab the tick count.
Error: Traceback (most recent call last): File "c:\twitchclipadobe\twitchcliptoreel.py", line 97, in
tempSeqEndSeconds = tempSeqEndticks.seconds
AttributeError: 'int' object has no attribute 'seconds'