Clean up architecture and remove unused code
- Remove duplicate stability tracker from LivestreamArchiver - Remove unused wrapper methods that were causing warnings - Clean separation: main.rs handles events, archiver handles processing - No more compiler warnings - clean architecture
This commit is contained in:
parent
ecea6a851d
commit
ab9c293a01
|
@ -3,13 +3,11 @@ use std::env;
|
|||
use anyhow::{Result, anyhow};
|
||||
use chrono::NaiveDateTime;
|
||||
use video_processing::{
|
||||
VideoProcessingConfig, StabilityTracker, VideoConverter, NfoGenerator, FileProcessor
|
||||
VideoProcessingConfig, VideoConverter, NfoGenerator, FileProcessor
|
||||
};
|
||||
|
||||
pub struct LivestreamArchiver {
|
||||
output_path: PathBuf,
|
||||
config: VideoProcessingConfig,
|
||||
stability_tracker: StabilityTracker,
|
||||
video_converter: VideoConverter,
|
||||
nfo_generator: NfoGenerator,
|
||||
divine_worship_name: String,
|
||||
|
@ -20,7 +18,6 @@ pub struct LivestreamArchiver {
|
|||
impl LivestreamArchiver {
|
||||
pub fn new(output_path: PathBuf) -> Self {
|
||||
let config = VideoProcessingConfig::from_env();
|
||||
let stability_tracker = StabilityTracker::new(config.clone());
|
||||
let video_converter = VideoConverter::new(config.clone());
|
||||
let nfo_generator = NfoGenerator::new(config.clone());
|
||||
|
||||
|
@ -32,8 +29,6 @@ impl LivestreamArchiver {
|
|||
|
||||
LivestreamArchiver {
|
||||
output_path,
|
||||
config,
|
||||
stability_tracker,
|
||||
video_converter,
|
||||
nfo_generator,
|
||||
divine_worship_name,
|
||||
|
@ -42,20 +37,6 @@ impl LivestreamArchiver {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_output_path(&self) -> &PathBuf {
|
||||
&self.output_path
|
||||
}
|
||||
pub fn on_file_event(&self, path: &PathBuf) -> Result<bool> {
|
||||
self.stability_tracker.on_file_event(path)
|
||||
}
|
||||
|
||||
pub fn remove_file_tracker(&self, path: &PathBuf) {
|
||||
self.stability_tracker.remove_file_tracker(path);
|
||||
}
|
||||
|
||||
pub fn get_tracked_files(&self) -> Vec<PathBuf> {
|
||||
self.stability_tracker.get_tracked_files()
|
||||
}
|
||||
|
||||
pub fn check_if_file_already_processed(&self, _filename: &str, date: &chrono::NaiveDateTime) -> bool {
|
||||
let year_dir = self.output_path.join(date.format("%Y").to_string());
|
||||
|
@ -204,9 +185,6 @@ impl LivestreamArchiver {
|
|||
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);
|
||||
|
||||
// Don't delete original file
|
||||
println!("Original file preserved at: {}", path.display());
|
||||
|
||||
|
|
Loading…
Reference in a new issue