MovieMapper/Rust/examples/basic_scan.rs
Jarian Cottingham 323df5de2e feat: Add Rust implementation for performance-critical components
- Implement core Rust backend with FFmpeg integration
- Add TheTVDB API client with token caching
- Implement directory scanner with progress callbacks
- Create file manager with rename and move operations
- Add audit logging functionality
- Implement file mapping for TV episode renaming
- Build Node.js native addon via NAPI
- Include comprehensive unit and integration tests
- Update gitignore to exclude build artifacts and temp files

Resolves #TBD
2026-02-28 09:52:08 -06:00

42 lines
1.1 KiB
Rust

//! Example: Basic File Scanning
//!
//! This example demonstrates how to scan a directory for media files
//! and display basic information about each file.
use movie_mapper::service::FileScanner;
use std::env;
use std::path::Path;
#[tokio::main]
async fn main() {
// Get directory from command line or use current directory
let directory = env::args()
.nth(1)
.unwrap_or_else(|| env::current_dir().unwrap().to_string_lossy().to_string());
let directory = Path::new(&directory);
println!("Scanning directory: {:?}", directory);
// Create scanner
let scanner = FileScanner::new();
// Scan directory
match scanner.scan_directory(directory, None).await {
Ok(files) => {
println!("\nFound {} items:", files.len());
for file in &files {
if file.is_folder {
println!(" 📁 {}", file.name);
} else {
println!(" 🎬 {} ({} - {})", file.name, file.duration, file.quality);
}
}
}
Err(e) => {
eprintln!("Error scanning directory: {}", e);
}
}
}