Some fixes for the new CI

This commit is contained in:
Polochon-street 2022-02-17 22:43:28 +01:00
parent 80f4ed11aa
commit 51e8cf9344
5 changed files with 28 additions and 30 deletions

View file

@ -34,6 +34,10 @@ jobs:
run: cargo +nightly-2022-02-16 bench --verbose --features=bench --no-run
- name: Build examples
run: cargo build --examples --verbose --features=serde
- name: Lint
run: cargo clippy --examples --features=serde -- -D warnings
- name: Check format
run: cargo fmt -- --check
build-test-lint-windows:
name: Windows - build, test and lint
@ -65,14 +69,10 @@ jobs:
override: true
components: rustfmt, clippy
- name: Build
run: |
cargo build --examples
run: cargo build --examples
- name: Test
run: |
cargo test --examples
run: cargo test --examples --features=serde
- name: Lint
run: |
cargo clippy --examples -- -D warnings
run: cargo clippy --examples --features=serde -- -D warnings
- name: Check format
run: |
cargo fmt -- --check
run: cargo fmt -- --check

View file

@ -1,13 +1,20 @@
#[cfg(feature = "serde")]
use anyhow::Result;
#[cfg(feature = "serde")]
use bliss_audio::distance::{closest_to_first_song, dedup_playlist, euclidean_distance};
#[cfg(feature = "serde")]
use bliss_audio::{library::analyze_paths_streaming, Song};
#[cfg(feature = "serde")]
use clap::{App, Arg};
#[cfg(feature = "serde")]
use glob::glob;
use mime_guess;
use serde_json;
#[cfg(feature = "serde")]
use std::env;
#[cfg(feature = "serde")]
use std::fs;
#[cfg(feature = "serde")]
use std::io::BufReader;
#[cfg(feature = "serde")]
use std::path::{Path, PathBuf};
/* Analyzes a folder recursively, and make a playlist out of the file

View file

@ -207,13 +207,13 @@ fn chroma_filter(
wts *= &freq_bins;
// np.roll(), np bro
let mut uninit: Vec<f64> = Vec::with_capacity((&wts).len());
let mut uninit: Vec<f64> = vec![0.; (&wts).len()];
unsafe {
uninit.set_len(wts.len());
}
let mut b = Array::from(uninit)
.into_shape(wts.dim())
.map_err(|e| BlissError::AnalysisError(format!("in chroma: {}", e.to_string())))?;
.map_err(|e| BlissError::AnalysisError(format!("in chroma: {}", e)))?;
b.slice_mut(s![-3.., ..]).assign(&wts.slice(s![..3, ..]));
b.slice_mut(s![..-3, ..]).assign(&wts.slice(s![3.., ..]));
@ -308,7 +308,7 @@ fn pitch_tuning(
}
let max_index = counts
.argmax()
.map_err(|e| BlissError::AnalysisError(format!("in chroma: {}", e.to_string())))?;
.map_err(|e| BlissError::AnalysisError(format!("in chroma: {}", e)))?;
// Return the bin with the most reoccuring frequency.
Ok((-50. + (100. * resolution * max_index as f64)) / 100.)
@ -332,7 +332,7 @@ fn estimate_tuning(
let threshold: N64 = Array::from(filtered_mag.to_vec())
.quantile_axis_mut(Axis(0), n64(0.5), &Midpoint)
.map_err(|e| BlissError::AnalysisError(format!("in chroma: {}", e.to_string())))?
.map_err(|e| BlissError::AnalysisError(format!("in chroma: {}", e)))?
.into_scalar();
let mut pitch = filtered_pitch

View file

@ -48,10 +48,7 @@ impl BPMDesc {
sample_rate,
)
.map_err(|e| {
BlissError::AnalysisError(format!(
"error while loading aubio tempo object: {}",
e.to_string()
))
BlissError::AnalysisError(format!("error while loading aubio tempo object: {}", e))
})?,
bpms: Vec::new(),
})
@ -59,10 +56,7 @@ impl BPMDesc {
pub fn do_(&mut self, chunk: &[f32]) -> BlissResult<()> {
let result = self.aubio_obj.do_result(chunk).map_err(|e| {
BlissError::AnalysisError(format!(
"aubio error while computing tempo {}",
e.to_string()
))
BlissError::AnalysisError(format!("aubio error while computing tempo {}", e))
})?;
if result > 0. {

View file

@ -126,21 +126,21 @@ impl SpectralDesc {
.map_err(|e| {
BlissError::AnalysisError(format!(
"error while loading aubio centroid object: {}",
e.to_string()
e
))
})?,
rolloff_aubio_desc: SpecDesc::new(SpecShape::Rolloff, SpectralDesc::WINDOW_SIZE)
.map_err(|e| {
BlissError::AnalysisError(format!(
"error while loading aubio rolloff object: {}",
e.to_string()
e
))
})?,
phase_vocoder: PVoc::new(SpectralDesc::WINDOW_SIZE, SpectralDesc::HOP_SIZE).map_err(
|e| {
BlissError::AnalysisError(format!(
"error while loading aubio pvoc object: {}",
e.to_string()
e
))
},
)?,
@ -163,10 +163,7 @@ impl SpectralDesc {
self.phase_vocoder
.do_(chunk, fftgrain.as_mut_slice())
.map_err(|e| {
BlissError::AnalysisError(format!(
"error while processing aubio pv object: {}",
e.to_string()
))
BlissError::AnalysisError(format!("error while processing aubio pv object: {}", e))
})?;
let bin = self
@ -175,7 +172,7 @@ impl SpectralDesc {
.map_err(|e| {
BlissError::AnalysisError(format!(
"error while processing aubio centroid object: {}",
e.to_string()
e
))
})?;