#!/usr/bin/env python3
# uncompressed.io project archive for DaVinci Resolve, PREVIEW ONLY.
# Runs the archive script in dry-run mode: it lists every file that would be
# sent (clips, project file, master) and their sizes, and uploads nothing.
# Use it once before the real run. Output appears in Workspace -> Console (Py3).
import os, runpy, sys

here = os.path.dirname(os.path.abspath(__file__)) if "__file__" in globals() else ""
candidates = [os.path.join(here, "uncompressed-resolve-archive.py")] if here else []
candidates += [os.path.expanduser("~/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Utility/uncompressed-resolve-archive.py"),
               "/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Utility/uncompressed-resolve-archive.py"]
script = next((c for c in candidates if os.path.isfile(c)), None)
if not script:
    print("uncompressed-resolve-archive.py was not found next to this preview script.")
else:
    sys.argv = [script, "--dry-run"]
    init = {}
    try:
        init["resolve"] = resolve  # noqa: predefined when run from Workspace -> Scripts
    except NameError:
        pass
    runpy.run_path(script, init_globals=init, run_name="__main__")
