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 anyhow::{Result, anyhow};
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
use video_processing::{
|
use video_processing::{
|
||||||
VideoProcessingConfig, StabilityTracker, VideoConverter, NfoGenerator, FileProcessor
|
VideoProcessingConfig, VideoConverter, NfoGenerator, FileProcessor
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct LivestreamArchiver {
|
pub struct LivestreamArchiver {
|
||||||
output_path: PathBuf,
|
output_path: PathBuf,
|
||||||
config: VideoProcessingConfig,
|
|
||||||
stability_tracker: StabilityTracker,
|
|
||||||
video_converter: VideoConverter,
|
video_converter: VideoConverter,
|
||||||
nfo_generator: NfoGenerator,
|
nfo_generator: NfoGenerator,
|
||||||
divine_worship_name: String,
|
divine_worship_name: String,
|
||||||
|
@ -20,7 +18,6 @@ pub struct LivestreamArchiver {
|
||||||
impl LivestreamArchiver {
|
impl LivestreamArchiver {
|
||||||
pub fn new(output_path: PathBuf) -> Self {
|
pub fn new(output_path: PathBuf) -> Self {
|
||||||
let config = VideoProcessingConfig::from_env();
|
let config = VideoProcessingConfig::from_env();
|
||||||
let stability_tracker = StabilityTracker::new(config.clone());
|
|
||||||
let video_converter = VideoConverter::new(config.clone());
|
let video_converter = VideoConverter::new(config.clone());
|
||||||
let nfo_generator = NfoGenerator::new(config.clone());
|
let nfo_generator = NfoGenerator::new(config.clone());
|
||||||
|
|
||||||
|
@ -32,8 +29,6 @@ impl LivestreamArchiver {
|
||||||
|
|
||||||
LivestreamArchiver {
|
LivestreamArchiver {
|
||||||
output_path,
|
output_path,
|
||||||
config,
|
|
||||||
stability_tracker,
|
|
||||||
video_converter,
|
video_converter,
|
||||||
nfo_generator,
|
nfo_generator,
|
||||||
divine_worship_name,
|
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 {
|
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());
|
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);
|
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
|
// Don't delete original file
|
||||||
println!("Original file preserved at: {}", path.display());
|
println!("Original file preserved at: {}", path.display());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue