It Shouldn’t Be This Hard
I’ve been in Japan for a while now and one thing I’m really missing is music. Which isn’t to say that there’s no music in Japan of course. There’s plenty of music, even Western music. Although albums here tend to be more expensive than they would be back home, if you’re willing to go looking you can pick up CDs quite cheaply (thanks in no small part to Japan’s huge rental CD industry and the used CDs that rental places sell at ridiculously low prices).
So why I am missing music? Well to be more specific I’m missing two things: Australian music and new music. Although the latter eventually tends to make its way over here it’s still not uncommon for ‘new music’ in Japan to be months, if not a year or so, old. This varies greatly depending on the artist and the record label and there are occasions where almost the opposite is true. Having said that, though, Australian music rarely gets to Japan unless it’s played in an iPod commercial. This makes me very sad since back in Australia my radio station of choice was the ABC’s ‘Youth Network’ Triple J. For those reading this who aren’t very familiar with the Australian radio landscape Triple J is to MTV what the Village Voice is to E! Entertainment Television.
Triple J’s specialities are Australian music and new music. Unburdened by the requirements of a corporate network (the ABC is the government-funded broadcaster in Australia) Triple J was free to play music without needing to worry about whether it would be popular or not. That a great deal of music would eventually find its way onto the commercial networks was testament to the programming skills of the boffins working at Triple J. Still, there’s plenty of music that for whatever reason would never get any airplay were it not for Triple J. It’s this music in particular – obscure Australian hip-hop for instance – that I was most missing.
So I like Triple J. I’m sure some of you are already heading to the comments section as you read this to let me know, ‘Mike, you can stream Triple J to your heart’s content. You can even do it in mp3 format.’ Yes, this is true. After initially only supporting Real Media and Windows Media streams Triple J also streams all their content in mp3 format (you can listen to it here). This would almost be good enough were it not for my iPod. As it stands a great deal of the music I consume listen to is on my iPod and needing to be chained to my computer just doesn’t cut it.
I like to think it’s here that a lesser man would have simply given up and thought, ‘There are more productive things I can do with my time.’ Not I. Sure, there’s plenty of things I could be doing but if I used that as the criterion for deciding what to do I’d never attempt anything stupid. Having lacked a project I could really sink my teeth into I decided that the only sensible thing to do in this situation was to set it up so that I could record the Triple J stream and listen to it later. When I say it like that it hardly sounds difficult at all, and indeed that stage took me all of about 10 minutes hunting on the Internet to come across Streamripper.
Realising there was still a good deal of Friday (and possibly Saturday!) left I decided that wasn’t enough. Recording the stream into an mp3 was kind of useful but it was still sitting on my HDD. Would it be great, I thought to myself, if instead of having to manually import it I could get it added to iTunes automatically? Hell, yeah! In fact it’d be better than great. It’d be frickin’ awesome. And if I owned an Apple laptop instead of an Acer one another five minutes probably would have seen the end of this story. One of those sleek Macbook Pros still alude me, however, so despite the hard work of ‘Doug’ and his ‘AppleScripts’ this was a road I was going to have to walk alone.
After having a look around it became clear that the best way to do this was with the assistance of Dircaster. Although not the best written piece of code it looked sturdy enough for what I wanted. But then I started to get ahead of myself (as I am want to do). When I imported the podcasts I wanted them to include all the neat sort of information and to be properly titled like they would be in a professional podcast. Since the Triple J stream doesn’t send information about the broadcast (like who the DJ is or what the name of the song playing back is) I’d have to add this by myself. I then started looking around for a way to edit the tag information of mp3s via the command line (since I wanted this to be something I could schedule Windows to do in the background it needed to be all command line-driven). It took me quite some time hunting with Google until I came across the rather simply named Tag.
After setting Tag up and working all the bugs out I imported my test track into iTunes only to discover, much to my frustration, none of the information had been imported across. Opening up the original mp3 in Winamp I could see the information there. Then I noticed the information was all in the ID3v1 field. Checking that Tag text file again I noticed that its ‘support for multiple standards’ was limited to ‘reading and removing’ ID3v2. Well what good was that? I may as well have been editing the data with Paint! My search commenced again without delay and eventually I found my way to metamp3. Hoorah! Here was what I was looking for: an ID3 editor that wrote ID3v2 tags.
Now as I mentioned above I really wanted this to be all done through the command line so I could write up a batch script that would automate the entire process. Unfortunately this meant handling the FTP transfer to my web server using Microsoft’s FTP program. After wrestling with it and its awful, awful, awful documentation I managed to get the file from point A (which is to say, my HDD) to point B (the web server) only to discover on retransfer back to my computer that it was all garbled. At this I threw my hands up in the air and decided to just download another FTP client.
However, no sooner had I done this than I realised this was all moot. The stream I wanted to record most of all was Richard Kingsmill’s 2007 programme: a three hour broadcast on Sunday evenings of the latest music. Three hours?! At 128 kbps?! Why didn’t I think about this first?! A file recorded in that quality was likely to be close to 180 MB or so. Not only would that take forever to both upload to my web server and then download back to my computer but it would exceed the storage space I have.
It was at this point that I could think of only one thing: shit. I’d spent hours on this already, far too long to give up. It had been my intention to avoid permanently running an HTTP server on my laptop but desperate times called for desperate measures. Still, there was one thing I knew. If I was going to run a web server all the time I sure as hell was going to make sure it was small. Eschewing the more popular Apache I decided to have a fling with the awkwardly named lighttpd. Only problem was that the web site hosting the Windows installation was down. For hours. (It’s back up now.) This wasn’t going to stop me, though. Searching around Google’s cache I discovered the files were mirrored.
I now thought I was near the end of the road. It was mid-afternoon by this point and having been working on this for a few hours I thought my quest had finally come to an end. I mean what could go wrong? Plenty could go wrong, it seems. The most major being that lighttp wouldn’t work. Or to be more specific, it wouldn’t work as a background process. It worked fine as if I ran it manually but I didn’t want to do this. I wanted it to be hidden so I could forget it was there. In the end I tried everything short of compiling the original source code myself. You can’t keep an idiot down, though, and I saw this for what it really was; not a reason to give up on such a pointless exercise, but as a hurdle, to be surmounted as one would surmount any hurdle: in short shorts (it was very hot yesterday).
In my search for a mirror of the Windows version of lighttpd I had come across a Hungarian version for Windows. Dismissing it as not worth my time I reconsidered, thinking perhaps I had been too harsh on the Hungarians. After all, plenty of good things had come out of Hungary. None that I can easily recall but, shit, if American Samoa can employ people to run its Office of Tourism (although evidently not a web designer) then Hungary must have produced something worth writing home about. Feeling a new found connection to my Hungarian brothers I dove into the WLMP Project. (Oh, and I note that the English version of WLMP now appears to be working.)
So, with my trusty Hungarian version of lighttpd working as it was supposed to (thank you Budapest!), with PHP already installed, with Dircaster… dircasting I was surely close to the finish line. Time to run a test version. Not that there’s anything that could go wrong. I mean it worked before. I hadn’t done anything special. Even the Hungarian version of lighttpd was working like it was supposed to. This was just going to be a quick once over before bed. Just fire it up, run that batch script and — and, oh, look… Dircaster doesn’t work anymore.
Yes, in spite of the fact that Dircaster had been working just fine up to this point it decided now it had had enough and it was throwing in the towel. A better programmer than I would probably have looked upon this as a challenge. I looked upon it with tears. Why couldn’t it just work? Why was this all so hard? I had a file that I wanted to import into iTunes as a podcast. Why can’t iTunes just periodically check a folder? Why must I be on a Mac to achieve this awesome feat? Why Steve, why?!?!
There were a lot of questions but I knew no answers would be forthcoming. No, there was only one way out and that was to fix the Dircaster script myself. Pushing the thought of sleep from my mind I fired up my trusty text editor and leapt into the fray, inserting debug statements everywhere to try and work out what was going wrong. Now while I hold a degree in computer science I don’t think it’s from a very good university so it didn’t surprise me that this rather simple bug took me all of about an hour to track down. To be fair to me, it was late, I was tired and it’s always difficult reading someone else’s code. To be honest, the code was very well documented and I am just not very good. Still, I did eventually find the solution and with a quick ‘delete’ it was done. (Having fixed this problem there was still another few alterations that I had to make but after having done that it finally worked.)
I went to bed knowing that in spite of a day that had otherwise been a complete write-off I could go to sleep knowing that on Monday I would be able to listen to the dulcet tones of Richard Kingsmill while I went to school: a joy I knew no one else on the train would be stupid enough to even bother attempting.
About this entry
You’re currently reading “It Shouldn’t Be This Hard,” an entry on inqk.net.
- Published:
- 05.05.07 / 3pm
- Category:
- Technology
- Tags:
- Print:
- Print this entry.
- Share:
- Share this entry.



No Comments and No Trackbacks
Jump to comment form | comments rss [?] | trackback uri [?]