-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimporta_timelines.py
More file actions
30 lines (27 loc) · 1.31 KB
/
importa_timelines.py
File metadata and controls
30 lines (27 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
#Esse módulo importa para um projeto do DaVinci Resolve timelines no formato fcpxml ainda não importadas neste projeto.
#vaie
arquivos = []
extensao = ".fcpxml" #precisa ser fcpxml, pois timelines xml não foram importadas (versão 18.5 estável do DaVinci)
pasta = r"D:\Curso Python programação e machine learning para iniciantes\Gravações"
for file in os.listdir(pasta):
if file.endswith(extensao):
print(file)
arquivos.append(file)
resolve = app.GetResolve() #Pega objeto Resolve. Precisa que DaVinci Resolve esteja aberto. app é um objeto interno do DaVinci.
projectManager = resolve.GetProjectManager()
projeto = projectManager.GetCurrentProject()
mediapool = projeto.GetMediaPool()
timeline_count = projeto.GetTimelineCount()
timelines = []
for i in range(timeline_count):
timelines.append(projeto.GetTimelineByIndex(i+1))
for arquivo in arquivos:
ja_tem = False #já tem esse arquivo importado como uma timeline no projeto?
for timeline in timelines:
if str(timeline) in str(arquivo):
ja_tem = True
break
if not ja_tem: #se não tem ainda essa timeline, importe no projeto.
caminhoArquivo = rf"{pasta}\{arquivo}"
timeline = mediapool.ImportTimelineFromFile(caminhoArquivo, {"timelineName": arquivo.removesuffix(extensao)})