pub fn write_tag(discogs: &mut Discogs, config: &TaggerConfig, info: &MusicFileInfo, release: &ReleaseMaster, track: &Track) -> Result<(), Box<dyn std::error::Error>> {
    //Get tag by type
    let mut tag = match info.tag {
        MusicFileType::FLAC => return write_flac_tag(discogs, config, &info.path, release, track),
        MusicFileType::MP3 => {
            Tag::read_from_path(&info.path)?
        },
        MusicFileType::AIFF => {
            Tag::read_from_aiff(&info.path)?
        }
    };
    //Write
    write_id3_tag(&mut tag, discogs, config, release, track)?;
    let version = match config.id3v23 {
        true => Version::Id3v23,
        false => Version::Id3v24
    };
    //Save
    match info.tag {
        MusicFileType::MP3 => tag.write_to_path(&info.path, version)?,
        MusicFileType::AIFF => tag.write_to_aiff(&info.path, version)?,
        //Shouldn't happen
        MusicFileType::FLAC => {}
    };

    Ok(())
}
//Wrapper to write tags by format
Wrapper to write tags by format
Wrapper to write tags by format
pub fn write_tag(discogs: &mut Discogs, config: &TaggerConfig, info: &MusicFileInfo, release: &ReleaseMaster, track: &Track) -> Result<(), Box<dyn std::error::Error>> {
    //Get tag by type
    let mut tag = match info.tag {
        MusicFileType::FLAC => return write_flac_tag(discogs, config, &info.path, release, track),
        MusicFileType::MP3 => {
            Tag::read_from_path(&info.path)?
        },
        MusicFileType::AIFF => {
            Tag::read_from_aiff(&info.path)?
        }
    };
    //Write
    write_id3_tag(&mut tag, discogs, config, release, track)?;
    let version = match config.id3v23 {
        true => Version::Id3v23,
        false => Version::Id3v24
    };
    //Save
    match info.tag {
        MusicFileType::MP3 => tag.write_to_path(&info.path, version)?,
        MusicFileType::AIFF => tag.write_to_aiff(&info.path, version)?,
        //Shouldn't happen
        MusicFileType::FLAC => {}
    };
    Ok(())
}
pub fn write_tag ( discogs : & mut Discogs , config : & TaggerConfig , info : & MusicFileInfo , release : & ReleaseMaster , track : & Track ) -> Result < ( ) , Box < dyn std :: error :: Error > > { //Get tag by type let mut tag = match info . tag { MusicFileType :: FLAC => return write_flac_tag ( discogs , config , & info . path , release , track ) , MusicFileType :: MP3 => { Tag :: read_from_path ( & info . path ) ? } , MusicFileType :: AIFF => { Tag :: read_from_aiff ( & info . path ) ? } } ; //Write write_id3_tag ( & mut tag , discogs , config , release , track ) ? ; let version = match config . id3v23 { true => Version :: Id3v23 , false => Version :: Id3v24 } ; //Save match info . tag { MusicFileType :: MP3 => tag . write_to_path ( & info . path , version ) ? , MusicFileType :: AIFF => tag . write_to_aiff ( & info . path , version ) ? , //Shouldn't happen MusicFileType :: FLAC => { } } ; Ok ( ( ) ) }
Wrapper to write tags by format
Wrapper to write tags by format
discogs
&mut Discogs
config
&TaggerConfig
info
&MusicFileInfo
release
&ReleaseMaster
track
&Track