D18601: Rewrite taglib writer to use property interface

Stefan BrĂ¼ns noreply at phabricator.kde.org
Fri Mar 8 16:25:08 GMT 2019


bruns added inline comments.

INLINE COMMENTS

> astippich wrote in taglibwriter.cpp:70
> No, I cannot use the the PropertyMap for ASF/MP4, those atoms/attributes are unsupported in the PropertyMap and need to be handled separately. I would have done so if it is possible.
> I really do not like to write unnecessary, duplicated code when TagLib handles this nicely for us. I've only chosen the rating property to be implemented first, but there are more to come. The code will be 100% the same for APE and OGG with the PropertyMap, and also more efficient as we query the PropertyMap anyway.

Taglib does not "handle this nicely". For APE and Xiph, it just accepts *any* unknown key and uses it verbatim, while for MP4 and ASF it rejects any unknown key.

The setProperties() is also quite inconsistent, for APE and ASF it only removes items which have an empty value, while for Xiph, the properties are completely replaced.

As soon as you add support for a property where APE and Xiph key naming differs, or is only supported by one, you will require two functions anyway.

Using `APE::Tag::setItem(...)` is as efficient as manipulating the key/value in the Taglib::PropertyMap first and setting it by `setProperties(...)`. Likewise for Xiph.

If you want to squeeze out the last bit of efficiency, you would skip the `setProperties(...)` completely when no property is changed by `writeGenericProperties(....)`. This happens e.g. if you only change the rating.

If you want to avoid duplicate code, move the `properties()`/`setProperties()` into `writeGenericProperties()`, that saves 12*2 lines and adds 2.

REPOSITORY
  R286 KFileMetaData

REVISION DETAIL
  https://phabricator.kde.org/D18601

To: astippich, bruns, mgallien, broulik, cfeck
Cc: kde-frameworks-devel, #baloo, gennad, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190308/9fab50fb/attachment.html>


More information about the Kde-frameworks-devel mailing list