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: boolWhether 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: boolWhether 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: boolWhether to embed the track title.
Includes the version information (e.g., “Remastered”, “Live”) if available, formatted as “Title (Version)”.
track_number: boolWhether to embed the track number within the album.
Corresponds to the track’s position in the album track listing.
track_total: boolWhether to embed the total number of tracks in the album.
Indicates the complete track count for the album.
disc_number: boolWhether to embed the disc number for multi-disc albums.
Also known as “media number” in Qobuz API terminology.
disc_total: boolWhether to embed the total number of discs in the album.
Indicates the complete disc count for multi-disc albums.
album: boolWhether to embed the album title.
Includes the version information if available, formatted as “Album Title (Version)”.
explicit: boolWhether to embed explicit content information.
Indicates if the track contains explicit content (parental warning).
upc: boolWhether to embed the Universal Product Code (UPC).
A barcode identifier for the album product.
isrc: boolWhether to embed the International Standard Recording Code (ISRC).
A unique identifier for the specific sound recording.
copyright: boolWhether to embed copyright information.
Contains the copyright notice for the track.
composer: boolWhether to embed composer information.
Combines composers from performers, track composer, and album composer while avoiding duplicates. Uses “/” separator for multiple composers.
genre: boolWhether to embed genre information.
Contains the primary musical genre of the album/track.
release_year: boolWhether to embed the release year.
Extracted from the most relevant date field (album release dates preferred, then track release dates, then timestamp).
release_date: boolWhether 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: boolWhether to embed comment information.
Note: Disabled by default to match common user preferences and the original C# application defaults.
cover_art: boolWhether to embed album cover artwork.
Downloads and embeds the highest quality available album cover image, preferring mega > extralarge > large > medium > small > thumbnail sizes.
label: boolWhether to embed record label information.
Contains the name of the record label that released the album.
producer: boolWhether to embed producer information.
Note: Only embedded in FLAC files (as PRODUCER Vorbis Comments field). Extracted from performers with “Producer” role.
involved_people: boolWhether to embed involved people information.
Contains the complete performers string with names and roles (e.g., “Artist Name, MainArtist - Producer Name, Producer”).
url: boolWhether to embed the Qobuz product URL.
Creates a commercial information URL pointing to the album’s Qobuz page.
media_type: boolWhether 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
impl Clone for MetadataConfig
Source§fn clone(&self) -> MetadataConfig
fn clone(&self) -> MetadataConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetadataConfig
impl Debug for MetadataConfig
Source§impl Default for MetadataConfig
impl Default for MetadataConfig
Source§fn default() -> Self
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
impl<'de> Deserialize<'de> for MetadataConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MetadataConfig
impl PartialEq for MetadataConfig
Source§impl Serialize for MetadataConfig
impl Serialize for MetadataConfig
impl Eq for MetadataConfig
impl StructuralPartialEq for MetadataConfig
Auto Trait Implementations§
impl Freeze for MetadataConfig
impl RefUnwindSafe for MetadataConfig
impl Send for MetadataConfig
impl Sync for MetadataConfig
impl Unpin for MetadataConfig
impl UnwindSafe for MetadataConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.