CRITICAL: Re-add PC sync functionality for original file editing
- Add PC_SYNC_TARGET environment variable support - Sync original high-quality livestream files to Mac for editing - Rsync happens after AV1 conversion but sends original file - Essential workflow feature that was accidentally removed in refactoring
This commit is contained in:
parent
3cf60dbad1
commit
ecea6a851d
|
@ -14,6 +14,7 @@ pub struct LivestreamArchiver {
|
|||
nfo_generator: NfoGenerator,
|
||||
divine_worship_name: String,
|
||||
afternoon_program_name: String,
|
||||
pc_sync_target: Option<String>,
|
||||
}
|
||||
|
||||
impl LivestreamArchiver {
|
||||
|
@ -27,6 +28,7 @@ impl LivestreamArchiver {
|
|||
.unwrap_or_else(|_| "Divine Worship Service - RTSDA".to_string());
|
||||
let afternoon_program_name = env::var("AFTERNOON_PROGRAM_NAME")
|
||||
.unwrap_or_else(|_| "Afternoon Program - RTSDA".to_string());
|
||||
let pc_sync_target = env::var("PC_SYNC_TARGET").ok();
|
||||
|
||||
LivestreamArchiver {
|
||||
output_path,
|
||||
|
@ -36,6 +38,7 @@ impl LivestreamArchiver {
|
|||
nfo_generator,
|
||||
divine_worship_name,
|
||||
afternoon_program_name,
|
||||
pc_sync_target,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +89,28 @@ impl LivestreamArchiver {
|
|||
Ok(date)
|
||||
}
|
||||
|
||||
async fn sync_to_pc(&self, file_path: &PathBuf) -> Result<()> {
|
||||
if let Some(target) = &self.pc_sync_target {
|
||||
println!("Syncing original file to PC for editing: {}", file_path.display());
|
||||
|
||||
let output = tokio::process::Command::new("rsync")
|
||||
.arg("-avz")
|
||||
.arg("--progress")
|
||||
.arg(file_path)
|
||||
.arg(target)
|
||||
.output()
|
||||
.await?;
|
||||
|
||||
if output.status.success() {
|
||||
println!("Successfully synced {} to {}", file_path.display(), target);
|
||||
} else {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
return Err(anyhow!("Failed to sync to PC: {}", stderr));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn process_file(&self, path: PathBuf) -> Result<()> {
|
||||
// Only process .mp4 files
|
||||
if path.extension().and_then(|ext| ext.to_str()) != Some("mp4") {
|
||||
|
@ -174,6 +199,11 @@ impl LivestreamArchiver {
|
|||
|
||||
println!("Successfully converted {} to AV1 and created NFO", path.display());
|
||||
|
||||
// Sync the ORIGINAL file to PC for editing
|
||||
if let Err(e) = self.sync_to_pc(&path).await {
|
||||
eprintln!("Warning: Failed to sync original file to PC: {}", e);
|
||||
}
|
||||
|
||||
// Clean up the file tracker since we're done with this file
|
||||
self.remove_file_tracker(&path);
|
||||
|
||||
|
|
Loading…
Reference in a new issue