Updating the sync logic
This commit is contained in:
+9
-26
@@ -57,6 +57,8 @@ Examples:
|
||||
gnommo -p video1 transcribe --final Transcribe outputted file and generate SRT for YouTube
|
||||
gnommo -p video1 archive Sync project to external cache storage
|
||||
gnommo -p video1 archive --dry-run Preview what would be synced
|
||||
gnommo -p video1 up Upload project files to remote server
|
||||
gnommo -p video1 down Download project files from remote server
|
||||
gnommo -p video1 extract-audio --combined Extract audio from narration_combined.mov
|
||||
gnommo -p video1 extract-audio --combined --channel left Extract left channel only
|
||||
gnommo -p video1 extract-audio --segment seg01 Extract from a specific segment
|
||||
@@ -96,7 +98,8 @@ Examples:
|
||||
"description",
|
||||
"archive",
|
||||
"load",
|
||||
"sync",
|
||||
"up",
|
||||
"down",
|
||||
"extract-audio",
|
||||
"master",
|
||||
"push",
|
||||
@@ -198,11 +201,6 @@ Examples:
|
||||
action="store_true",
|
||||
help="For transcode: compress _processed.mov files (with alpha) using HEVC+alpha instead of narration files",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--down",
|
||||
action="store_true",
|
||||
help="For sync: download from server to local (default is upload)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--alpha-quality",
|
||||
type=float,
|
||||
@@ -278,8 +276,10 @@ Examples:
|
||||
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 == "sync":
|
||||
return cmd_sync(project_path, args.verbose, args.dry_run, args.down)
|
||||
elif action == "up":
|
||||
return cmd_sync(project_path, args.verbose, args.dry_run, download=False)
|
||||
elif action == "down":
|
||||
return cmd_sync(project_path, args.verbose, args.dry_run, download=True)
|
||||
elif action == "extract-audio":
|
||||
return cmd_extract_audio(
|
||||
project_path, args.verbose, args.segment, args.channel, args.combined
|
||||
@@ -3180,24 +3180,6 @@ def cmd_sync(project_path: Path, verbose: bool, dry_run: bool, download: bool) -
|
||||
print(" path = /gnommo/project")
|
||||
return 1
|
||||
|
||||
# Auto-detect direction: if the caller didn't explicitly pass --down, check
|
||||
# whether there are local source files to upload. If raw_mov/ is empty (or
|
||||
# missing) we almost certainly want to pull from the server instead.
|
||||
if not download:
|
||||
_video_exts = {".mov", ".mp4", ".avi", ".mkv", ".m4v"}
|
||||
raw_mov_dir = project_path / "media" / "narration" / "raw_mov"
|
||||
has_local_sources = raw_mov_dir.exists() and any(
|
||||
f.suffix.lower() in _video_exts
|
||||
for f in raw_mov_dir.iterdir()
|
||||
if f.is_file()
|
||||
)
|
||||
if not has_local_sources:
|
||||
print(
|
||||
" Note: no local source files found in media/narration/raw_mov/ — "
|
||||
"switching to download mode."
|
||||
)
|
||||
download = True
|
||||
|
||||
direction = "Downloading from" if download else "Uploading to"
|
||||
print(f"{direction} server: {project_path.name}")
|
||||
|
||||
@@ -3232,6 +3214,7 @@ def cmd_sync(project_path: Path, verbose: bool, dry_run: bool, download: bool) -
|
||||
print(f"Error: could not create remote directory {remote_dir}")
|
||||
return 1
|
||||
|
||||
|
||||
rsync_cmd = [
|
||||
"rsync",
|
||||
"-av",
|
||||
|
||||
Reference in New Issue
Block a user