Gronk!
An MP3 Jukebox for Unix
by Jamie Zawinski
In late 1999, I converted all of my compact discs to MP3s files, and
Gronk is the quick-and-dirty software package I threw
together to maintain my collection and control the playlist.
This software is no longer maintained. In 2005, I finally
abandoned
Linux for MacOS and never looked back. Now I just use
iTunes
to manage my music collection. I wholeheatedly recommend that
you do the same.
|
|
At the time, I looked around at other Linux jukebox programs, and none of
them really did exactly what I wanted. Either they had user interfaces that I
didn't like, or they were far too complicated to install. Among other
things, they all seem to rely heavily on MySQL. Sorry, but the fact is
that when you're only dealing with ten or twenty thousand items, a
database is overkill. Especially since these items change infrequently
(how many CDs do you buy a week?) So Gronk is built almost entirely
around static HTML pages: it goes through the MP3 files and the CDDB
data, and constructs HTML representing all of the discs. When you add
a new set of CDs, regenerate the pages. Even with my huge collection
this only takes a few minutes.
- Web-based user interface;
- Hierarchical display of bands, albums, and tracks,
including album cover artwork (if present);
- Easy to select a particular track or an entire album for playback;
- When you haven't explicitly selected songs for playback, they
are chosen randomly from amongst your entire collection;
- Easy to tell it ``never play this song again'';
- Can use any command-line program for playback;
- Can also use XMMS
for playback;
- If you use XMMS,
then you get Icecast
broadcasts for free, via the
Oddcast DSP
plugin;
- Navigation hyperlinks on everything;
- Automatically cross-references bands with compilation albums on
which they appear;
- Gets album and song names from
FreeDB/CDDB instead of from the
MP3 files themselves, bypassing the 30-character limit of ID3v1
(since at the time that I wrote this, ID3v2 was still almost entirely
unsupported);
- Doesn't use SQL.
- The web UI should show the time remaining, and have a scrollbar
for zipping around in the song, and for showing progress.
- The UI for ``never play this song'' needs work.
- Scoring would be interesting: instead of just excluding
songs, being able to tell it to play certain songs more often.
- Right now there is no mechanism for playing random other
MP3 files, only ones that are already ``in the system.''
- I think the presentation of the compilation albums (the
``Various'' pseudo-band) is kind of unwieldy. There are just
too many entries in that list.
- I need better icons: the ``play'' icons are too reminiscent of
outliner-expander triangles, so some people have thought that clicking
on the triangle meant ``show me the tracks on this album'' rather than
``play this album.''
- More direct support for
Icecast.
The
Oddcast DSP
XMMS plugin works pretty
well, but it would be nice to do webcasting without having xmms (or
even X) running at all.
(Yeah, just use iTunes already...)
- Perl 5.
- A whole lot of MP3 files, and their corresponding
CDDB files.
- A web browser that supports HTML circa 1995.
(Tables and colors, but no JavaScript, no layers, no plugins.)
- A web server (anything that supports
Apache-style
``.htaccess'' files and CGI scripts.)
- mp3info or
mp3info.
- XMMS,
mpg123, or mpg321
for playback. I found that playback would skip with mpg123 (e.g.,
while I am ripping CDs) but that XMMS doesn't skip, so that's what I
use. Also, with XMMS you get a scrollbar and a playback timer, which
the web page doesn't include.
- If you are using XMMS, you'll also need
Doug MacEachern's Perl XMMS interface
(perl -MCPAN -e 'install Bundle::Xmms') which
will in turn require the xmms and xmms-devel packages (from
xmms.org.)
- I had a dedicated machine to serve as my jukebox.
It was a Pentium III running Linux, with lots and lots of disk space.
- I never sat in front of that machine, but it did have a monitor.
It was running a browser showing the Gronk web page, from which I could
walk over and adjust the playlist.
- It also ran XScreenSaver
(of course!) and one of the utilities included with the Gronk package
is a program that will periodically pop up a window showing the name
of the currently-playing song in multi-inch-high letters, so that one
can read it from across the room. This only pops up while the
screen saver is on.
- And most importantly, since it is a stereo component, I
spraypainted it black.
- I ripped my CDs using
Grip,
CD Paranoia, and
LAME.
But you can use whatever you like, so long as you follow the same
file naming convention, and have the CDDB files available
(see below.)
- I generally just listen to everything on random shuffle.
That plus the "Never Play This Song Again" button works out pretty
nicely...
Gronk is picky about the naming conventions used by the MP3 files.
Basically, there should be a directory for each band; and within those,
a directory for each album; and within those, an MP3 file for each
song. The MP3 files should be named
``nn-song.mp3'' where nn is
the track number. The song name (and the names of the band/album
directories) should be lower case, with spaces converted to
underscores, and all non-alphanumeric chars deleted.
If you use Grip
to rip your CDs, use these settings in its preferences:
Rip File Format: | ~/mp3/%A/%d/%t-%n.wav |
MP3 File Format: | ~/mp3/%A/%d/%t-%n.mp3 |
WARNING! Make sure you use %A and not
%a, or Grip will do horrible things with compilation albums.
Gronk is very much ``disc'' based: it is organized with the
assumption that you have a large collection of complete CDs ripped,
not a scattered collection of single-track MP3 files. It expects
a directory per CD, containing all/only the tracks from that CD.
Gronk needs access to the CDDB files that correspond to the ripped
CDs. It doesn't care about ID3 tags at all. This is because ID3
imposes 30-character limits on field lengths, whereas the FreeDB/CDDB
data can be arbitrarily long, contains more information, is
centralized, and is generally more accurate. If you have ripped the
CDs yourself (or even if you have ever played them on your computer)
then the CDDB files will be sitting in your ~/.cddb/
directory.
If you did not rip the CDs yourselves, you can probably find
the CDDB files by searching on
freedb.org. Or, you can try and generate a ``close enough''
CDDB file from the MP3 files you have using the included
make-cddb.pl script (see the README for details.)
Changelog:
New in 1.9:
- ID3 tags are written with "id3tag" instead of "mp3info",
which means that both ID3v1 and ID3v2 tags will be used now.
- make-cddb.pl understands ID3v2, meaning it will do
a better job of importing MP3s ripped with iTunes.
- mp3ify.sh will convert .m4a to .mp3 with "faad".
New in 1.8:
- Regenerating the HTML tree is faster.
- The splash page says how many albums, tracks, and total playing
time exist in the archive.
- No HTML files or links are modified unless that modification
would change something.
- Likewise, cddb2mp3.pl does not alter an MP3 file unless
there would have been a change to the contents of the file's ID3 tag.
- When MP3 files have Gronk-incompatible names, it notices
that and suggests likely renamings.
- make-cddb.pl (the script that constructs a .cddb file from
a directory of existing MP3 files) is much smarter now: it looks at
both file names and ID3 tags.
- All pages have a charset tag now, to counteract
recently-stupidified Apache defaults.
New in 1.7:
- There are mouse-overs describing the functions of the buttons.
- The playlists have a "kill this song" button which gives the
current song a score of -1 (so it won't be auto-selected again.)
New in 1.6:
- Handle multiple album-cover images.
- Corrected computation of the length of data tracks.
- If there is a subdirectory called data, assume that is
the contents of the CDROM portion of the CD, and link the listing
entry for the "data track" to it.
- Added a "Lots More Songs" link (adds 20 tracks, as
opposed to "More Songs" which adds 5.)
- More Perl broken-unicode workarounds.
New in 1.5:
- Speed improvements: you will really notice the difference if
your playlog file has gotten really big!
- Added support for album cover images (band/album/cover.jpg)
- Added support for generation of an "index directory": a tree of
files that look just like the Gronk control files, but contain links
directly to the .mp3 files instead of to the playlist-controlling
CGIs. This is just a way to make a directory full of MP3 files look
pretty, by having CDDB-derived HTML listing it.
- Improved some error messages.
- xsplash takes -geometry and -placement args now.
New in 1.4:
- Minor HTML tweaks to make it not look like hell in Mozilla.
- Changed freedb-submit.pl to force people to change
the default email address and stop submitting things as me.
New in 1.3:
New in 1.2:
- Support for FreeDB
protocol level 5.
- Various minor fixes.
New in 1.1:
- Some minor code cleanup (perl de-squicking.)
- Pages for an artist also include links to tribute albums
(compilations of covers of that artist's songs.)
- Made Gronk refuse to queue a song if it is already on the
playlist (to avoid accidental multi-clicks.)
- The search form also lets you list recent additions within
the last N hours or days.
- A page is generated that lists bands who appear only
on compilation albums.
- When generating HTML pages, some trivial spelling mismatches
will be flagged (e.g., ``Foo & Bar'' versus ``Foo and Bar''.)
New in 1.0:
- Who am I kidding with this version number nonsense.
Let's call it 1.0 now.
- Changed the diagnostic output of build-pages.pl to be more
brief and readable, so that the error messages don't just
scroll away.
- When the playlist is long, it will also display the cumulative
duration of the songs (useful for when you're trying to queue
up at least N hours of music for a party...)
- When generating HTML pages, dim out songs that have low scores.
- Various minor bug fixes.
New in 0.7:
- Added ``More Songs'' and ``Shuffle Playlist'' commands.
- Made it possible to disable the ``play whole album'' button,
since people tend to hit that by accident a lot, and it's
a pain to clean up after...
- Made a score of -3 mean ``don't play this song even if
someone is foolish enough to request it explicitly.''
- Various other minor bug fixes and stability improvements.
New in 0.6:
- Added a script for generating fake-but-plausible CDDB data
given a set of MP3 files.
- The display of compilation albums has changed: now there is
a secondary frameset, so that it's easier to scroll through
a huge list of comps.
- The ``recently played'' page now shows whether the songs were
random, or requests.
New in 0.5:
- There is now a search form, that lets you do regexp searches
though all song names, band names, and album titles.
- There is a link that shows you songs that were recently played,
in addition to upcoming songs.
- A couple of minor bug fixes.
New in 0.4:
- There is another column of icons in the playlist, allowing you
to move an indicated song to the top or bottom of the list;
- When you explicitly add a song to the playlist, it is added
after any other explicitly-added songs, but before any
randomly-selected songs that might already be present.
- When songs are being randomly chosen, it won't choose a song if
it has already been played recently, or if another song by that
band has been played recently (both of these thresholds are
tweakable.)
Here is the final release of Gronk as a gzipped tar
file. There will not be another!
Read the README, edit config.pl, and don't expect
it to work out of the box without some tweaking. ``It works for me.''
(Other people are using it successfully, however.)
Here is was a demo version of the Gronk UI. This is what it looks like
when running, except that when you click on things, it won't actually
cause sound to come out of my speakers because the CGIs are stubbed
out.
(Oh, in case you were wondering about the name, ``gronk'' is the
sound of disk thrashing.)
_____________________________