INDEX...
Georg Acher's Homepage
ABOUT
PROJECTS
LINKS
TGI@TUM
   
kmp3sel

What is kmp3sel?

kmp3sel is a small tool to find MP3 files that are flying around your harddisk. If you have more than 500 MP3-files (of course all legal...), then the overview usually gets lost.
kmp3sel allows you to find files just by typing a few letters (i.e. a substring) of  their titles and displays the matching files immediately (just like the emacs-search). Now hit ENTER  and the file is played. You can also play the whole CD to which the song belongs.
kmp3sel gives fast and convenient access to thousands of MP3-files just like a radio DJ.

How does it work and what is needed?

To  work properly, kmp3sel needs a playlist of all your MP3-files. This playlist can easily be obtained by
 
find start-directory  > playlist


BTW: Files that don't have a .mp3 or .mp2 suffix are automatically ignored.

kmp3sel reads this file and tries to separate the artist, the title and the CD-title given by the path and filename with a somewhat complicated heuristic. The results are stored in an internal database, which can be searched.

The heuristic is able to parse most of the ugliest file names, but  you can reduce the parsing problems by a few simple rules.

The following filename styles are strongly encouraged:
 
Style Example
.../ARTIST-CD_TITLE.CD/##-TITLE.mp3 /mp3/Dario G - Sunmachine.CD/01 - Sunchyme.mp3
.../ARTIST-CD_TITLE.CD/TITLE.mp3 /mp3/Prodigy - Various.CD/Firestarter.mp3
.../ARTIST-CD_TITLE.CD/##-ARTIST-TITLE.mp3 /mp3/Sampler - Best of 98.CD/19 Nana - Dreams.mp3
.../ARTIST-TITLE.mp3 /mp3/Culture Beat - Inside out.mp3
.../ARTIST/CD_TITLE/##-TITLE.mp3 /mp3/Jean Michel Jarre/Oxygene/02 - Oxygene Part II.mp3

The hyphen (-) is necessary to separate the artist, the CD-title and the title. It is not needed for the index number ## (1-2 digits), which is also optional.
The index & the artist/title can have the style "## - stuff", "##-stuff", "## stuff" and "(##) stuff".

When - is used to separate artist and title, the name can contain spaces or underscores (_), e.g. "space_blaster-magic_fly.mp3".

In most cases even underscores (_) can be used as separators, but then there must be spaces used to separate the words.

The CD-detection can be made fool proof by the following rules:

For most other path names the detection works also.

Compilations (samplers) are detected, and the artist is taken from the individual filename and not from the CD-title. This works fairly reliable, if a non-compilation either has always the artist in each filename or a - in the title part occurs not earlier than in the third filename of this CD.
If you don't understand the last sentence, look at the code. If you don't understand the code, ignore it and hope that it works for you :-)

Screenshot

Assume you searched for "oxygene", and typed in the first two characters "ox", then it would look like this:

At most 256 hits are displayed.

Now you can

Usually a few letters are enough to find the song you are looking for.

That's all. No more gimmicks or useless features. Just search'n'play.

Preferences

The File/Preferences dialog allows you to enter

Notes:

Players like amp or mpg123 work, but there is no way to stop them from kmp3sel before they finished playing, you can call
a wrapper script instead that kills currently running players first.

xmms works best if you disable the "Allow multiple instances"-option in xmms' Preferences/Options-menu.

If you prefer that queuing files should be the default action when pressing only <enter>, simply swap the MP3-Player and MP3-Queue values.

Download

Requirements:
KDE-libraries, Qt-libraries (version 1). I tried it on Suse6.3 and 6.4.

DOWNLOAD new version (0.2): kmp3sel-0.2.tgz

Installation:

Changes/History

v0.2:

Added buttons to restrict matches to artist and/or title and/or CD-Title
Avoid some crashes

v0.1:

initial release

Bugs and known problems

ID3-tags are not used to build the database.

The parsing heuristic is a hack, but it works fairly good.

Problems arise, when the filename style is far from the examples described before or ambigous filenames are used, eg. when a 2-digit is part of the name (16 bit - where are you.mp3), or when the hypen is a part of the artist . The latter case is handled for unlikely names (eg. AC-DC is correctly parsed), but it may occur for some of your files.

If parsing goes wrong, some parts of a valid title may not appear in the database.

Since the full text search is brute-force and doesn't use a positional tree, it gets linear slower if you enlarge the playlist. But it is fast enough for interactive search over 25000 titles on a PentiumII/233Mhz, so it shouldn't harm that much.

The database is stored uncompressed in memory.

kmp3sel is my first KDE/Qt-program and was hacked together in two days, so some widgets and/or GUI guidelines may be used in a strange way or not at all. On the other hand, I tried to reduce the needed clicks/key strokes as much as possible to make the search faster...

You can open different views, but closing the original view exits the program.

The modifier state (shift, ctrl) is not used when double clicking a title. I found no easy way (except raw Xlib-calls) to get this state with Qt in the ::selected() callback. If anyone knows how to accomplish this, drop me a note.

kmp3sel uses its own configuration file tools instead of the KDE ones.
 

BTW

kmp3sel is distributed under the GNU public license.
 
Georg Acher
Last Update: 2001-05-27