-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I've been tinkering with xmp-toolkit-rs to try to parse/update Ableton Live's folder metadata - this has worked pretty well so far, but one part of the schema proved a little awkward to get working through these bindings.
I did find a workaround in the end, but I thought it was worth raising an issue regardless, as it seems like it could be useful feedback for future versions of this library π
For context - Ableton stores each file's metadata as an array of structs, like this:
ablFR:items (0x200 : isArray)
[1] (0x100 : isStruct)
ablFR:filePath = "Clap Beholder 1.wav"
ablFR:keywords (0x200 : isArray)
[1] = "Creator|Native Instruments"
[2] = "Drums|Clap"
If I try to use XmpMeta::append_array_item to add a new empty struct to this array, I am forced to add a String value to it (as the method only allows you to pass &XmpValue<String>). But this gives the following error:
XmpError(Bad options parameter, Structs and arrays can't have string values)
In the C++ API, you can pass NULL as the item value, but that functionality isn't exposed through the bindings. It feels like these kinds of functions should possibly take &XmpValue<Option<String>>, or something like that?
The workaround/alternate approach I found was using XmpMeta::array_len and XmpMeta::compose_array_item_path to create a path to the (non-existent) new item. The struct then gets created automatically when I call XmpMeta::compose_struct_field_path to set the fields.