taglib-ruby icon indicating copy to clipboard operation
taglib-ruby copied to clipboard

Support `properties` and `complexProperties`

Open robinst opened this issue 1 year ago • 2 comments

It would be great if we supported properties and complexProperties, to allow users of the library to use the unified interface FileRef instead of the format-specific APIs, see https://github.com/robinst/taglib-ruby/pull/143#issuecomment-2053594803

See here for API usage docs: https://taglib.org/api/

robinst avatar Oct 26 '24 07:10 robinst

If you take one of those C++ FileRef examples, what do you think it should look like as Ruby code?

jacobvosmaer avatar Oct 26 '24 20:10 jacobvosmaer

Hi. I had a play with this and concluded that just type converting betweene PropertyMap to a Ruby Hash<String,Array<String>> is likely to be easier to use than using the methods on PropertyMap itself.

I ended up with merge_properties(Hash) and replace_properties(Hash) on FileRef to write the properties back.

The same technique for reading complexProperties would be easy enough. Writing back to the Variant might be more complex, eg if you have to track the specific int type when building up the Variant object.

My hackery was just using rice.hpp to wrap FileRef in a very simple way and I do wonder if using the FileRef/PropertyMap API is an either or thing (vs using the specific File types); and that it could actually be presented as a separate gem.

lwoggardner avatar Nov 17 '24 05:11 lwoggardner