Fix utf8 panic in the library module
This commit is contained in:
parent
cefd48021f
commit
f82c98a12e
|
@ -3,7 +3,8 @@
|
||||||
## bliss 0.6.10
|
## bliss 0.6.10
|
||||||
* Make the `analyze` function public, for people who don't want to use
|
* Make the `analyze` function public, for people who don't want to use
|
||||||
ffmpeg
|
ffmpeg
|
||||||
* Run `cargo update`
|
* Run `cargo update`, bump ffmpeg to 6.1
|
||||||
|
* Fix the library module erroring when wrong UTF-8 ends up in the database.
|
||||||
|
|
||||||
## bliss 0.6.9
|
## bliss 0.6.9
|
||||||
* Add a feature flag for compilation on raspberry pis.
|
* Add a feature flag for compilation on raspberry pis.
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -112,7 +112,7 @@ checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bliss-audio"
|
name = "bliss-audio"
|
||||||
version = "0.6.9"
|
version = "0.6.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bliss-audio-aubio-rs",
|
"bliss-audio-aubio-rs",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bliss-audio"
|
name = "bliss-audio"
|
||||||
version = "0.6.9"
|
version = "0.6.10"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
authors = ["Polochon-street <polochonstreet@gmx.fr>"]
|
authors = ["Polochon-street <polochonstreet@gmx.fr>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
@ -40,8 +40,8 @@ serde = ["dep:serde"]
|
||||||
# Hopefully we'll be able to use the official aubio-rs at some point.
|
# Hopefully we'll be able to use the official aubio-rs at some point.
|
||||||
bliss-audio-aubio-rs = "0.2.1"
|
bliss-audio-aubio-rs = "0.2.1"
|
||||||
crossbeam = "0.8.2"
|
crossbeam = "0.8.2"
|
||||||
ffmpeg-next = "6.0.0"
|
ffmpeg-next = "6.1.0"
|
||||||
ffmpeg-sys-next = { version = "6.0.1", default-features = false }
|
ffmpeg-sys-next = { version = "6.1.0", default-features = false }
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
ndarray = { version = "0.15.6", features = ["rayon"] }
|
ndarray = { version = "0.15.6", features = ["rayon"] }
|
||||||
num_cpus = "1.15.0"
|
num_cpus = "1.15.0"
|
||||||
|
|
|
@ -1081,12 +1081,42 @@ impl<Config: AppConfigTrait> Library<Config> {
|
||||||
|
|
||||||
let song = Song {
|
let song = Song {
|
||||||
path: PathBuf::from(path),
|
path: PathBuf::from(path),
|
||||||
artist: row.get(1).unwrap(),
|
artist: row
|
||||||
title: row.get(2).unwrap(),
|
.get_ref(1)
|
||||||
album: row.get(3).unwrap(),
|
.unwrap()
|
||||||
album_artist: row.get(4).unwrap(),
|
.as_bytes_or_null()
|
||||||
track_number: row.get(5).unwrap(),
|
.unwrap()
|
||||||
genre: row.get(6).unwrap(),
|
.map(|v| String::from_utf8_lossy(v).to_string()),
|
||||||
|
title: row
|
||||||
|
.get_ref(2)
|
||||||
|
.unwrap()
|
||||||
|
.as_bytes_or_null()
|
||||||
|
.unwrap()
|
||||||
|
.map(|v| String::from_utf8_lossy(v).to_string()),
|
||||||
|
album: row
|
||||||
|
.get_ref(3)
|
||||||
|
.unwrap()
|
||||||
|
.as_bytes_or_null()
|
||||||
|
.unwrap()
|
||||||
|
.map(|v| String::from_utf8_lossy(v).to_string()),
|
||||||
|
album_artist: row
|
||||||
|
.get_ref(4)
|
||||||
|
.unwrap()
|
||||||
|
.as_bytes_or_null()
|
||||||
|
.unwrap()
|
||||||
|
.map(|v| String::from_utf8_lossy(v).to_string()),
|
||||||
|
track_number: row
|
||||||
|
.get_ref(5)
|
||||||
|
.unwrap()
|
||||||
|
.as_bytes_or_null()
|
||||||
|
.unwrap()
|
||||||
|
.map(|v| String::from_utf8_lossy(v).to_string()),
|
||||||
|
genre: row
|
||||||
|
.get_ref(6)
|
||||||
|
.unwrap()
|
||||||
|
.as_bytes_or_null()
|
||||||
|
.unwrap()
|
||||||
|
.map(|v| String::from_utf8_lossy(v).to_string()),
|
||||||
analysis: Analysis {
|
analysis: Analysis {
|
||||||
internal_analysis: [0.; NUMBER_FEATURES],
|
internal_analysis: [0.; NUMBER_FEATURES],
|
||||||
},
|
},
|
||||||
|
@ -1287,6 +1317,8 @@ fn data_local_dir() -> Option<PathBuf> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
// TODO refactor (especially the helper functions)
|
// TODO refactor (especially the helper functions)
|
||||||
|
// TODO the tests should really open a songs.db
|
||||||
|
// TODO test with invalid UTF-8
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{Analysis, NUMBER_FEATURES};
|
use crate::{Analysis, NUMBER_FEATURES};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user