This Time Self-Hosted
dark mode light mode Search

Restarting work on RubyTag++

So, some time ago I started working on some Ruby bindings for TagLib to be able to use them on a tagger for KDE (JulTagger) written in Ruby with help of Korundum.
There are at least two other bindings actually, but they uses the C interface of the library, that’s quite not what I need, as it’s too limited and doesn’t allow you to set, get and work with more than the usual Artist, Title, Track tags (and a few others but still way too limited).

For this reason, my initial idea was to write new bindings from scratch, but without doing it ad-hoc, as most of the code is shared and just need to be adapted for the different classes and types. My first choice was to do the work with GNU m4, I know it’s masochism, but it was a neat idea, at the start. The generation was quick, and the code started as being simple. Unfortunately when it was the case to add more complex code, it just sucked.

The result is that I had to drop entirely the idea of using that method to build the bindings, as the code was being quite prissy, a simple change in a comma made the whole bindings become useless.

I discussed with markey from the amaroK team of a way to create the bindings, but all the solutions were only partial, or simply hacks like RubyInline (that allows you to run inlined C/C++ code); smoke would have helped, but it’s quite tied to Qt/KDE framework and reworking it would have been a great deal of effort.

At the end I decided to implement my own binding script (in ruby) describing the classes to bind in YAML. Not a bad thing, in less then six hours last night I reimplemented most of the code I spent a week to write in M4…

I haven’t updated the code on the bzr repository yet, so it still have the old autotools + m4 code there, but I’ll try later today to put the code for the new system somewhere, after making sure the script doesn’t really refer to taglib or rubytag++ in any way, so that it can be made more abstract. Another thing I’d like to look at is cmake as replacement for autfoo, as if I’m not depending on m4 I might be able to avoid that entirely 😉

I really hope to find enough time for continuing this project alongside the rest.

Comments 2
  1. Have you tried SWIG?I found it very comfortable to work with when I was writing id3lib-ruby, a Ruby interface to the id3lib C++ API. (Similar task to yours :))Will you put the result on rubyforge or where will one be able to get it?

  2. Unfortunately SWIG is told not to support namespaces, templates and subclasses, that are used extensively by TagLib.It was my first choice back when i started, but discarded for that quite immediately.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.