Fxing the cache path
This commit is contained in:
+7
-4
@@ -1300,7 +1300,9 @@ def cmd_preprocess(
|
||||
# process_cache: write processed outputs to external disk to save laptop space
|
||||
cache_root = _resolve_process_cache(project_path, config)
|
||||
if cache_root:
|
||||
cache_narration_dir = cache_root / "narration"
|
||||
# Mirror the project's media/ structure so GnommoCache (resolve_with_cache)
|
||||
# finds these files transparently during render/stitch.
|
||||
cache_narration_dir = cache_root / "media" / "narration"
|
||||
cache_narration_dir.mkdir(parents=True, exist_ok=True)
|
||||
(cache_narration_dir / "processed").mkdir(parents=True, exist_ok=True)
|
||||
print(f" Using process cache: {cache_root}")
|
||||
@@ -2063,12 +2065,13 @@ def cmd_stitch(
|
||||
else:
|
||||
videos_dir = project_path / "media" / "videos"
|
||||
|
||||
# When process_cache is set, redirect processed segment reads and combined output
|
||||
# When process_cache is set, redirect processed segment reads and combined output.
|
||||
# Mirror media/ structure so GnommoCache (resolve_with_cache) finds files during render.
|
||||
cache_root = _resolve_process_cache(project_path, config)
|
||||
if cache_root:
|
||||
narration_dir = cache_root / "narration"
|
||||
narration_dir = cache_root / "media" / "narration"
|
||||
narration_dir.mkdir(parents=True, exist_ok=True)
|
||||
videos_dir_out = cache_root / "videos"
|
||||
videos_dir_out = cache_root / "media" / "videos"
|
||||
videos_dir_out.mkdir(parents=True, exist_ok=True)
|
||||
print(f" Using process cache: {cache_root}")
|
||||
else:
|
||||
|
||||
@@ -528,9 +528,6 @@ class RenderPlan:
|
||||
output_path: Optional[
|
||||
Path
|
||||
] = None # Final output file path (set after plan is built)
|
||||
process_cache_dir: Optional[
|
||||
Path
|
||||
] = None # Per-project subdir in process_cache (e.g. /Volumes/GnommoDisk/video3)
|
||||
|
||||
|
||||
# Slide layout configurations (hardcoded for POC)
|
||||
|
||||
+4
-15
@@ -197,7 +197,6 @@ def _resolve_video_path(
|
||||
video_source: VideoSource,
|
||||
shared_assets_dir: Path = None,
|
||||
project_path: Path = None,
|
||||
process_cache_dir: Path = None,
|
||||
) -> Path:
|
||||
"""Resolve the actual video file path (output_file if exists, else source_file).
|
||||
|
||||
@@ -206,7 +205,6 @@ def _resolve_video_path(
|
||||
|
||||
If video_source.is_shared is True, looks in shared_assets_dir instead of videos_dir.
|
||||
Uses gnommocache fallback if configured and project_path is provided.
|
||||
When process_cache_dir is set, also checks {cache}/videos/ for the file.
|
||||
"""
|
||||
from .cache import resolve_with_cache
|
||||
|
||||
@@ -235,12 +233,6 @@ def _resolve_video_path(
|
||||
elif webm_path.exists():
|
||||
return webm_path
|
||||
|
||||
# Check process_cache_dir before falling back to source_file in project
|
||||
if process_cache_dir and not video_source.is_shared:
|
||||
cache_path = process_cache_dir / "videos" / video_source.source_file
|
||||
if cache_path.exists():
|
||||
return cache_path
|
||||
|
||||
# Fall back to source_file with cache fallback
|
||||
source_path = base_dir / video_source.source_file
|
||||
if project_path:
|
||||
@@ -318,9 +310,6 @@ def build_ffmpeg_command(plan: RenderPlan, output_path: Path) -> list[str]:
|
||||
shared_assets_dir = (
|
||||
plan.shared_assets_dir.resolve() if plan.shared_assets_dir else None
|
||||
)
|
||||
process_cache_dir = (
|
||||
plan.process_cache_dir.resolve() if plan.process_cache_dir else None
|
||||
)
|
||||
|
||||
# Track input indices
|
||||
input_idx = 0
|
||||
@@ -330,7 +319,7 @@ def build_ffmpeg_command(plan: RenderPlan, output_path: Path) -> list[str]:
|
||||
always_visible_inputs: list[int] = []
|
||||
for video_id, video_source, cutout in plan.narration_videos:
|
||||
video_path = _resolve_video_path(
|
||||
videos_dir, video_source, shared_assets_dir, project_path, process_cache_dir
|
||||
videos_dir, video_source, shared_assets_dir, project_path
|
||||
)
|
||||
# Combine video skip setting with partial render offset
|
||||
total_seek = video_source.skip + plan.input_seek_time
|
||||
@@ -404,7 +393,7 @@ def build_ffmpeg_command(plan: RenderPlan, output_path: Path) -> list[str]:
|
||||
|
||||
for i, event in enumerate(plan.video_events):
|
||||
video_path = _resolve_video_path(
|
||||
videos_dir, event.video_source, shared_assets_dir, project_path, process_cache_dir
|
||||
videos_dir, event.video_source, shared_assets_dir, project_path
|
||||
)
|
||||
skip = event.video_source.skip or 0.0
|
||||
if skip > 0:
|
||||
@@ -434,7 +423,7 @@ def build_ffmpeg_command(plan: RenderPlan, output_path: Path) -> list[str]:
|
||||
|
||||
for i, event in enumerate(plan.outro_events):
|
||||
video_path = _resolve_video_path(
|
||||
videos_dir, event.video_source, shared_assets_dir, project_path, process_cache_dir
|
||||
videos_dir, event.video_source, shared_assets_dir, project_path
|
||||
)
|
||||
skip = event.video_source.skip or 0.0
|
||||
if skip > 0:
|
||||
@@ -1114,7 +1103,7 @@ def build_filter_complex(
|
||||
use_channels = first_video_source.use_audio_channels
|
||||
if use_channels == "auto":
|
||||
narration_path = _resolve_video_path(
|
||||
videos_dir, first_video_source, shared_assets_dir, project_path, process_cache_dir
|
||||
videos_dir, first_video_source, shared_assets_dir, project_path
|
||||
)
|
||||
use_channels = _resolve_auto_channel(narration_path)
|
||||
channel_filter = _build_audio_channel_filter(use_channels)
|
||||
|
||||
@@ -586,14 +586,6 @@ def build_render_plan(
|
||||
elif (project_path.parent / "shared_assets").exists():
|
||||
shared_assets_dir = project_path.parent / "shared_assets"
|
||||
|
||||
# Resolve process_cache per-project directory
|
||||
process_cache_dir = None
|
||||
if config.process_cache:
|
||||
_pc = Path(config.process_cache)
|
||||
if not _pc.is_absolute():
|
||||
_pc = (project_path / _pc).resolve()
|
||||
process_cache_dir = _pc / project_path.name
|
||||
|
||||
narration_video = videos[narration_video_id]
|
||||
cutout = config.cutouts[narration_video.cutout]
|
||||
|
||||
@@ -808,7 +800,6 @@ def build_render_plan(
|
||||
outro_events=outro_events,
|
||||
narration_end_time=narration_end_time,
|
||||
cached_files=cached_files,
|
||||
process_cache_dir=process_cache_dir,
|
||||
)
|
||||
|
||||
return plan, marker_timings
|
||||
|
||||
Reference in New Issue
Block a user