Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not write multiple artists with mp3 and generic Tag #349

Open
vnghia opened this issue Jan 25, 2024 · 1 comment
Open

Can not write multiple artists with mp3 and generic Tag #349

vnghia opened this issue Jan 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@vnghia
Copy link

vnghia commented Jan 25, 2024

Reproducer

I tried this code:

let mut tag = Id3v2Tag::default();
tag.set_artist(artists.join("\0")); // ["Artist1", "Artist2"]
let mut tag: Tag = tag.into();
tag.save_to_path(&path).unwrap();

// re-read
let tagged_file = read_from_path(&path).unwrap();
let artists = tagged_file.primary_tag().unwrap().
            .get_strings(&ItemKey::TrackArtist)
            .map(std::string::ToString::to_string)
            .collect_vec(); // ["Artists2"]

while this code works:

let mut tag = Id3v2Tag::default();
tag.set_artist(artists.join("\0")); // ["Artist1", "Artist2"]
tag.save_to_path(&path).unwrap();

// re-read
let tagged_file = read_from_path(&path).unwrap();
let artists = tagged_file.primary_tag().unwrap().
            .get_strings(&ItemKey::TrackArtist)
            .map(std::string::ToString::to_string)
            .collect_vec(); // ["Artist1", "Artist2"]

And it seems that this only happens with mp3. I can write multiple artists with vorbis comment on a flac file.

Summary

When converting to generic Tag from Id3v2Tag, multiple artitsts are not preserved.

Expected behavior

When converting to generic Tag from Id3v2Tag, multiple artitsts are preserved.

Assets

No response

@vnghia vnghia added the bug Something isn't working label Jan 25, 2024
@Serial-ATA
Copy link
Owner

That's an interesting one. Id3v2Tag::merge_tag() handles joining items, but Tag::save_to_path() skips the merging step. The artists are both written, the problem is they end up in different frames, which is not correct. For now, the solution would be to just convert the Tag back to an Id3v2Tag when you are done with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants