fn read_metadata(&mut self, tags: &gst::TagList) {
        self.album_title = match tags.get::<gst::tags::Album>() {
            Some(album) => album.get().to_string(),
            None => "Unknown album".to_string(),
        };

        self.artist = match tags.get::<gst::tags::Artist>() {
            Some(artist) => artist.get().to_string(),
            None => "Unknown artist".to_string(),
        };

        self.album_artist = match tags.get::<gst::tags::AlbumArtist>() {
            Some(artist) => artist.get().to_string(),
            None => self.artist.to_string(),
        };

        // If title is not found, fallback to basename
        self.title = match tags.get::<gst::tags::Title>() {
            Some(title) => title.get().to_string(),
            None => format!("{:?}", self.path.file_stem().unwrap_or_default())
                .trim_matches('"')
                .to_string(),
        };

        self.track_number = tags
            .get::<gst::tags::TrackNumber>()
            .map(|v| v.get())
            .unwrap_or_default();

        self.year = tags.get::<gst::tags::DateTime>().map(|v| v.get().year());

        self.album_info = match self.year {
            Some(year) => format!("{}: {} ({})", self.album_artist, self.album_title, year),
            None => format!("{}: {}", self.album_artist, self.album_title),
        };
    }
/// Populates the `Song`s metadata information from
/// the provided `TagList`.
Populates the `Song`s metadata information from
the provided `TagList`.
Populates the ` Song ` s metadata information from the provided ` TagList ` .
fn read_metadata(&mut self, tags: &gst::TagList) {
        self.album_title = match tags.get::<gst::tags::Album>() {
            Some(album) => album.get().to_string(),
            None => "Unknown album".to_string(),
        };
        self.artist = match tags.get::<gst::tags::Artist>() {
            Some(artist) => artist.get().to_string(),
            None => "Unknown artist".to_string(),
        };
        self.album_artist = match tags.get::<gst::tags::AlbumArtist>() {
            Some(artist) => artist.get().to_string(),
            None => self.artist.to_string(),
        };
        // If title is not found, fallback to basename
        self.title = match tags.get::<gst::tags::Title>() {
            Some(title) => title.get().to_string(),
            None => format!("{:?}", self.path.file_stem().unwrap_or_default())
                .trim_matches('"')
                .to_string(),
        };
        self.track_number = tags
            .get::<gst::tags::TrackNumber>()
            .map(|v| v.get())
            .unwrap_or_default();
        self.year = tags.get::<gst::tags::DateTime>().map(|v| v.get().year());
        self.album_info = match self.year {
            Some(year) => format!("{}: {} ({})", self.album_artist, self.album_title, year),
            None => format!("{}: {}", self.album_artist, self.album_title),
        };
    }
fn read_metadata ( & mut self , tags : & gst :: TagList ) { self . album_title = match tags . get :: < gst :: tags :: Album > ( ) { Some ( album ) => album . get ( ) . to_string ( ) , None => " " . to_string ( ) , } ; self . artist = match tags . get :: < gst :: tags :: Artist > ( ) { Some ( artist ) => artist . get ( ) . to_string ( ) , None => " " . to_string ( ) , } ; self . album_artist = match tags . get :: < gst :: tags :: AlbumArtist > ( ) { Some ( artist ) => artist . get ( ) . to_string ( ) , None => self . artist . to_string ( ) , } ; // If title is not found, fallback to basename self . title = match tags . get :: < gst :: tags :: Title > ( ) { Some ( title ) => title . get ( ) . to_string ( ) , None => format ! ( " " self path file_stem ( ) unwrap_or_default ( ) ) . trim_matches ( '"' ) . to_string ( ) , } ; self . track_number = tags . get :: < gst :: tags :: TrackNumber > ( ) . map ( | v | v . get ( ) ) . unwrap_or_default ( ) ; self . year = tags . get :: < gst :: tags :: DateTime > ( ) . map ( | v | v . get ( ) . year ( ) ) ; self . album_info = match self . year { Some ( year ) => format ! ( " " self album_artist self album_title year ) , None => format ! ( " " self album_artist self album_title ) , } ; }
Populates the `Song`s metadata information from
the provided `TagList`.
Populates the ` Song ` s metadata information from the provided ` TagList ` .
&mut self
tags
&gst::TagList