Saturday, February 2, 2013

A Fine Selection of... Something?


While on break from my previous break from ever finishing anything I mentioned the Blacklight mp3 player on the zipit IRC channel.  I knew slug was looking for a minimal front end to mpg123 and he seems to like C++ a whole lot more than I do.  We played with some g++ compile/link options and slug managed to get it down to a fairly tiny 16K build for his openwrt jffs.

Unfortunately C++ doesn't reduce nearly as well with the IZ2S compiler.  I only got it down around 34K using uClibc++, a shared lib version of ncurses, the lzma upx, and the magic compiler options.  I can't seem to lose the exception handler code, despite my best efforts.  It also seems to make mpg123 sound a bit worse.

However, Blacklight is really just a file selector at heart, which reminded me of the sel file selector program I tinkered with a while ago, but never really got around to finishing.  The sel program is a capable ncurses based complement to the dialog program  for shell scripted text GUIs.

The original web site is long dead, so I retrieved sel from the wayback machine.  Stripped, upxed, and linked against the shared ncurses lib from the Junk in the Trunk post it comes out around 14K, which makes it small enough to toss onto the jffs.  I added support for some more handy navigation keys on the zipit, made it always quote the filenames, and fixed up the globbing code to tack the glob string (eg. *.mp3) onto selected directories.  This works pretty well to let me select and play whole directories of mp3s, as well as select files to play individually.

    sel -b "Play MP3s" -m "*.mp3" -c "mpg123 -C %" -d /mnt/sd0/music

Here's an updated zip file with the modified sel sources and two executables for IZ2S, one with ncurses static linked, and one shared.

sel-0-08-4-iz2s.zip

Update:  I couldn't leave it alone so I went and tested it in DVTM along with a mini rexima window for the volume control.  I couldn't decide what to put in the 3rd window, so I just ran another copy of sel.  That lets me start one window playing a makeshift playlist and then use the other window to select some more music for later.  I suppose that could be handy, although what I really ought to do is make a sel command that inserts the selected items into an mpg123 command fifo and then simply run mpg123 on the fifo in the 3rd window.

I tweaked the sources a little bit more to get sel working in the tiny window, and I still need to patch the code to handle a window resize.  I'll post a new zip when it all works again.

sel-0-08-04zz-iz2s.zip

No comments:

Post a Comment