Compare commits

...

1 Commits

Author SHA1 Message Date
Connor Johnstone
1d1674e3a1 Updates for the "full flow" 2026-03-17 21:38:47 -04:00

View File

@@ -32,11 +32,30 @@ async fn process_file(
// Extract metadata (CPU-bound, run in blocking thread) // Extract metadata (CPU-bound, run in blocking thread)
let path = scanned.path.clone(); let path = scanned.path.clone();
let meta: MusicMetadata = tokio::task::spawn_blocking(move || { let mut meta: MusicMetadata = tokio::task::spawn_blocking(move || {
metadata::extract_metadata(&path) metadata::extract_metadata(&path)
}) })
.await??; .await??;
// Fallback: if missing title or artist from tags, try parsing from filename ("Artist - Title.ext")
if meta.title.is_none() || meta.artist.is_none() {
if let Some(stem) = scanned.path.file_stem().and_then(|s| s.to_str()) {
if let Some((artist, title)) = stem.split_once(" - ") {
let artist = artist.trim();
let title = title.trim();
if !artist.is_empty() && !title.is_empty() {
tracing::debug!(path = %file_path_str, artist = artist, title = title, "parsed metadata from filename");
if meta.artist.is_none() {
meta.artist = Some(artist.to_string());
}
if meta.title.is_none() {
meta.title = Some(title.to_string());
}
}
}
}
}
tracing::info!( tracing::info!(
path = %file_path_str, path = %file_path_str,
title = ?meta.title, title = ?meta.title,