diff --git a/src/main.rs b/src/main.rs index 24bf78e..26c33f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ async fn main() -> Result<()> { println!("Watching directory: {}", watch_path.display()); println!("Output directory: {}", output_path.display()); - let archiver = LivestreamArchiver::new(&output_path.clone()); + let archiver = LivestreamArchiver::new(output_path.clone()); let processed_files = Arc::new(Mutex::new(HashSet::new())); // Process existing files first @@ -40,7 +40,7 @@ async fn main() -> Result<()> { if let Some(filename) = path.file_name().and_then(|f| f.to_str()) { if let Ok(date) = archiver.extract_date_from_filename(filename).await { // Check if either Divine Worship or Afternoon Program exists for this date - let year_dir = archiver.output_path.join(date.format("%Y").to_string()); + let year_dir = archiver.get_output_path().join(date.format("%Y").to_string()); let month_dir = year_dir.join(format!("{}-{}", date.format("%m"), date.format("%B") diff --git a/src/services/livestream_archiver.rs b/src/services/livestream_archiver.rs index 109611b..df2cd57 100644 --- a/src/services/livestream_archiver.rs +++ b/src/services/livestream_archiver.rs @@ -4,16 +4,20 @@ use chrono::NaiveDateTime; use tokio::process::Command; use tokio::time::Duration; -pub struct LivestreamArchiver<'a> { - output_path: &'a PathBuf, +pub struct LivestreamArchiver { + output_path: PathBuf, } -impl<'a> LivestreamArchiver<'a> { - pub fn new(output_path: &'a PathBuf) -> Self { +impl LivestreamArchiver { + pub fn new(output_path: PathBuf) -> Self { LivestreamArchiver { output_path, } } + + pub fn get_output_path(&self) -> &PathBuf { + &self.output_path + } async fn wait_for_file_ready(&self, path: &PathBuf) -> Result<()> { println!("Waiting for file to be ready: {}", path.display());