Struct AudioFile

Source
pub struct AudioFile {
    pub id: Id,
    pub path: String,
    pub size: u64,
    pub mtime: u64,
    pub properties: AudioProperties,
    pub has_embedded_art: bool,
    pub tags: BTreeMap<String, Vec<String>>,
    pub lyrics_path: Option<String>,
    pub integrity: Option<IntegrityRecord>,
    pub fingerprint: Option<Fingerprint>,
}
Expand description

A file on disk, with its technical properties and its raw tags.

The raw tags are kept: they allow the whole graph to be rebuilt without rereading the files, which is what makes incremental scanning possible.

Fields§

§id: Id

Position in Catalog::files; this is what a track points back to.

§path: String

Absolute path in the scanner’s native spelling, including Windows verbatim prefixes. Use text path helpers for catalog string operations.

§size: u64

Size in bytes; together with AudioFile::mtime and the catalog’s Catalog::file_mtime_subseconds it decides whether a later scan can reuse the stored tags.

§mtime: u64

Modification date, in seconds since the Unix epoch.

§properties: AudioProperties

Description of the stream itself: codec, sample rate, duration.

§has_embedded_art: bool

Whether cover art sits inside the file; when it does not, the release may still carry an image found beside it.

§tags: BTreeMap<String, Vec<String>>

Tags as read, lowercase name to values, kept so that the whole graph can be rebuilt without touching the disk again.

§lyrics_path: Option<String>

A .lrc sitting beside the file, when there is one.

The path, not the text. Lyrics carried by a tag are already in the catalog — raw tags are kept per file — but a sidecar is not in the file, and storing its contents as though it were a tag would make the catalog lie about what the file says. It is one small text file next to the music; reading it when somebody asks costs nothing and is always current.

§integrity: Option<IntegrityRecord>

What the last integrity check concluded, if one was ever run.

None means “not checked”, which is deliberately distinct from audit::integrity::Verdict::NothingToCheck: the first can change, the second cannot. The verdict travels with the file entry, so a scan that reuses the entry keeps it and a scan that re-reads the file drops it — a modified file has to be checked again.

§fingerprint: Option<Fingerprint>

The acoustic fingerprint of this file, once one has been computed.

Beside the integrity verdict and for the same reason: both are Aède’s own conclusions about the bytes, worked out rather than fetched, and both are expensive enough that recomputing them on every scan would be unthinkable. So both travel with the file entry — a scan that reuses the entry keeps them, a scan that re-reads the file drops them, because a modified file is different audio and its old fingerprint describes something that is no longer there.

What AcoustID says when shown one is a different kind of thing — somebody else’s claim — and lives in sources.json with every other source’s.

Implementations§

Source§

impl AudioFile

Source

pub fn folder(&self) -> &str

Containing directory, the strongest grouping clue after the tags.

Source

pub fn file_name(&self) -> &str

Last path component, extension included.

Source

pub fn first_tag(&self, key: &str) -> Option<&str>

First value of a tag, for the many fields where repetition carries no meaning and only the leading value is wanted.

Trait Implementations§

Source§

impl Clone for AudioFile

Source§

fn clone(&self) -> AudioFile

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AudioFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AudioFile

Source§

fn default() -> AudioFile

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,