From 002503f0ac93d9979cb53585828af9d0b7359f33 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Thu, 31 Oct 2024 10:35:42 +0100 Subject: [PATCH 1/2] fix(lib::track::read_from_path): report probe reading errors --- CHANGELOG.md | 1 + lib/src/track.rs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d11f1fac..fe0fc1e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Feat(server): on rusty backend, enable `aiff` codec support. - Fix: change default config ip address to `::1` instead of `::` (any old values on windows will need to be changed manually) - Fix: check for other tag types instead of just the primary tag type (for example a wav file with riff metadata instead of id3v2 would not get metadata) +- Fix: report errors reading metadata to the log ### [V0.9.1] - Released on: August 21, 2024. diff --git a/lib/src/track.rs b/lib/src/track.rs index 564b74e5..6b66b952 100644 --- a/lib/src/track.rs +++ b/lib/src/track.rs @@ -144,7 +144,19 @@ impl Track { let probe = Probe::open(path)?; let mut song = Self::new(LocationType::Path(path.to_path_buf()), MediaType::Music); - if let Ok(mut tagged_file) = probe.read() { + let tagged_file = match probe.read() { + Ok(v) => Some(v), + Err(err) => { + warn!( + "Failed to read metadata from \"{}\": {}", + path.display(), + err + ); + None + } + }; + + if let Some(mut tagged_file) = tagged_file { // We can at most get the duration and file type at this point let properties = tagged_file.properties(); song.duration = properties.duration(); From 0cd9bc1ca2412f8254140bce66481bd6a14ca089 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Thu, 31 Oct 2024 10:37:13 +0100 Subject: [PATCH 2/2] fix(lib::track::read_from_path): exit early if for db no need to get the album photo for the database re 550aa5542de880aea3e572155342f45ae376ebae --- lib/src/track.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/track.rs b/lib/src/track.rs index 6b66b952..101f9b6f 100644 --- a/lib/src/track.rs +++ b/lib/src/track.rs @@ -171,6 +171,11 @@ impl Track { } } + // exit early if its for db only as no cover is needed there + if for_db { + return Ok(song); + } + let parent_folder = get_parent_folder(path); if let Ok(files) = std::fs::read_dir(parent_folder) {