Skinning XMMS with BuildImage and Skencil

Using the Python package“BuildImage” version 1.2 and its customized code for creating “skins” for the popular automatic music player

Short URL: http://fsmsh.com/1183

Write a full post in response to this!

XMMS is a very nice program for playing music, but the default skin that comes with it is, well, “functional”. Fortunately, though, the program uses the same skin files as WinAMP 2.0 (several other programs use these skins as well, which I’ll call simply “AMP2 skins”). A “skin” is just a collection of images used to create the appearance of an application such as a music player (Figure 1).

Figure 1: XMMS unskinned (left) and with the default BuildImage Skin (right)
Figure 1: XMMS unskinned (left) and with the default BuildImage Skin (right)

In this case, the skin is simply a ZIP file with a funny extension .wsz (which presumably stands for “WinAMP Skin Zipfile”), containing a number of BMP format images with some very odd contents. There’s not a lot of rhyme or reason to their layout, but the icons used by the program are extracted from them at runtime. Furthermore, since BMP doesn’t support transparency, some very careful copy-and-paste work has to be done to fake transparency, as many AMP2 skins do. The results can be amazing, but unbelievably tedious to create manually.

You can wade through this technical detail to create a skin using raster tools, or you can accept the limitations of using a commercial application to do the work for you, or—now—you can use BuildImage to generate a skin more sensibly from a drawing in Skencil.

XMMS is a very nice program for playing music, but the default skin that comes with it is, well, “functional”

What you need

Naturally, you’ll have to make sure you have the software first. Most of the software is available in popular Linux distributions, so you can probably install using mostly binary packages. You will have to install BuildImage from the source, but this is easy, as it’s a pure-python package. You’ll need:

  • Skencil (0.6.15): May still be called “Sketch” in your distribution (e.g. Debian, Red Hat).
  • Python (2.2): You needed this to install Skencil, and BuildImage relies on it too.
  • Python Imaging Library (1.1.3): You also needed this to install Skencil, so you probably already have it.
  • Gimp (1.2): Strictly speaking, you can skip this, but it’s useful for composing background images.
  • BuildImage (1.2-beta): The AMP2 features are brand-new in this version, so don’t try to use an older one. The examples used in this article are included in the distribution.

I’ll leave you to the installation instructions for each package, but Skencil and BuildImage both use distutils, so installation is along the lines of:

tar zxf Package-version.tgz
cd Package-version
python ./setup.py build
# su to root
python ./setup.py install

Once the software is installed, you’ll need to create a working directory for your skin project. The easiest way to do this is just to recursively copy from the example/AMP2 directory in the BuildImage distribution, which contains several examples, including the ones in this article, as well as the “default” skin template for BuildImage.

This is what you get:

samwise:~/tutor> tree 
.
|-- bitmap
| `-- textdef.bmp
|-- scripts
| |-- __init__.py
| |-- animated.py
| |-- default.py
| `-- vanity.py
|-- setup.py
`-- sketch
 |-- amp2.sk
 |-- animated.sk
 |-- myth_bkg.jpg
 |-- myth_ws.jpg
 |-- vanity.sk
 `-- vanity2.sk

The file amp2.sk is the template for creating a skin drawing in Skencil. You’ll rename it when you create a new drawing (such as with the other example files you see here). The setup.py file runs the scripts package, which contains scripts to build each of the examples. If you open one of these scripts, you can see that the AMP2 support in BuildImage consists of two functions amp2_img() which is simply a BuildImage script tailored to the provided amp2.sk template, and amp2_skin() which compiles the skin archive from those images.

The directory “bitmap” contains an original bitmap of the default XMMS font, which we will be using (you can do this part in Skencil but it’s probably a waste of time).

At this point you can make the default skin, and that’s probably a good way to make sure you have everything configured. You may have to set an environment variable to make sure that your Python can find Skencil. For example, on my system, I need to type:

setenv PYTHONPATH /usr/lib/sketch-0.6.15

Now, simply type the following to build the default skins (from the example directory, or your copy of it):

python ./setup.py

This will run the scripts/__init__.py file that calls BuildImage to create the skins. Like “make”, BuildImage is very noisy, printing lots of messages to the screen. This is meant to make it easier to trace a problem when one occurs. You won’t really have to worry about missing-font warnings—the important text in the drawings has been converted to curves to avoid portability problems. Only the text labeling in the template (which doesn’t print) should be affected by font problems, and you’ll still be able to read them, even if the font is not quite right. Also like compiling a package with “make”, you can expect the build to put a fairly heavy load on your system.

At the end, you’ll find a series of named build directories—one for each drawing file. These contain all of the image components that were needed to make the skins as well as the actual skin files ( *.wsz ). You can now install the skin files into your ~/.xmms/Skins/ directory to make them available for you only, or switch to root and install them into the XMMS installation on your system (probably /usr/share/xmms/Skins ), to make them available for all users.

Don't miss out on the other pages!
12345next ›last »

Write a full post in response to this!

0

Do you like this post?
Vote for it!

Copyright information

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html.

Biography

Terry Hancock: Terry Hancock is co-owner and technical officer of Anansi Spaceworks. Currently he is working on a free-culture animated series project about space development, called Lunatics as well helping out with the Morevna Project.



Other sites

Free Software Magazine uses Apollo project management and CRM for its everyday activities!