Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/config/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ function resolveHome(): string {

const home = resolveHome();

// Hermetic installs run from a bundled runtime where the backend lives outside
// projectRoot; the launcher points PODCLI_BACKEND at it.
const backendDir = process.env.PODCLI_BACKEND
? resolve(process.env.PODCLI_BACKEND)
: join(projectRoot, "backend");

function detectPython(): string {
if (process.env.PYTHON_PATH) return process.env.PYTHON_PATH;
const isWindows = process.platform === "win32";
Expand All @@ -44,6 +50,7 @@ function detectPython(): string {
export const paths = {
home,
projectRoot,
backendDir,
homeMarker,
dataDir,
cache: join(dataDir, "cache"),
Expand All @@ -61,9 +68,7 @@ export const paths = {
corrections: join(home, "corrections.json"),
thumbnailConfig: join(home, "thumbnail-config.json"),
integrations: join(home, "integrations.json"),
pythonBackend: process.env.PODCLI_BACKEND
? join(resolve(process.env.PODCLI_BACKEND), "main.py")
: join(projectRoot, "backend", "main.py"),
pythonBackend: join(backendDir, "main.py"),
pythonPath: detectPython(),
ffmpegPath: process.env.FFMPEG_PATH || "ffmpeg",
ffprobePath: process.env.FFPROBE_PATH || "ffprobe",
Expand Down
4 changes: 2 additions & 2 deletions src/ui/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ function runPy(scriptAndArgs: string[]): Promise<{ code: number; stdout: string;
}

const runCli = (args: string[]) =>
runPy([join(paths.projectRoot, "backend", "cli.py"), "--no-banner", ...args]);
runPy([join(paths.backendDir, "cli.py"), "--no-banner", ...args]);

// Composite a thumbnail PNG onto the start of a clip. stripStart > 0 removes a
// prior card first (avoids stacking on re-bake). Returns the bake's success.
Expand Down Expand Up @@ -1720,7 +1720,7 @@ app.post("/api/clips/:id/davinci", async (req, res) => {
res.status(400).json({ error: "rendered file missing" });
return;
}
const cli = join(paths.projectRoot, "backend", "services", "integrations", "davinci_resolve", "cli.py");
const cli = join(paths.backendDir, "services", "integrations", "davinci_resolve", "cli.py");
const r = await runPy([cli, "--source", clip.output_path, "--title", clip.title]);
if (r.code !== 0) {
res.status(400).json({ error: stripAnsi(r.stderr || r.stdout) || "export failed" });
Expand Down
Loading