pedrolabonia / pydavinci

A python package that helps you script DaVinci Resolve
MIT License
132 stars 13 forks source link

Ability to add custom directory path inputs to cache/proxies/gallery stills/powergrades/captures #39

Open Conojomo opened 10 months ago

Conojomo commented 10 months ago

Hello,

My goal is to create an automated script to create a new project and save the presets for the specific database. However the request is to have the ability to add custom directory path inputs for

proxy generation location cache files location gallery stills location

Screen Shot 2023-11-19 at 7 32 30 PM

capture and playback / Capture / Save clips to Screen Shot 2023-11-19 at 7 32 49 PM

Setting powergrade location Screen Shot 2023-11-19 at 7 33 03 PM

with final step to then set as resolve data base preset. Screen Shot 2023-11-19 at 7 33 15 PM

I am eager to learn more about this python package I see there might already be one made which might work. (settings.perf.cache_clips_location: Optional[Union[Path, str]]) I will test.

I suppose I could accomplish this task using outside UI - looking forward to learning about this package and eventually adding to it

Thanks for your time.

Conojomo commented 9 months ago

I figured out how to do part of this in regular API - but I guess my hands are tied if there is missing values in Davinci Resolves main API. As there is no proxy generation location / powergrade location from what I can find in 'GetSettings()'. ---- but here is how I was able to change Capture, Cache Files and Gallery Stills location.

#############

import DaVinciResolveScript as dvr_script

Connect to DaVinci Resolve API

resolve_DaV_api = dvr_script.scriptapp("Resolve")

resolve_version_DaV_api = resolve_DaV_api.GetVersion() print(f"resolve version: {resolve_version_DaV_api}")

project_manager_DaV_api = resolve_DaV_api.GetProjectManager()

Get Current Database

current_database = project_manager_DaV_api.GetCurrentDatabase() print(f"current_database: {current_database}")

Get Current Project

current_project_DaV_API = project_manager_DaV_api.GetCurrentProject()

Get all settings within that project

all_settings = current_project_DaV_API.GetSetting("") print(f"all_settings in Project: {all_settings}\n\n")

def set_project_setting(project, setting_name, value): if project.SetSetting(setting_name, value): print(f"Success: Setting '{setting_name}' updated to '{value}'") else: print(f"Failed: to update '{setting_name}'")

if current_project_DaV_API:

formatted_cache_paths = r"C:/Users/John_Smith/Desktop/TEST"
cache_clip_path_addition = "/CacheClip"
gallery_stills_path_addition = "/.gallery"

CacheClipsLocation_chosen_path = formatted_cache_paths + cache_clip_path_addition if formatted_cache_paths else ""
gallery_chosen_path = formatted_cache_paths + gallery_stills_path_addition if formatted_cache_paths else ""
videoCaptureLocation_chosen_path = formatted_cache_paths if formatted_cache_paths else ""

# Update settings
settings_to_update = {
    #Project Settings/Master Settings
    "perfCacheClipsLocation": CacheClipsLocation_chosen_path,
    "colorGalleryStillsLocation": gallery_chosen_path,
    "videoCaptureLocation": videoCaptureLocation_chosen_path
}

for setting, value in settings_to_update.items():
    set_project_setting(current_project_DaV_API, setting, value)

else: print("No Current Project found.")

################