The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Custom playlists from system queries

Contributed by: Scot Hacker
This tip is valid for: Both BeOS and Haiku

This tip builds on the principles outlined in the tip Make playlists automatically, but rather than using the limited find command, you’re going to be using BeOS system queries to do far more powerful things, treating your system like a database to create customized playlists for use in SoundPlay or CL-Amp. In this example, we’ll create a playlist comprised of all songs written in 1971, no matter where on your hard drive they might be stored. In a flash.

First of all, you’ll need to use an ID3 tag manipulator that extracts tag info and writes it to attributes. Jonas Sundstrom’s Tag2Attr and Attr2Tag add- ons are excellent, as is his TagWorld editor. When you first install one of these, you’ll need to manually add Title, Artist, Album, Year, and Comment attributes to your MP3 file type. In this process, you will have given each attribute an internal name, such as Audio:Year. In order to run this query, the attributes you want to search on will need to be indexed by the system, so open a Terminal and type:

mkindex Audio:Year

for example. You only need to do this once. Remember that newly created indexes don’t index pre-existing data, so if you’ve already added a year attribute to tons of MP3 files, you’ll want to copy your MP3 folder to another location and then delete the original. This will cause all of your MP3 files’ Audio:Year attributes to be added to the index. If you’ve only got a few of them, just add the year attributes anew.

To test whether you’ve done all of this properly, run a normal Attribute query to find all of your MP3 files that were made in 1971. If the query is successful, all you have to do is launch a blank playlist editor in your MP3 player, select all in the query results window, drag the selection to the playlist window, and save.

Of course, these principles can easily be extended to do just about anything. For example, you could find all Neil Sedaka songs anywhere on your system with a comment field including the phrase “delicious,” or whatever you want.

Remember: If you store your MP3 volumes on a separate volume, you must index each volume you intend to query.

Posted in Audio & Video

(comments are closed).