def main():
    """
    Initiate resolve instance, get timeline and framerate
    Open and parse text file
    Apply markers to timeline
    Close file and save project
    """
    resolve = GetResolve()

    if resolve == None:
        messageWindow('Please open Resolve and select a timeline')

    projectManager = resolve.GetProjectManager()
    currentProject = projectManager.GetCurrentProject()
    currentTimeline = currentProject.GetCurrentTimeline()

    if currentTimeline == None:
        messageWindow('Please select a timeline')

    fps = int(float(currentProject.GetSetting('timelineFrameRate')))

    print('Working...')
    with open(markersFile, 'r') as infile:
        for line in infile:
            matches = re.search(pattern, line)
            if matches:
                tc = timecode2frames(matches.group(2), fps)
                title = matches.group(3)
                user = matches.group(1)
                apply = currentTimeline.AddMarker(tc, 'Blue', title, user, 1)

    infile.close()
    projectManager.SaveProject()
    print('Done!')
        DisplayFolderInfo(folders[folderIndex], displayShift)
    return


def DisplayMediaPoolInfo(project):
    mediaPool = project.GetMediaPool()
    print("- Media pool")
    DisplayFolderInfo(mediaPool.GetRootFolder(), "  ")
    return


def DisplayProjectInfo(project):
    print("-----------")
    print("Project '" + project.GetName() + "':")
    print("  Framerate " + project.GetSetting("timelineFrameRate"))
    print("  Resolution " + project.GetSetting("timelineResolutionWidth") +
          "x" + project.GetSetting("timelineResolutionHeight"))

    DisplayTimelinesInfo(project)
    print("")
    DisplayMediaPoolInfo(project)
    return


# Get currently open project
resolve = GetResolve()
projectManager = resolve.GetProjectManager()
project = projectManager.GetCurrentProject()

DisplayProjectInfo(project)
示例#3
0
# - render format
# - render codec
if len(sys.argv) < 7:
    print("input parameters for scripts are [drx file path] [grade mode] "
          "[render preset name] [render path] [render format] [render codec]")
    sys.exit()

drxPath = sys.argv[1]
gradeMode = sys.argv[2]
renderPresetName = sys.argv[3]
renderPath = sys.argv[4]
renderFormat = sys.argv[5]
renderCodec = sys.argv[6]

# Get currently open project
resolve = GetResolve()

if not ApplyDRXToAllTimelines(resolve, drxPath, gradeMode):
    print("Unable to apply a still from drx file to all timelines")
    sys.exit()

if not RenderAllTimelines(resolve, renderPresetName, renderPath, renderFormat,
                          renderCodec):
    print("Unable to set all timelines for rendering")
    sys.exit()

WaitForRenderingCompletion(resolve)

DeleteAllRenderJobs(resolve)

print("Rendering is completed.")
示例#4
0

#=-=-=-=-=-=-=-=-= Utils =-=-=-=-=-=-=-=-=-=-=-=-=-=
def addmarker(tool, startTime, markers):
    """Parse markers dict and apply data to text tool"""
    tool.StyledText = comp.BezierSpline()
    for marker in markers:
        name = markers[marker]['name']
        note = markers[marker]['note']
        content = '** %s **\n%s' % (name, note)
        frameNumber = int(marker) - int(startTime)
        tool.StyledText[frameNumber] = content


#=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
resolve = GetResolve()
if resolve == None:
    sys.exit(-1)

# Get clip markers data
fu = resolve.Fusion()
proj = resolve.GetProjectManager().GetCurrentProject()
clip = proj.GetCurrentTimeline().GetCurrentVideoItem()
markersList = clip.GetMarkers()
if not markersList:
    print('No Markers found!')
    sys.exit(0)

# Open fusion page and add Text+ tool
resolve.OpenPage('Fusion')
comp = fu.GetCurrentComp()
示例#5
0
# - project height, in pixels
# - path to media
if len(sys.argv) < 6:
    print(
        "input parameters for scripts are [project name] [framerate] [width] [height] [path to media]"
    )
    sys.exit()

projectName = sys.argv[1]
framerate = sys.argv[2]
width = sys.argv[3]
height = sys.argv[4]
mediaPath = sys.argv[5]

# Create project and set parameters:
resolve = GetResolve()
projectManager = resolve.GetProjectManager()
project = projectManager.CreateProject(projectName)

if not project:
    print("Unable to create a project '" + projectName + "'")
    sys.exit()

project.SetSetting("timelineFrameRate", str(framerate))
project.SetSetting("timelineResolutionWidth", str(width))
project.SetSetting("timelineResolutionHeight", str(height))

# Add folder contents to Media Pool:
mediapool = project.GetMediaPool()
rootFolder = mediapool.GetRootFolder()
clips = resolve.GetMediaStorage().AddItemsToMediaPool(mediaPath)
from tkinter import *
import csv
import pandas as pd
import xml.etree.ElementTree as ET
import configparser
from collections import defaultdict
from collections import OrderedDict
from operator import itemgetter
from itertools import product
import os
fps = 23.976

ui = fu.UIManager
disp = bmd.UIDispatcher(ui)
from python_get_resolve import GetResolve
resolve = GetResolve()
project = resolve.GetProjectManager().GetCurrentProject()
mediapool = project.GetMediaPool()
bin = mediapool.GetCurrentFolder()
Clips = bin.GetClipList()
if not project:
    print("No project is loaded")
    sys.exit()

status_text = ""
Frames_toggle = True
Folder_Name = ""
MetadataList = []
object_List = []
ScriptEMetadataList = []
示例#7
0
            # set the file extensions here
            if file.endswith(('.xml', '.fcpxml', '.aaf', '.edl')):
                xmlpath_list.append(os.path.join(rootdir, file))
    for xmlpath in xmlpath_list:
        relpath = os.path.relpath(xmlpath, watch_path)
        newpath = os.path.split(os.path.join(dest, relpath))[0]
        if not os.path.exists(newpath):
            os.makedirs(newpath)
        try:
            shutil.copy(xmlpath, newpath)
        except:
            pass


# init Resolve handles, a script from Resolve's scripting documentation is used.
resolve = GetResolve()
if not resolve:
    sg.PopupError(
        'Cannot get Resolve API. \n Is Resolve open? '
        '\n Is "Davinci Resolve > Preference > System > General > External Scripting Using" set to "Local"?',
        title='Ahhh!!',
        keep_on_top=True,
        auto_close_duration=4,
        line_width=40,
        font=('Default', 15))
    exit()

pm = resolve.GetProjectManager()
proj = pm.GetCurrentProject()
mp = proj.GetMediaPool()
ms = resolve.GetMediaStorage()