Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report track probe errors #383

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
- 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
- Fix: correctly write LRC milliseconds.
- Fix: change Lyric::adjust_offset to not work invertedly for below 10 seconds anymore.
- Fix(tui): base "no lyrics available" message on the same value as actual parsed lyrics.


### [V0.9.1]
- Released on: August 21, 2024.
- Change: enable `log-to-file` by default.
Expand Down
19 changes: 18 additions & 1 deletion lib/src/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -159,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) {
Expand Down