ok, so it seems that i’m always writing some bit of code or another. some of it is quick one-off scripts that might not really be useful to anyone other than me, but i figured if there’s anyone out there that can use it, i might as well make it available. so here’s some code. if you find it useful, let me know. if you have any comments/suggestions/patches, that’s great too. enjoy.
Note: almost everything here is out of date. best bet is to check my github repositories for the latest and greatest.
this is a hacked up version of CDDB_get (available from your local cpan mirror), based on version 1.66. it is required by both mcdl.pl and riptag.pl. i made changes so that it returns the year (the original didnt) and so that it returns a hash reference (which is undef if the lookup fails) rather than a straight hash as i just found this easier to work with.
- CDDB_get2.pm (released April 24/2004)
this started as me trying to make a few improvements to mcdl – music cd librarian and ended up evolving into a heavy cleanup with lots of rewriting and added features. i’ve got a fairly large cd collection and i was working on a similar project to catalog my cds. i had a working setup with a mysql backend, perl scripts for a cgi interface, and tcl/tk script for entering data, but it was all manual.
after abandoning the project for a long time i went looking for a way to do this automatically. mcdl offered the automation i was looking for (via CDDB lookups for any cd put in the drive) and the extensibility (via it being fairly simple and written in perl+mysql) to bend it to my needs. i ultimately decided that it’d be less work to change my perl cgi setup to read the mcdl databases and clean up the mcdl client. i added in the ability to modify the data returned by the cddb lookup, since the returned info sometimes has errors, and often contains inconsistencies (ie: once album by the cure might list the artist as “Cure, The”, another “Cure”, yet another “The Cure”, etc…). i modified it to work with my hacked version of CDDB_get. i did some other cleanups to improve its stability and other things i’ve forgotten since.
it works great: i used it to catalog approximately 600 cds initially and now use it to catalog every cd i buy. i later created both riptag.pl and dvdrip.pl based on this code.
- mcdl.pl (released April 24/2004)
mcdl CGI interface
this is a perl cgi interface to the databases created by mcdl (either the original or my version above – the database structure did not change). it is based on code published in one of my favorite Linux Journal columns, At The Forge. Issues 57-59 back in 1999 covered a 3 part article on “Creating a Web-based BBS”. this was really where i started playing with perl, cgi, and mysql, and
what i got from these articles really fuled my interest in perl and cgi programming. the cgi pages include links to ATF to give a nod to Reuven.
features of the cgi pages include full library search, statistics on the contents of the library, listings by artist, album, and song.
i have used mcdl.pl above to catalog my cds and the mcdl CGI pages for my collection can be seen as an example of this software
- mcdl_cgi-0.1.0.tar.gz (released April 24/2004)
riptag uses the CDDB query/edit functions of mcdl and calls cdparanoia to rip audio from cds into wav format, lame to encode it into mp3, and id3ren to add the id3 tags. the naming of the files is done to meet my preference, which is artist.name-album-name-##-song.name.mp3, with no spaces or other ‘special’ characters in the filenames, and everything in lower case. the id3 tags have the proper capitalization and symbols, it’s just filtered for the filenames. lastly, it will create a directory called artist.name, a subdirectory artist.name/album.name, and finally move the mp3s into that subdirectory.
- riptag.pl (released April 24/2004)
another variation of the riptag.pl program, this one is for ripping audio from dvds. unfortunately, i don’t know of any CDDB-like lookup for DVDs, so you need to enter the data by hand, however as it takes input files it is easy to watch the dvd and create the input file as you watch, noting the chapter/title info.
this program uses mplayer to rip audio from the dvd, lame to encode it into mp3, and id3ren to add the id3 tags.
the input file format is pretty simple: info can come in any order, and a repeat of the same tokens will override earlier occurances without warning. it accepts lines of the following format:
artist rest of the line is artist name
title rest of the line is album title
year rest of line is year (but it should be 4 digit)
X Y rest of line is title, where X is title number and Y is chapter number
- ripdvd.pl (released April 24/2004)
- sample input file (released April 24/2004)
note: i’m not certain about the legal issues associated with ripping audio from a dvd. i figure that i bought the cd so how and when i use it should be up to me. i’m not distributing it or making illegal dvd copies, just listening to the audio in something other than my dvd player. if you are concerned, look into laws in your area.
imgconvert is perl program for creating galleries from a list of images. it resizes the images to create thumbnails, various intermediate sizes, and the original size, creates an html index, and creates pages for a simple slideshow. it is a heavily modified version of one i found online at http://occy.net/ a while ago as the original didnt behave well with ‘portrait’ images (only ‘landscape’), didnt have a slideshow type function, had some filesize confusion (ie: sometimes files would end up with the same name although they had different sizes). requires Imlib2::Perl
shorten recursively process files and shorten them. long filenames don’t work great on my archos jukebox portable mp3 player (it sometimes does not sort them correctly, and otherwise it just is too slow scrolling), so this shortens the filename to ##-song.name.mp3 format (since it’s already residing in an artist.name/album.name subdirectory). also would work well as a template for a recursive file/directory processor.
- shorten (released April 24/2004)
id3fix recursively fixes id3 tags to match filename structure. simple program, but also a great template for writing a recursive file/directory processor.
- id3fix (released April 24/2004)
searches blackbox styles for lines with ‘color’, extracts the the color from the line (in any format), then prints a list of non-duplicate colors found. this was a precursor to the editcolors program below.
- findcolors (released April 24/2004)
searches blackbox styles for lines with ‘color’, extracts the the color from the line (in any format), then prints a list of non-duplicate colors found. allows you to change all occurences of each color found with a new value and write out a modified version of the style.
- editcolors (released April 24/2004)
tournament (aka marchmadness) is a set of perl/mysql cgi programs to track picks throught the ncaa tournament. at present it is specific to the mens division i tournament (64 teams in 4 divisions) but maybe someday i’ll make it more generic so that it can be used for other divisions or with things like the nba playoffs. the scoring is based on getting seed+4 for each win. we’ve been talking about extending this so that the round is taken into account too, but at present this capability is not there.
features of the cgi pages include raw editing of any database, importing of data (if you start using this part way through a tournament and happen to have data in an electronic format that is useable), score display, bracket display, tournament setup page, and player pick page.
- tournament-0.1.0.tar.gz (released April 24/2004)
gamp is an ncurses based gui frontend for sajberplay (both amp and mpg123 can act as a sajberplay client, i use mpg123). it is currently housed on my pages in UMN Computer Science. i’ll move it here eventually.
- gamp (last release April 24/2004)
viewer is a c/opengl stereo pair viewer/aligner. it is currently housed on my pages in UMN Computer Science. i’ll move it here eventually.
- viewer (last release April 10/2004)
WallView is a C#/.NET stereo pair viewer/aligner. it is currently housed on my pages in UMN Computer Science. i’ll move it here eventually.
- WallView (last release January 17/2004)