mirror of
https://github.com/CDrummond/bliss-analyser.git
synced 2025-04-13 07:27:13 +03:00
Add excplcit 'ffmpeg' feature flag.
This commit is contained in:
parent
302609ed1b
commit
7ea6c3befd
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build x86 ffmpeg version
|
- name: Build x86 ffmpeg version
|
||||||
run: |
|
run: |
|
||||||
cargo build --release
|
cargo build --release --features=ffmpeg
|
||||||
strip target/release/bliss-analyser
|
strip target/release/bliss-analyser
|
||||||
mkdir releases
|
mkdir releases
|
||||||
cp target/release/bliss-analyser releases/bliss-analyser
|
cp target/release/bliss-analyser releases/bliss-analyser
|
||||||
@ -202,10 +202,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cargo build --release --features update-aubio-bindings
|
cargo build --release --features ffmpeg,update-aubio-bindings
|
||||||
strip target/release/bliss-analyser
|
strip target/release/bliss-analyser
|
||||||
cp target/release/bliss-analyser releases/bliss-analyser-x86_64
|
cp target/release/bliss-analyser releases/bliss-analyser-x86_64
|
||||||
cargo build --target=aarch64-apple-darwin --release --features update-aubio-bindings
|
cargo build --target=aarch64-apple-darwin --release --features ffmpeg,update-aubio-bindings
|
||||||
strip target/aarch64-apple-darwin/release/bliss-analyser
|
strip target/aarch64-apple-darwin/release/bliss-analyser
|
||||||
cp target/aarch64-apple-darwin/release/bliss-analyser releases/bliss-analyser-arm64
|
cp target/aarch64-apple-darwin/release/bliss-analyser releases/bliss-analyser-arm64
|
||||||
|
|
||||||
|
@ -25,14 +25,16 @@ ureq = "2.4.0"
|
|||||||
configparser = "3.0.0"
|
configparser = "3.0.0"
|
||||||
if_chain = "1.0.2"
|
if_chain = "1.0.2"
|
||||||
num_cpus = "1.13.0"
|
num_cpus = "1.13.0"
|
||||||
which = "7.0.2"
|
which = { "7.0.2", optional = true }
|
||||||
rcue = "0.1.3"
|
rcue = { "0.1.3", optional = true }
|
||||||
hhmmss = "0.1.0"
|
hhmmss = { "0.1.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["libav"]
|
||||||
libav = ["bliss-audio/ffmpeg"]
|
libav = ["bliss-audio/ffmpeg"]
|
||||||
update-aubio-bindings = ["bliss-audio/update-aubio-bindings"]
|
update-aubio-bindings = ["bliss-audio/update-aubio-bindings"]
|
||||||
staticlibav = ["bliss-audio/build-ffmpeg", "bliss-audio/ffmpeg-static"]
|
staticlibav = ["bliss-audio/build-ffmpeg", "bliss-audio/ffmpeg-static"]
|
||||||
|
ffmpeg = ["dep:which", "dep:rcue", "dep:hhmmss"]
|
||||||
|
|
||||||
[dependencies.bliss-audio]
|
[dependencies.bliss-audio]
|
||||||
default-features = false
|
default-features = false
|
||||||
|
@ -34,7 +34,7 @@ To install dependencies on a Fedora system:
|
|||||||
dnf install clang pkg-config
|
dnf install clang pkg-config
|
||||||
```
|
```
|
||||||
|
|
||||||
Build with `cargo build --release`
|
Build with `cargo build --release --features=ffmpeg`
|
||||||
|
|
||||||
`ffmpeg` is then a run-time dependency, and should be installed on any system where this application
|
`ffmpeg` is then a run-time dependency, and should be installed on any system where this application
|
||||||
is to be run - it should also be in the users `$PATH`
|
is to be run - it should also be in the users `$PATH`
|
||||||
|
@ -14,7 +14,7 @@ function build {
|
|||||||
if [[ ! -f /build/$1/release/bliss-analyser ]]; then
|
if [[ ! -f /build/$1/release/bliss-analyser ]]; then
|
||||||
export RUST_BACKTRACE=full
|
export RUST_BACKTRACE=full
|
||||||
export PKG_CONFIG=${1//unknown-/}-pkg-config
|
export PKG_CONFIG=${1//unknown-/}-pkg-config
|
||||||
BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/${1//unknown-/}" cargo build --release --target $1
|
BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/${1//unknown-/}" cargo build --release --features=ffmpeg --target $1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$2 /build/$1/release/bliss-analyser && cp /build/$1/release/bliss-analyser $DESTDIR/$3
|
$2 /build/$1/release/bliss-analyser && cp /build/$1/release/bliss-analyser $DESTDIR/$3
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
use crate::cue;
|
use crate::cue;
|
||||||
use crate::db;
|
use crate::db;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use crate::ffmpeg;
|
use crate::ffmpeg;
|
||||||
use crate::tags;
|
use crate::tags;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use hhmmss::Hhmmss;
|
use hhmmss::Hhmmss;
|
||||||
use if_chain::if_chain;
|
use if_chain::if_chain;
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
@ -23,18 +23,18 @@ use std::fs::{DirEntry, File};
|
|||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use std::sync::mpsc::{Receiver, Sender};
|
use std::sync::mpsc::{Receiver, Sender};
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use std::thread;
|
use std::thread;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use num_cpus;
|
use num_cpus;
|
||||||
#[cfg(feature = "libav")]
|
#[cfg(feature = "libav")]
|
||||||
use bliss_audio::{decoder::Decoder, decoder::ffmpeg::FFmpeg};
|
use bliss_audio::{decoder::Decoder, decoder::ffmpeg::FFmpeg};
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use bliss_audio::{decoder::Decoder, BlissResult, Song};
|
use bliss_audio::{decoder::Decoder, BlissResult, Song};
|
||||||
|
|
||||||
const DONT_ANALYSE: &str = ".notmusic";
|
const DONT_ANALYSE: &str = ".notmusic";
|
||||||
@ -92,7 +92,7 @@ fn check_dir_entry(db: &mut db::Db, mpath: &Path, entry: DirEntry, track_paths:
|
|||||||
*file_count+=1;
|
*file_count+=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
if id<=0 {
|
if id<=0 {
|
||||||
let this_cue_tracks = cue::parse(&pb, &cue_file);
|
let this_cue_tracks = cue::parse(&pb, &cue_file);
|
||||||
for track in this_cue_tracks {
|
for track in this_cue_tracks {
|
||||||
@ -255,7 +255,7 @@ fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>, max
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>, max_threads: usize, use_tags: bool) -> Result<()> {
|
fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>, max_threads: usize, use_tags: bool) -> Result<()> {
|
||||||
let total = track_paths.len();
|
let total = track_paths.len();
|
||||||
let progress = ProgressBar::new(total.try_into().unwrap()).with_style(
|
let progress = ProgressBar::new(total.try_into().unwrap()).with_style(
|
||||||
@ -314,7 +314,7 @@ fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec<String>, max
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
fn analyze_cue_streaming(tracks: Vec<cue::CueTrack>,) -> BlissResult<Receiver<(cue::CueTrack, BlissResult<Song>)>> {
|
fn analyze_cue_streaming(tracks: Vec<cue::CueTrack>,) -> BlissResult<Receiver<(cue::CueTrack, BlissResult<Song>)>> {
|
||||||
let num_cpus = num_cpus::get();
|
let num_cpus = num_cpus::get();
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ fn analyze_cue_streaming(tracks: Vec<cue::CueTrack>,) -> BlissResult<Receiver<(c
|
|||||||
Ok(rx)
|
Ok(rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
fn analyse_new_cue_tracks(db:&db::Db, mpath: &PathBuf, cue_tracks:Vec<cue::CueTrack>) -> Result<()> {
|
fn analyse_new_cue_tracks(db:&db::Db, mpath: &PathBuf, cue_tracks:Vec<cue::CueTrack>) -> Result<()> {
|
||||||
let total = cue_tracks.len();
|
let total = cue_tracks.len();
|
||||||
let progress = ProgressBar::new(total.try_into().unwrap()).with_style(
|
let progress = ProgressBar::new(total.try_into().unwrap()).with_style(
|
||||||
@ -455,7 +455,7 @@ pub fn analyse_files(db_path: &str, mpaths: &Vec<PathBuf>, dry_run: bool, keep_o
|
|||||||
log::info!("No new files to analyse");
|
log::info!("No new files to analyse");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
if !cue_tracks.is_empty() {
|
if !cue_tracks.is_empty() {
|
||||||
match analyse_new_cue_tracks(&db, &mpath, cue_tracks) {
|
match analyse_new_cue_tracks(&db, &mpath, cue_tracks) {
|
||||||
Ok(_) => { changes_made = true; },
|
Ok(_) => { changes_made = true; },
|
||||||
|
14
src/cue.rs
14
src/cue.rs
@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
extern crate rcue;
|
extern crate rcue;
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use crate::db;
|
use crate::db;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use rcue::parser::parse_from_file;
|
use rcue::parser::parse_from_file;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
pub const LAST_TRACK_DURATION:u64 = 60*60*24;
|
pub const LAST_TRACK_DURATION:u64 = 60*60*24;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
const GENRE:&str = "GENRE";
|
const GENRE:&str = "GENRE";
|
||||||
|
|
||||||
#[cfg(feature = "libav")]
|
#[cfg(feature = "libav")]
|
||||||
@ -27,7 +27,7 @@ pub struct CueTrack {
|
|||||||
pub track_path:PathBuf
|
pub track_path:PathBuf
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CueTrack {
|
pub struct CueTrack {
|
||||||
pub audio_path:PathBuf,
|
pub audio_path:PathBuf,
|
||||||
@ -41,7 +41,7 @@ pub struct CueTrack {
|
|||||||
pub duration:Duration
|
pub duration:Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
pub fn parse(audio_path:&PathBuf, cue_path:&PathBuf) -> Vec<CueTrack> {
|
pub fn parse(audio_path:&PathBuf, cue_path:&PathBuf) -> Vec<CueTrack> {
|
||||||
let mut resp:Vec<CueTrack> = Vec::new();
|
let mut resp:Vec<CueTrack> = Vec::new();
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use crate::ffmpeg;
|
use crate::ffmpeg;
|
||||||
use crate::tags;
|
use crate::tags;
|
||||||
use bliss_audio::{Analysis, AnalysisIndex};
|
use bliss_audio::{Analysis, AnalysisIndex};
|
||||||
@ -288,7 +288,7 @@ impl Db {
|
|||||||
let path = String::from(track_path.to_string_lossy());
|
let path = String::from(track_path.to_string_lossy());
|
||||||
let mut ftags = tags::read(&path, false);
|
let mut ftags = tags::read(&path, false);
|
||||||
|
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
if ftags.is_empty() {
|
if ftags.is_empty() {
|
||||||
ftags = ffmpeg::read_tags(&path);
|
ftags = ffmpeg::read_tags(&path);
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,12 @@ use log::LevelFilter;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process;
|
use std::process;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
use which::which;
|
use which::which;
|
||||||
mod analyse;
|
mod analyse;
|
||||||
mod cue;
|
mod cue;
|
||||||
mod db;
|
mod db;
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
mod ffmpeg;
|
mod ffmpeg;
|
||||||
mod tags;
|
mod tags;
|
||||||
mod upload;
|
mod upload;
|
||||||
@ -104,7 +104,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure ffmpeg is in PATH...
|
// Ensure ffmpeg is in PATH...
|
||||||
#[cfg(not(feature = "libav"))]
|
#[cfg(feature = "ffmpeg")]
|
||||||
match which("ffmpeg") {
|
match which("ffmpeg") {
|
||||||
Ok(_) => { }
|
Ok(_) => { }
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user