MetadataConfig

Struct MetadataConfig 

Source
pub struct MetadataConfig {
Show 23 fields pub album_artist: bool, pub artist: bool, pub track_title: bool, pub track_number: bool, pub track_total: bool, pub disc_number: bool, pub disc_total: bool, pub album: bool, pub explicit: bool, pub upc: bool, pub isrc: bool, pub copyright: bool, pub composer: bool, pub genre: bool, pub release_year: bool, pub release_date: bool, pub comment: bool, pub cover_art: bool, pub label: bool, pub producer: bool, pub involved_people: bool, pub url: bool, pub media_type: bool,
}
Expand description

Configuration for metadata embedding in audio files.

This struct controls which metadata tags are written to audio files during the metadata embedding process. It provides fine-grained control over the embedding of various metadata fields, allowing users to customize which information is included in their audio files.

The configuration mirrors the options available in the original C# Qobuz application, ensuring compatibility and consistent behavior across implementations. Each field corresponds to a specific metadata tag that can be embedded in supported audio formats (FLAC, MP3, etc.).

§Usage

The MetadataConfig is used with the [embed_metadata_in_file] function to control which metadata fields are embedded:

use qobuz_api_rust::metadata::{MetadataConfig, embed_metadata_in_file};

// Create a custom configuration
let mut config = MetadataConfig::default();
config.comment = true;  // Enable comment embedding
config.explicit = false; // Disable explicit content flag

// Use the configuration when embedding metadata
// embed_metadata_in_file("path/to/file.flac", &track, &album, &artist, &config).await?;

§Format Considerations

The actual metadata tags written depend on the audio file format:

  • FLAC: Uses Vorbis Comments format
  • MP3: Uses ID3v2 format
  • Other formats: Default to ID3v2-compatible tagging

Some fields may have format-specific behavior (e.g., album artist handling differs between FLAC and MP3 to match the original C# implementation).

§Examples

Create a minimal configuration that only embeds essential metadata:

use qobuz_api_rust::metadata::MetadataConfig;

let minimal_config = MetadataConfig {
    album_artist: true,
    artist: true,
    track_title: true,
    album: true,
    track_number: true,
    disc_number: true,
    cover_art: true,
    ..Default::default()
};

Disable all metadata embedding (useful for privacy or minimal file size):

use qobuz_api_rust::metadata::MetadataConfig;

let no_metadata_config = MetadataConfig {
    album_artist: false,
    artist: false,
    track_title: false,
    track_number: false,
    track_total: false,
    disc_number: false,
    disc_total: false,
    album: false,
    explicit: false,
    upc: false,
    isrc: false,
    copyright: false,
    composer: false,
    genre: false,
    release_year: false,
    release_date: false,
    comment: false,
    cover_art: false,
    label: false,
    producer: false,
    involved_people: false,
    url: false,
    media_type: false,
};

Fields§

§album_artist: bool

Whether to embed the album artist name.

For FLAC files, this uses a single album artist name with conductor priority for classical music. For MP3 files, this combines all main artists with “/” separator.

§artist: bool

Whether to embed the track artist(s) name(s).

Combines artists from performers, main artist, and album artists while avoiding duplicates. Uses “, “ separator for FLAC and “/” for MP3.

§track_title: bool

Whether to embed the track title.

Includes the version information (e.g., “Remastered”, “Live”) if available, formatted as “Title (Version)”.

§track_number: bool

Whether to embed the track number within the album.

Corresponds to the track’s position in the album track listing.

§track_total: bool

Whether to embed the total number of tracks in the album.

Indicates the complete track count for the album.

§disc_number: bool

Whether to embed the disc number for multi-disc albums.

Also known as “media number” in Qobuz API terminology.

§disc_total: bool

Whether to embed the total number of discs in the album.

Indicates the complete disc count for multi-disc albums.

§album: bool

Whether to embed the album title.

Includes the version information if available, formatted as “Album Title (Version)”.

§explicit: bool

Whether to embed explicit content information.

Indicates if the track contains explicit content (parental warning).

§upc: bool

Whether to embed the Universal Product Code (UPC).

A barcode identifier for the album product.

§isrc: bool

Whether to embed the International Standard Recording Code (ISRC).

A unique identifier for the specific sound recording.

§copyright: bool

Whether to embed copyright information.

Contains the copyright notice for the track.

§composer: bool

Whether to embed composer information.

Combines composers from performers, track composer, and album composer while avoiding duplicates. Uses “/” separator for multiple composers.

§genre: bool

Whether to embed genre information.

Contains the primary musical genre of the album/track.

§release_year: bool

Whether to embed the release year.

Extracted from the most relevant date field (album release dates preferred, then track release dates, then timestamp).

§release_date: bool

Whether to embed the full release date.

For FLAC files, this uses the RecordingDate field (DATE in Vorbis Comments). For MP3 files, this uses the ReleaseDate field (TDRL in ID3v2).

§comment: bool

Whether to embed comment information.

Note: Disabled by default to match common user preferences and the original C# application defaults.

§cover_art: bool

Whether to embed album cover artwork.

Downloads and embeds the highest quality available album cover image, preferring mega > extralarge > large > medium > small > thumbnail sizes.

§label: bool

Whether to embed record label information.

Contains the name of the record label that released the album.

§producer: bool

Whether to embed producer information.

Note: Only embedded in FLAC files (as PRODUCER Vorbis Comments field). Extracted from performers with “Producer” role.

§involved_people: bool

Whether to embed involved people information.

Contains the complete performers string with names and roles (e.g., “Artist Name, MainArtist - Producer Name, Producer”).

§url: bool

Whether to embed the Qobuz product URL.

Creates a commercial information URL pointing to the album’s Qobuz page.

§media_type: bool

Whether to embed media type information.

Uses the album’s release_type if available, otherwise falls back to product_type. Common values include “album”, “single”, “compilation”, etc.

Trait Implementations§

Source§

impl Clone for MetadataConfig

Source§

fn clone(&self) -> MetadataConfig

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 MetadataConfig

Source§

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

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

impl Default for MetadataConfig

Source§

fn default() -> Self

Returns the default metadata configuration.

The default configuration enables most metadata fields to provide comprehensive metadata embedding, matching the behavior of the original C# Qobuz application. The only exception is the comment field, which is disabled by default based on common user preferences.

§Returns

A MetadataConfig instance with all fields set to true except comment which is set to false.

Source§

impl<'de> Deserialize<'de> for MetadataConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for MetadataConfig

Source§

fn eq(&self, other: &MetadataConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MetadataConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for MetadataConfig

Source§

impl StructuralPartialEq for MetadataConfig

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,