polyfloyd / rust-id3

A rust library for reading and writing ID3 metadata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get the list of artists / genres more easily?

martpie opened this issue · comments

Hello 👋

First of all, I am very new to Rust (started a couple of days ago), so I may ask something stupid.

I'm playing with rewriting Museeks with Tauri (Rust), and I see some inconsistencies between the library I'm using with Node.js and this one, and I wanted to know if this was a limitation by design, or just a missing feature :)

Example: https://github.com/Borewit/music-metadata/blob/1e1bd78dc5abeea49dfe0402681f39da64aa60b4/lib/type.ts#L90-L93

A file can have multiple artists or genres, and when getting the genres of a track, everything gets joined,

example: ["Rock", "Pop"] becomes with rust-id3 "RockPop".

Screenshot 2022-05-11 at 19 17 46

Could rust-id3 provide some helpers to return arrays instead? I think this could be done by adding plural methods artist() -> artists() so it's backwards compatible.

thanks in advance!

Hi! This library supports having multiple values, but the API is indeed very minimal. You could use the following right now:

tag.get("TPE1").and_then(|frame| frame.text_values())

The specific standard that this library follows is to split on null bytes for ID3v2.4 and split on slashes for prior versions. I am not sure whether that is the same convention that this other library uses.

I like the idea of having functions for this, I'll leave this issue open for tracking.

Would you accept a PR if I managed to make those work?

Yes, please! :)