Tuesday, June 14, 2011

Lowering CoGS: beaTunes' new Plugin API

beaTunes3 logoFor a long time beaTunes has offered a more or less stable plugin API. With beaTunes 3 the API has changed significantly - and it has become a lot easier to use. The new AudioSong object for example, lets you easily manipulate song metadata without having to worry about how and where that data is going to be saved.

But an API is only worth the bits it's coded in, if the cost of getting started (CoGS™) is low enough. Let's recap:

The old API was...

  • poorly documented,
  • plugins needed to be in written in Java (i.e. compiled) and
  • one needed to package them in a special way, which included adding a plugin descriptor in a defined location.

In other words, the old API was a perfect example of how not to do it.

Now, let me say that the new API is still not the greatest API ever (imagine that!). But is has gotten a lot better and CoGS is a lot lower.

Better Documentation

There is now a page that offers a real starting point. The access to the javadocs has been there before, but now they are also deployed to the Maven repository. That makes them a lot easier to access from your IDE (if you are using one). That said, most people don't learn an API by looking at the reference docs. Annotated sample code teaches most people way more in much less time.

It's like API essence: take a sip, mix it with your own experience and it magically inflates to knowledge.

This is why I made an effort to write some key examples - code that can be modified and re-used as you see fit. But most importantly, it just works without you having to find out some boring details the hard way.

No need to compile

For the old API you had to install a Java JDK, setup an IDE, install Maven, create a project... before you could do anything. The only question left to answer here is: Did you give up after the JDK installation or before the Maven setup?

Of course IDEs can be great and make your life a lot easier. The same is true for Maven. But what, if you just want to code something simple, like a global search and replace? This is the kind of thing that should be done via a simple script. No JDK, no Maven, no IDE.

No hassle.

And that's exactly what beaTunes 3 is capable of.

Little scripts called beaTlets can now be dropped into a special directory and beaTunes will pick them up the next time it starts. The API is still written in Java, but thanks to JSR-223 magic, your code can be in either Groovy, JRuby or Jython. Working examples for all three scripting languages can be found here.

Trivial Installation

I already mentioned it - these fancy little scripts called beaTlets can be installed by merely moving a file into the right directory. No need to write a special descriptor anymore. That said, you can still do it to communicate certain needs to beaTunes. But you don't have to.

Conclusion

Writing simple plugins for beaTunes has become a lot easier. CoGS has been lowered a lot. Should you still have questions, please feel free to contact me or post to the Plugins section of the forum. I'm here to help.

Labels: ,

1 Comments:

Blogger yeahdef said...

http://yeahdef.com/?p=6255
Open Key Notation to Comments plugin!
Traktor / Serato harmonic mixers go here!

June 14, 2011 at 4:08:00 PM EST  

Post a Comment

Links to this post:

Create a Link

<< Home