Closed GoogleCodeExporter closed 9 years ago
Sorry. `.getone` returns `default` if there's no `key` in the dict.
Original comment by jo...@lophus.org
on 26 Jun 2010 at 2:27
This definitely does not belong in DictMixin, which is intended to provide a
mixin base for any custom dictionary type, not just ones with sequence values.
I might be convinced that this is a good idea in e.g. Metadata or FileType if I
see a good use case. But "I don't want to support multiple values" is not a
good use case; it's asking to lose or misrepresent users' data.
Original comment by joe.wreschnig@gmail.com
on 13 Jul 2010 at 3:43
I haven't ever seen ANY mp3/ogg/whatever file with multiple values for one key
and I have gigabytes of music of all kinds and from hundreds of different
sources (iTunes and other download shops, file sharing, Jamendo, ...).
I'm pretty sure that more than 95 percent of all music files around there do
not make use of multiple values in tags. Most player even do not support
multiple values!
So please, include that convenience method into any of your tag dictionaries. I
do not care in which, I just don't want to produce ugly code with mutagen.
Original comment by jo...@lophus.org
on 13 Jul 2010 at 9:08
Your music files likely don't have this because most UIs only let you specify a
single value. Mutagen addresses this gap. Tons of my music does because I
tagged it with QL/EF. Besides, it's not hard to tweak your accessor into a
helper function and just use it from outside of Mutagen.
I personally don't like the way a call to the offered implementation will never
throw a KeyError even when default is not passed. So if that's important to
you, it will definitely have to be used from outside.
Original comment by mur...@gmail.com
on 14 Jul 2010 at 1:37
Okay. Here is a new patch that
a) moves the getone method into the FileType class
b) throws a KeyError if no default value is given
c) has tests for the getone method.
I'm really looking forward to see this patch applied in mutagen.
Original comment by jo...@lophus.org
on 14 Jul 2010 at 2:30
Attachments:
I still don't see the point.
Original comment by joe.wreschnig@gmail.com
on 14 Jul 2010 at 4:54
Original issue reported on code.google.com by
jo...@lophus.org
on 26 Jun 2010 at 2:26