MovieMapper/Rust/examples/metadata_extraction.rs
Jarian Cottingham 6dd4e83ddf 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

37 lines
1.1 KiB
Rust

//! Example: File Metadata Extraction
//!
//! This example demonstrates how to extract metadata from media files
//! including duration, quality, and frame rate.
use movie_mapper::service::MetadataExtractor;
use std::env;
use std::path::Path;
#[tokio::main]
async fn main() {
// Get file path from command line
let file_path = env::args().nth(1).expect("Please provide a file path");
let path = Path::new(&file_path);
println!("Extracting metadata from: {:?}", path);
// Create extractor
let extractor = MetadataExtractor::new();
// Extract metadata
match extractor.extract_metadata(path) {
Ok(file) => {
println!("\nMetadata for '{}':", file.name);
println!(" Duration: {}", file.duration);
println!(" Quality: {}", file.quality);
println!(" FPS: {}", file.fps);
println!(" Size: {} bytes", file.size);
println!(" Modified: {:?}", file.modified);
}
Err(e) => {
eprintln!("Error extracting metadata: {}", e);
}
}
}