mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

Please use built-in enums

Open andrewvaughan opened this issue 4 months ago • 1 comments

https://github.com/quodlibet/mutagen/blob/f95d3ae19e25e3f0a91061566551843d799317c5/mutagen/mp3/init.py#L36

This is a very unusable implementation - namely because it requires a match/case or similar anti-pattern to be implemented as you've created a fairly whacky method of returning a string representation.

For example, if I simply want to record that the bit-rate mode of an MP3 was CBR - there's no easy way for me to just get CBR as you've forced the string representation to be BitrateMode.CBR. I have no idea why anyone would ever want the Enum class in their string representation and is very non-standard.

Either this, or please implement the standard .name and .value properties in normal Python enum to make this possible.

https://docs.python.org/3/library/enum.html#enum.Enum

andrewvaughan avatar Feb 27 '24 21:02 andrewvaughan