mp3rgain 3.7.0

Lossless MP3 volume adjustment - a modern mp3gain replacement written in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::path::Path;

/// Extract filename from path, returning "unknown" if extraction fails
pub fn get_filename(path: &Path) -> &str {
    path.file_name()
        .and_then(|n| n.to_str())
        .unwrap_or("unknown")
}

/// Path as given on the command line, for machine-readable output.
///
/// TSV rows used to print the bare filename, which is ambiguous as soon as
/// more than one directory is scanned in a single run (reported on the
/// Hydrogenaudio forum). JSON has always carried the full path; TSV now
/// matches it.
pub fn get_path(path: &Path) -> std::borrow::Cow<'_, str> {
    path.to_string_lossy()
}