Add gnommo load command to copy projects from removable media

Adds the inverse of the archive command: `gnommo load -p <project>`
inspects the configured external drive and rsyncs the project folder
onto the local drive. Supports --dry-run. Also expands .gitignore to
cover additional media file types and project directories.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 20:05:12 +02:00
parent 4b4d6caacf
commit 2516e3eeef
2 changed files with 87 additions and 2 deletions
+21 -2
View File
@@ -7,16 +7,35 @@ __pycache__/
venv/ venv/
.venv/ .venv/
*.egg-info/ *.egg-info/
*.pdf
Video1/* *.png
*.key
*.bak
shared_assets/*
Video*/*
Illustrations
# OS # OS
.DS_Store .DS_Store
Thumbs.db Thumbs.db
*/intermediate/*
# Output # Output
**/out/ **/out/
*.mp4 *.mp4
*.mov
*.mp3
*.aifc
*.wav
# Temp # Temp
*.tmp *.tmp
.cache/ .cache/
# Secrets
.env
.env.*
# Sync state (local only, per-environment)
.gnommo_sync.json
.gnommo_sync.prod.json
+66
View File
@@ -95,6 +95,7 @@ Examples:
"import", "import",
"description", "description",
"archive", "archive",
"load",
"extract-audio", "extract-audio",
"master", "master",
"push", "push",
@@ -269,6 +270,8 @@ Examples:
return cmd_description(project_path, args.verbose) return cmd_description(project_path, args.verbose)
elif action == "archive": elif action == "archive":
return cmd_archive(project_path, args.verbose, args.dry_run) return cmd_archive(project_path, args.verbose, args.dry_run)
elif action == "load":
return cmd_load(project_path, args.verbose, args.dry_run)
elif action == "extract-audio": elif action == "extract-audio":
return cmd_extract_audio( return cmd_extract_audio(
project_path, args.verbose, args.segment, args.channel, args.combined project_path, args.verbose, args.segment, args.channel, args.combined
@@ -3020,6 +3023,69 @@ def cmd_archive(project_path: Path, verbose: bool, dry_run: bool) -> int:
return 0 return 0
def cmd_load(project_path: Path, verbose: bool, dry_run: bool) -> int:
"""Load project files from external cache storage onto the local drive."""
from .cache import load_cache_config
print(f"Loading: {project_path.name}")
# Check cache is configured
cache_base = load_cache_config()
if cache_base is None:
print("Error: Cache not configured. Create ~/.gnommo.conf with:")
print(" [cache]")
print(" path = /Volumes/YourDisk/gnommo")
return 1
if not cache_base.exists():
print(f"Error: Cache path not accessible: {cache_base}")
print("Make sure the external drive is connected.")
return 1
# Build source path on the external drive
src_path = cache_base / project_path.name
if not src_path.exists():
print(f"Error: Project not found on external drive: {src_path}")
return 1
print(f" Source: {src_path}")
print(f" Destination: {project_path}")
# Create destination if needed
if not dry_run:
project_path.mkdir(parents=True, exist_ok=True)
rsync_cmd = [
"rsync",
"-av",
"--progress",
"--exclude=*.py",
"--exclude=__pycache__",
"--exclude=.git",
"--exclude=.DS_Store",
f"{src_path}/",
f"{project_path}/",
]
if dry_run:
rsync_cmd.insert(1, "--dry-run")
print("\n [DRY RUN] Would execute:")
print(f" {' '.join(rsync_cmd)}")
else:
print("\n Copying files...")
if verbose:
print(f" Command: {' '.join(rsync_cmd)}")
result = subprocess.run(rsync_cmd)
if result.returncode != 0:
print(f"Error: rsync failed with code {result.returncode}")
return 1
print("\nDone.")
return 0
# ============================================================================= # =============================================================================
# Extract Audio Command # Extract Audio Command
# ============================================================================= # =============================================================================