caesura 0.20.0

An all-in-one command line tool to **transcode FLAC** audio files and **upload to gazelle** based indexers/trackers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::fs::{get_vorbis_tags, FlacFile};
use crate::naming::Sanitizer;
use lofty::prelude::Accessor;

pub struct TrackName;

impl TrackName {
    #[must_use]
    pub fn get(flac: &FlacFile) -> Option<String> {
        let tags = get_vorbis_tags(flac).ok()?;
        let track_number = tags.track()?;
        let title = tags.title()?;
        let file_name = format!("{track_number:0>2} {title}");
        Some(Sanitizer::execute(file_name))
    }
}