Don't crash if file has no tags.

Closes #33
This commit is contained in:
CDrummond committed 2025-06-15 13:21:49 +01:00
1 parent 4714f8f4ef
commit 2d2ddc7b17
4 files changed
+13 -3

No files matched your search

Generated
+1 -1
View File
@@ -180,7 +180,7 @@ dependencies = [
[[package]]
name = "bliss-analyser"
version = "0.4.0"
version = "0.4.1"
dependencies = [
"anyhow",
"argparse",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "bliss-analyser"
version = "0.4.0"
version = "0.4.1"
authors = ["Craig Drummond <craig.p.drummond@gmail.com>"]
edition = "2021"
license = "GPL-3.0-only"
+4
View File
@@ -1,3 +1,7 @@
0.4.1
-----
1. Don't crash if file has no tags.
0.4.0
-----
1. Add action to export results from DB to files.
+7 -1
View File
@@ -151,7 +151,13 @@ pub fn read(track: &String, read_analysis: bool) -> db::Metadata {
if let Ok(file) = lofty::read_from_path(Path::new(track)) {
let tag = match file.primary_tag() {
Some(primary_tag) => primary_tag,
None => file.first_tag().expect("Error: No tags found!"),
None => {
if let Some(first_tag) = file.first_tag() {
first_tag
} else {
return meta;
}
}
};
meta.title = tag.title().unwrap_or_default().to_string();