Posts Tagged ‘perl’
Saturday, June 28th, 2008
I like bbtracker -it’s a very simple GPS track logger for the Blackberry. It has (at least, at the current version) one problem - you can’t create waypoints in the way that most GPS applications would expect. You can, however, name trackpoints - so I wrote a little perl script to extract all the named trackpoints from an exported GPX files, and save them as waypoints.
Download bbtrackerwpt - converts named trackpoints from bbtracker GPX into waypoints. You’ll need XML::Simple for this to work.
I imagine this script has a limited audience, and quite likely a limited lifetime. The author of bbtracker has said they’d provide waypoint support in the next version. You know me and patience, though …
If I remembered more XSLT, I’d have done this the proper way. As is, I create XML using Perl print statements. I’m probably okay, as the name field is the only piece of free-form text, and I do some rudimentary escaping of characters that XML doesn’t like. The output seems to validate, which is more than the GPX that bbtracker produces does. The length of your GPS track may vary 
Tags: blackberry, gps, gpx, perl, xml, xslt
Posted in computers suck | No Comments »
Saturday, May 17th, 2008
auplabels - extract times of tracks in an Audacity file for adding labels (download).
Audacity 1.3’s method of track splitting has always seemed a pain, so I wrote the above to help me.
Running auplabels file.aup will generate a somewhat sparse file of track offsets:
0.00000000
191.57333333
376.08000000
550.76000000
…
You’ll want to edit this to add track names (there should be a tab between the first column and the title):
0.00000000 Battle of the Blues
191.57333333 I Quit My Job
376.08000000 Ain't Goin' My Way
550.76000000 Wake Up Hill
…
If you use File -> Import… -> Labels… to import this into your project, the label track should exactly align with your track splits.
(Of course, this should really be an XML application since Audacity AUP files are XML, but issues were had.)
Tags: audacity, perl
Posted in computers suck | 1 Comment »
Saturday, May 17th, 2008
Debian and its derived distributions have a policy about packages not being able to modify the configuration of other packages. While this might generally seem like a good idea, for the TIMTOWTDI world of Perl, this causes problems.
The problem arises if you have installed Perl XML modules from both CPAN and the Debian (or Ubuntu, or whatever) repositories. Debian’s modifications subtly break the XML::SAX module, on which most Perl XML modules (including the brilliant XML::Simple) depend. If you’ve been naughty and used a module from CPAN, Debian gets its knickers in a knot, and won’t configure or run anything remotely related to libxml-sax-perl.
If you get the error Can’t locate object method “save_parsers_debian” via package “XML::SAX” at /usr/bin/update-perl-sax-parsers line 90, your system is affected. You might get the clue that any of your Perl XML handlers freak out and fail in weird ways.
Here’s a method (there’s always more than one, of course) to fix it. This was combined from a couple of sources, each of which was on the right track but didn’t entirely work. Actually, the first might’ve been right on the money, but my hiragana’s a bit ropey …
- make sure you’ve got your system up to date with
apt-get or aptitude.
sudo cpan CPANPLUS (this will ask you lots of questions, to which you should almost always answer with the default)
sudo cpanp -u XML::SAX (this takes quite a while, and produces no output for most of it)
LC_ALL=C sudo apt-get install --reinstall libxml-sax-perl (the LC_ALL=C might not be strictly necessary, but it worked for me)
You must remember never to pretend to be smarter than the Debian maintainers, and suitably chastened, may now return to your normal OpenSSH patching activities …
Tags: bug, debian, libxml, perl, sax, snark, ubuntu, xml
Posted in computers suck | 1 Comment »
Sunday, February 10th, 2008
It took me a while, but I finally put all the track information for Sing Out!’s Rise Up Singing teaching CDs (also on the artists’ website) on freedb. I was given the data just over a year ago by Mark D. Moss, the editor of Sing Out! magazine.
The discs are:
Perhaps what took longest was working out a UTF-8 safe processing workflow, from converting the original Excel table to e-mailing the entries to the freedb server. Let’s just say that OpenOffice, sqlite, and Perl were very helpful here.
Tags: cd, freedb, openoffice, perl, rise-up-singing, sing-out, sqlite
Posted in choons, computers suck | No Comments »
Tuesday, May 8th, 2007
While I said quite early on that I had Ubuntu Feisty running in 64-bit, it wasn’t until today I got things really how I liked it. My earlier Perl problem was due to a broken gcc setup; all is happy now, and all the modules I’ve ever used are built and running as expected.
The one thing I’ll probably never get going is Citrix Metaframe presentation client. There’s no AMD64 package for it. I’m hardly heartbroken, as I still have two machines on which it runs just fine.
Tags: amd64, citrix, feisty, gcc, perl, ubuntu
Posted in computers suck | No Comments »
Sunday, April 22nd, 2007
I reinstalled Ubuntu completely last night, and took the opportunity to go to AMD64 mode. I had to sacrifice the cheapo ndiswrapper wireless card, so am now running a switch off the wireless bridge. So it works now!
It looks like Perl really doesn’t like 64-bit. CPAN’s having difficulty building.
Tags: 64_bit, amd64, linux, ndiswrapper, perl, ubuntu
Posted in computers suck | 2 Comments »
Sunday, February 18th, 2007
I’ve been playing with XSPF, mostly so I can use the XSPF Web Music Player. There’s a Perl API for working with XSPF (XML::XSPF) which works well, but is extremely short on documentation.
Creating a playlist with XML::XSPF is pretty logical: create a new track object for each new track, then feed an array of these tracks into the playlist object. It took me a couple of hours of fiddling about (and much use of Data::Dumper::Simple, the plain man’s guide to tortuous data structures) to find that out.
The end result is this:
id32xspf - create XSPF playlist to stdout from a list of MP3s with ID3v2 tags.
It’s intended for use on a local directory of MP3s, which will subsequently be uploaded to a website. It uses MP3::Info to do the tag work.
It has some limitations:
- every file must have ID3v2 tags.
- it doesn’t handle file:// locations at all well, as their syntax is system-dependent. You’ll probably have to use the –urlbase option. For example, for Unix systems for local files in the current directory, I find -u file://`pwd`/ works well.
- it doesn’t include track numbers, as I didn’t know that XSPF supported them.
- it doesn’t create track artwork links, as this isn’t included in ID3 data.
One slightly amusing caveat about the XSPF Web Music Player is that it doesn’t understand the rate of some of lame’s more amusing VBR presets. If you feed it files from the voice preset (56kbit, mono, resampled to 32000Hz), the results sound like Pinky & Perky …
Tags: flash, mp3, music, perl, playlist, xspf
Posted in choons, computers suck | No Comments »
Saturday, December 18th, 2004
m4p2mp3 — helper to turn an iTunes protected M4P to an MP3, so I can play music I have bought on my MP3 player. Probably runs best on a Unix-like OS.
You will need Perl, some M4Ps, mono, FairKeys, DeDRMS, faad, and lame. You’ll need to edit the script to say where the DeDRMS.exe file is. You’ll need to have run FairKeys to pick up your account details from Apple’s server.
Does the conversion via WAV, so you’ll definitely lose something. As written, MP3 file sizes are about 15% larger than the M4P. Doesn’t handle invalid MP3 genres gracefully at all; there is the beginnings of a mechanism to do this in the code, though.
This script doesn’t know anything about decryption, and thus contains no code to circumvent DRM.
Tags: drm, itunes, mp3, perl
Posted in computers suck | 1 Comment »
Tuesday, November 30th, 2004
You’ll need Perl, and Config::IniFiles.
Program: livemp3.
A sample ini file so you can see how to set this up: welch_rawlings_shepherds_bush.ini.
At the moment, this just generates output that you’ll need to feed to sh, but it handles renaming, converting and tagging MP3s to my satisfaction.
Update: it doesn’t handle FLAC tags, even though they’d be a good source of metadata. I may look into implementing that some day.
Tags: flac, live, mp3, perl
Posted in computers suck | 1 Comment »