unofficial python audiobox.fm uploader

tl;dr audiobox-uploader-0.01.tar.gzgit repository

Some time ago I was being frustrated by my inability to access the music stored on my personal fileserver while at work — something about Apple having locked iTunes sharing to the local subnet, the lack of decent DAAP clients for Mac, and so on and so forth. Moving all the many gigabytes of music I have to my work laptop over work’s network connection is slow and anti-social, and at any rate then I have two places in which I need to manage my music and propagate new albums I buy. (Yes, if this were a Twitter post it would get the #firstworldproblems hashtag.) “Wouldn’t it be great, in this much-ballyhooed age of Cloud Computing,” says I to myself, “if my music could live in the cloud.”

Some friends of mine have a startup, MixApp, which lets me (legally!) publish the music on my fileserver and listen to it and chat about it with friends online, which was sort of like what I wanted. It’s actually a really neat service, and I like it and use it a decent bit, but I don’t always want to listen to music with other people, and the interface is tuned to the social music listening model and not so much to being like iTunes. Additionally, at the time they were having server problems (since resolved!) so that avenue wasn’t available to me.

I started looking around online, and the first service I ran across that seemed to fit the bill was AudioBox.fm. For a mere $10 a month, they’ll host up to 151GB of music, and they’ve got a nice Flash-based, iTunes-like player, last.fm scrobble support, decent library management capability, and most of the other features I expect out of modern music player software. They’ve got support for a bunch of formats besides MP3 (FLAC, OGG, and M4A being the ones I care most about), though all the music gets transcoded to MP3 for streaming, so I’ve been mostly converting to MP3 locally before I upload, since there’s no sense taking up the storage space for FLAC if I don’t get any benefit from it. Since it’s all my music, I can also get it back any time I want, so it’s a convenient backup of my music collection.

The only problem was getting all my music into the service. There’s currently a fairly nice Flash uploader, but it only takes 999 tracks at once and only MP3s, and there’s now also a Java WebStart-based uploader (which there wasn’t when I started), but most of my music lives on my Linux fileserver, not any of the client computers I use, so neither of those was going to do it. There’s also a nice RESTful API, and so I set out to write a Linux upload script.

Along the way, I discovered that none of Python’s built-in HTTP libraries deal with submitting multipart forms. I ended up stealing the multipart processing logic from Gabriel Falcao’s bolacha library, of which portions were in turn borrowed from Django’s test client, but I was disappointed that the support wasn’t built into something more comprehensive. Claudio Poli at AudioBox pointed me towards bolacha, and has been excellent to work with on this script — I’m pleased with AudioBox’s attentiveness to developers. (Careful observers will note that AudioBox offers both an OAuth authentication API for web services and HTTP Basic authentication for desktop applications, and Claudio promises that they aren’t going to pull a Twitter on desktop and open-source application developers.)

None of Python’s built-in or commonly-used HTTP libraries support bandwidth throttling, either, which turns out to be important when you’re uploading tens of gigabytes of music. I thought about building native support into the upload script, but I wanted to get a release out, and the trickle utility turns out to work marvellously on Python to limit its upload bandwidth use, so I punted on that. Seriously, if you don’t know about trickle already, you should make a note of it — I can’t remember the number of times I’ve wanted to throttle a program that didn’t provide the option, so its existence falls into the “I wish I’d known about this years ago” category.

At any rate, the result of my labors is audiobox-uploader-0.01.tar.gz, released here for the first time. Source can be found on Github, and users should please feel free to contact me with any questions, comments, or patches you might have. 🙂

my travel loadout, part 3: computers and cell phones

As promised in my last post on this subject and at long last, the computing and communication devices (increasingly the same thing) I rely on when traveling.

  • My personal laptop is an Asus EeePC 901, now sadly discontinued. Or at least it began life that way — I’ve now replaced the screen (due to the original cracking) and the original stupid-slow 20GB SSD with a nice fast Intel 60GB SSD. It’s got a 1.6GHz Intel Atom processor, so it’s no speed demon, but it’s fine for web surfing, e-mail, and SSH, which is most of what I used it for. (And in fact I did all my schoolwork on it last year, mostly using it as a terminal for faster machines located elsewhere.) It’s a wonderful travel machine, 2.5 pounds and easy to toss in a messenger bag with a couple days’ worth of clothes for short trips. It’s also got decent battery life — fourish hours with my usual use (and the modern web is not CPU-light), which is about what I expect, and better than my Macbook Pro, though apparently more modern netbooks can get something like eight or twelve. I’ve considered getting one of the extended batteries for it, but that ups the weight significantly and I don’t care that much day-to-day, so I haven’t bothered for now.

    I absolutely don’t mind the small form-factor for the keyboard, and in fact anyone who knows me well knows that I prefer small keyboards, and will bring one of my several Happy Hacking Lite 2 keyboards to wherever I work when I am forced to work on a desktop machine. I’m sad that nobody sells 9″ formfactor netbooks any more. They all seem supplanted by 10″ and larger netbooks, though I understand that most people don’t have my small-computer fetish. When I’m traveling, I care about every extra pound, and the 901 is an excellent machine for that. (I do wish it had some kind of minimal graphics chipset in it, because there are a lot of games of a certain age I’d like to play that should run fine on it, but then again most of what I play when I’m traveling is Crawl, so I don’t actually need it.)

  • My work laptop is a 13″ unibody Macbook Pro (which, ironically, I use a lot in the same way as a terminal for other systems elsewhere). It’s kind of becoming my primary machine, just because I do appreciate the larger screen (and my, is it a beautiful screen). The unibody has possibly the best build quality of any laptop I’ve encountered ever, which I appreciate a lot — it just feels sturdy. It’s about 5 pounds, and I’m lucky to get three hours of battery life out of it (I think average is more like two or two and a half), so it’s much more a machine which wanders between outlets than a true portable. Most of the things I don’t like about it are impedence mismatches between the software and me, not problems with the hardware, and if I had one of my own I’d definitely try installing Linux on it. (Last I asked around, I think wireless had issues, but these things change fairly fast?) Mostly I like laptops way better with a tiling windowmanager, Linux has a way better handle on multiple desktops than any other OS, and Steve’s Way is otherwise only about 75% congruent with the way I want to use my computer. But it’s being an effecive work machine, so that’s the most important bit right now.
  • My old G1 died a quiet death early this summer, and conveniently T-Mobile had just released the myTouch 3G Slide, which has a hardware keyboard (a requirement for me in a smartphone, since, in what you are no doubt beginning to recognize as a trend, one of my prime uses of it is a SSH terminal). I miss the G1 keyboard, which was about as close to a real, full QWERTY keyboard as I’ve seen anyone do on a phone (a full 5 rows), but I’ve found the Slide’s 4-row keyboard to be acceptable enough that I’m not considering upgrading to one of the newer phones with a physical keyboard. Android 2 is wonderful, and the ability to pull in phone numbers from Facebook is something I didn’t expect to find useful but I like a lot. I am annoyed that T-Mobile discontinued the 300 text message plan I was on, so I’m now paying $60 instead of $50 for the same service, since I never use more than 300 text messages a month anyway. (I’m still on the no-longer open Google Friends and Family plan, thankfully, so I save ~$10/month over what you’d see just starting out new now. I can’t quite see paying iPhone-level prices for the Slide, no matter how much I like it.)

So that’s basically my current travel loadout. Things that I’m still looking for, and would happily accept suggestions for:

  • Rollerboard luggage, at least the stuff I’ve got, is heavy. Really freaking heavy. Also, after this much travel, getting rather beat up, though I do kind of expect that. (Like, do they make rollerboards with aluminum frames that are any good at all? Because that would be nice.) I’m looking for a sturdy, lightweight, carry-on sized rollerboard.
  • I got a crappy cheap Bluetooth headset with my G1 for something like $10, which was worthwhile to prove the utility of the concept to myself, but not so great for long-term use. Does anyone have a Bluetooth headset they recommend? (I’m tempted by the headsets made by Etymotic Research, and I like their earphones, a pair of which I just got.)

Next time I’ll be posting some of the tips and tricks I’ve learned about international travel. (These are supremely unlikely to be news to my friends who travel a bunch, but I hadn’t known them beforehand, and I pay pretty close attention to you guys’ expriences, so maybe they aren’t well-enough known yet and could use a little publicizing.)