October 24, 2006
Wimpy iPod accessories

Yet another iPod remote is on its last legs. :-(

What is it that I do to this stuff? This will be the 2nd time I've had to replace an iPod remote within a year - and as for earphones, well, I go through them like Russell Brand goes through groupies. My Shures gave up after about six months - which isn't bad staying power for me. I tried some Philips 'phones that I can't even find on their web site, which were horrid, so now I'm back with yet another pair of EX71s, which again last me about six months a go, and are comfortable, sound good, and aren't too expensive.

I know I'm clumsy, but surely these things should built to take a bit of abuse?

Next time, I'm going for some kind of sports remote. I hope they are a bit tougher.

Posted by Simon Brunning at 01:04 PM | Permalink | Comments (4)
October 17, 2006
iPod goodies

On the subject of iPods, I have spotted a few nice iPod bits and bobs recently:

  • Wearable iPod remote. This would be dead useful for me, 'cos I'm forever breaking my iPod remotes. I'm not so much extreme-sports as I am extreme-clumsy, but it has much the same effect.
  • iPod screensavers. Pointless, but fun. Any suggestions as to what I should use? Kylie?
  • Wikipod. Hmmm, I have 2.88 GB free...

Posted by Simon Brunning at 12:55 PM | Permalink | Comments (3)
DVD Audio format-shifting on the Mac

OK, Mac gurus - how do I rip the audio from a DVD to MP3, so I can listen to it on my iPod, preferably using open source software?

I own the DVD in question, FWIW. ;-)

Update: Mac the Ripper and ffmpegX did the job between them. Thanks.

Posted by Simon Brunning at 12:37 PM | Permalink | Comments (8)
January 05, 2006
There goes my Christmas bonus...

My iPod let its magic smoke out over the weekend. my Mac's Disk Utility reported broken B Trees. First aid couldn't fix it, and the disk couldn't be partitioned either - it just sat there for hours trying to build a partition table.

Sad, but perhaps unsurprising. It has spent the last eighteen months pretty mush constantly in the pocket of the must clumsy, drunken man in South London. That's got to be hard on a hard disk.

Two days without sounds on the road proved that my teenage music addiction had come back with a vengance, so I went and blew the remains off my bonus on a shiny new 60GB iPod Video.

What's bad? All the accessories that I'd accumulated - cases, mains charger and a remote - are useless. I'll have to start again from scratch. :-(

What's indifferent? The 'Video' bit. I've ripped a couple of DVDs, just for the hell of it, but I really can't see myself watching anything much on it - especially given the way watching video burns through the battery.

Errr, well, rocket boom perhaps. ;-)

What's good? Everything else. It's lovely. The screen is beautiful, and I love being able to see the covers of my CDs as I'm listening to. The new iPod seems louder than my last one, which suits me fine. I can fit all my music on it. And as usual, it's the little touches that Apple get right. The icon on my desktop even knows which colour iPod I bought! Class.

Posted by Simon Brunning at 06:45 PM | Permalink | Comments (3)
August 25, 2005
Happy Birthday!

My iPod is one year old today. I've listened to it for a grand total of 33 days, 4:17:38, according to the second of these scripts. That's getting on for 10% of the time!

Thanks again, Mum. Best birthday present ever.

Bad news is, my earphones did again, only yesterday. That's three sets I've got through in the last year - I must be seriously rough on them. Anyway, I might get some Shure E2Cs this time - I spotted them on one of those dodgy Tottenham Court Road shops for thirty-five quid or so.

Posted by Simon Brunning at 01:24 PM | Permalink | Comments (1)
August 17, 2005
All Quiet

I seem to have left my iPod playing when I got home last night, 'cos it was dead this morning. I hate commuting without music. (It's happy enough now though - it was just the battery.)

Besides which, being the nerd I am, I had to knock this up to make sure that my metadata is still correct:

import win32com.client
 
def main():
    iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
    
    quiet_tracks_playlist = iTunes.LibrarySource.Playlists.ItemByName('Reduce Played Count')
    for track in quiet_tracks_playlist.Tracks:
        print 'reducing played count for', track.Artist, '-', track.Album, '-', track.Name, 'from', track.PlayedCount,
        track.PlayedCount -= 1       
        print 'to', track.PlayedCount
 
if __name__ == '__main__':
    main()

How sad is that?

(I suppose that I'll be learning how to script iTunes all over again once I've got my new Mac.)

Why do I care about re-setting the played count? 'Cos I want this to be right:

import datetime
import time
import win32com.client
 
def main():
    iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
 
    total_time = datetime.timedelta(0)
 
    for track in iTunes.LibraryPlaylist.Tracks:
        try:
            track_time = time.strptime(track.Time, '%M:%S')
        except ValueError:
            track_time = time.strptime(track.Time, '%H:%M:%S')
        track_length = datetime.timedelta(hours=track_time.tm_hour,
                                          minutes=track_time.tm_min,
                                          seconds=track_time.tm_sec)
        track_time = track_length * track.PlayedCount
        total_time += track_time
                                                 
    print 'Total iPod time:', total_time
 
if __name__ == '__main__':
    main()
    raw_input('Hit enter to continue...')

And how sad is that?

Posted by Simon Brunning at 05:08 PM | Permalink | Comments (3)
June 29, 2005
iTunes and Podcasts

Oooh! The new version of iTunes is out, 4.9, with built-in support for Podcasts.

Now, what to subscribe to? IT Conversations has some interesting stuff, and Radio 4's Today is a must have. Any other good podcasts out there? Any good music ones? (This is my taste.)

Posted by Simon Brunning at 11:02 AM | Permalink | Comments (5)
February 24, 2005
iPod earphones

Steve's having trouble with his iPod headphones and his he'll-grow-into-them ears.

I'd recommend that you pick up some Sony MDR-EX71s, Steve. (Now available in white!) I had a pair of these, and they sound fabulous.

My pair died, but Tulna's had hers for ages, so I think that I was just unlucky. I picked up some cheap 'n' cheerfuls, but they are no good at all, so I'll be picking up another set of EX71s when I see them.

BTW, is it just me that can't see Haloscan? I can't see the haloscan comments on any of the blogs that use them (Steve's, the London Java blog, witho etc.), and I haven't been able to for some days now.

Posted by Simon Brunning at 12:40 PM | Permalink | Comments (7)
New iPod software

iPod Updater 2005-02-22

I don't have my power supply with me, so I can't try this until I get home. And come to think of it, I'm out this evening, so I can't try it until tomorrow.

"Shuffle Songs selection in Main Menu" - my iPod already has a "Shuffle Songs" item in the main menu, so what does this mean? Does it allow you to toggle the shuffle settings as you can from the settings menu? (You know, that Songs/Albums/Off) thing? That would be nice.

Nicer still would be the ability to put selected playlists in the main menu...

Posted by Simon Brunning at 12:23 PM | Permalink | Comments (3)
February 23, 2005
Online lyric database

Anyone know of an online lyric database that I can get to pragmatically? I'm not above a bit of scraping if need be, but I'd prefer something cleaner - and I want somewhere that explicitly states that programmatic access is OK. I don't want to rub anybody up the wrong way.

I'm thinking of putting together something to display the lyrics of whatever I'm listening to in iTunes. Catching the events that tells me what's playing seems to work OK. Here's my proof of concept - show_playing_track.py. The next stage will be to actually retrieve the lyrics from somewhere.

I did look at EvilLyrics, but that seems to bugger iTunes up on my PC. Besides, it's more fun to write my own. ;-)

BTW, I've cleaned up convert_tracks.py a little, and made it a little more robust. It doesn't choke on read-only files now. Is there a cleaner way to write enable files in Windows than os.chmod(filepath, 0777)? That 0777 is nasty.

(See Batch iTunes track conversion with Python and COM for more about convert_tracks.py.)

Posted by Simon Brunning at 01:17 PM | Permalink | Comments (15)
February 04, 2005
Batch iTunes track conversion with Python and COM

I think that I see now why Apple has kept the iTunes interface simple. It's a simple app that does simple stuff, and it just works. Once you get it into your head that you can do whatever you like, where do you stop? I see that I'm not alone in getting a bit carried away - Garth and Chris have also been having a play with driving iTunes with Python and COM, too.

Anyway, on to my latest folly, batch conversion. I initially ripped all my CDs to MP3 at 192 kbps. I've since discovered that I'm quite happy with plain old 128 kbps, especially for the more raucous stuff in my collection. And I'm running out of room. So I want to convert a bunch of track to a lower bitrate. (And before you tell me, yes, I know that converting from 192 kbps to 128 kbps will give me a somewhat lower quality that I'd have had I ripped to 128 in the first place. I'll probably re-rip at my leisure.)

Now, you can convert from one format and bit rate to another in iTunes, but the process leaves a lot to be desired. For a start off, you end up with both the original and the new track, and you have to remove the original track yourself, which is fiddly - you have to make sure that you get the right one for a start. Also, there's a lot if metadata that doesn't get copied across to the converted track - the rating that you've given the track, the last-played date, that kind of thing. Lastly, if you've put the track into any manual playlists, the newly converted track won't be in them.

So, I came up with a script to do the conversion for me - convert_tracks.py. You just bung the tracks that you want converted into a playlist (called "To Convert" by default), set the conversion rate that you want to use in your iTunes' preferences, and away you go.

This script works OK, but there are a couple of problems with it. Firstly, though you can set the encoder to be used, I can't find any way of programatically setting the bitrate. You have to do it manually via the iTunes preferences dialog. A bit of a shame, but no biggie.

More seriously, you have to be very careful to leave iTunes alone to its thing. If iTunes shows any dialog box, your iTunes COM connection will fail if you make any calls to it. I could just trap the exceptions, but that would be The Wrong Thing. Instead, I think that I need to register for OnCOMCallsDisabledEvent()s. When I get one of these events, I should hold fire on COM calls until I get a OnCOMCallsEnabledEvent(). I've had a bit of a play with registering for iTunes events - see show_playing_track.py - but it's early days, and I've been too busy this week to look at it.

(Also, it would be nice if it were to be driven by command line arguments, a cinfuguration file or even a GUI rather than by hard-coded constants - but since it's pretty much a one-off script, I really can't be bothered.)

Anyway, I hope this is of some use to somebody. (All code runs with iTunes 4.7.1 Python 2.4 and Python for Windows build 202, and may work with earlier versions.)

Posted by Simon Brunning at 05:05 PM | Permalink | Comments (4)
December 09, 2004
It's Here...

My new iPod is here. Now, four hours to charge it, and around about five to download all my music to it.

Sigh. No music 'till tomorrow. :-(

Posted by Simon Brunning at 01:23 PM | Permalink | Comments (8)
December 08, 2004
A Shiny new iPod

According to Apple support, I'll be getting a replacement iPod soon. Obviously they couldn't fix the old one. How soon, I'll just have to wait and see...

I didn't have a case for the old one. I quite like the idea of a slightly beaten up look. A slightly beaten up look, that is - my iPod was looking a bit too lived in after just a couple of months. So, I might take a trip down to the Apple Store, Regent Street, and see what they have.

Update: It's been dispatched!

Posted by Simon Brunning at 10:55 AM | Permalink | Comments (2)
The Playlist Meme

1. Open up the music player on your computer.

2. Set it to play your entire music collection.

3. Hit the "shuffle" command.

4. Tell us the title of the next ten songs that show up (with their musicians), no matter how embarrassing. That's right, no skipping that Carpenters tune that will totally destroy your hip credibility. It's time for total musical honesty. Write it up in your blog or journal and link back to at least a couple of the other sites where you saw this.

5. If you get the same artist twice, you may skip the second (or third, or etc.) occurances. You don't have to, but since randomness could mean you end up with a list of ten song with five artists, you can if you'd like.

Here's my list:

SongArtistAlbum
African DanceSoul II SoulClub Classics Vol. One
When The Angels FallStingThe Soul Cages
BlissMuseOrigin Of Symmetry
Moments Of PleasureKate BushThe Red Shoes
Love Of My LifeSantanaSupernatural
'Jig' Fugue In GPeter HurfordBach: Toccata and Fugue in D minor
No GoodB.B. KingCompletely Well
I Knew YouTanita TikaramCappuccino Songs
Get Up (Sex Machine)James Brown20 All-Time Greatest Hits
Not My IdeaGarbageGarbage

Via Erik.

Posted by Simon Brunning at 10:10 AM | Permalink | Comments (10)
November 29, 2004
It's all gone *very* Pete Tong

My iPod is poorly. :-(

I tried formatting the disk, as Apple suggested on Friday. Didn't work. I initially just right-clicked on the drive in Explorer and selected 'Format...', but this just hung for hours, and made no progress.

I also tried re-formatting from the command line, and using Windows Disk Management as per this Apple support article. Same deal.

Still, support seems pretty good thus far. They are sending someone to pick up my iPod for me. And you can tell that they are a class act, 'cos their hold music was Kind of Blue.

Anyone else had to sent their iPod away for repair? How long should I expect to have to wait?

Posted by Simon Brunning at 01:25 PM | Permalink | Comments (8)
November 26, 2004
It's all gone a bit Pete Tong

Running iTunes on Windows, whenever I try to update my iPod, I get the following error dialog:

Windows - Delayed Write Failed
-
Windows was unable to save all the data for the file \Device\Harddisk2\DP(1)0-0+6\iPod_Control\Music\F09\07 Cryin_ Won_t Help You No.mp3. The data has been lost. This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere.

This doesn't always happen after the same amount of time - it may happen after loading 50 tunes, it may get to 150. It's not always the same tune, either.

The iPod will have frozen at this point, and needs a reset. Sometimes I need to reload the iPod software after this happens, sometimes not.

I've recreated this issue connecting to two seperate Windows machines, so whatever the problem is, it's on the iPod side. I rang Apple Support, and they suggested that I re-format the iPod's HD. I'd thought that reloading the iPod software did that, but apparently not.

I'll try this when I get home. I can't do it now - I'm on a client site in Orpington again. Wish me luck, 'cos if that doesn't work, it's got to be sent away to the menders. :-(

Posted by Simon Brunning at 01:41 PM | Permalink | Comments (5)
November 24, 2004
Silence

No music today. :-(

The bad new is that my earphones have died. The good news is that the iPod is still happy. :-)

Still, I can't live without music for long, so I'll have to get some new earphones this evening. Anyone got any recommendations as to good in-ear 'phones at a fairly reasonable price? I'm not an audiophile, but I do need something fairly decent.

I'll pick them up on the way to Genes, worms and the new genetics. Anyone else going?

Posted by Simon Brunning at 01:16 PM | Permalink | Comments (7)
November 23, 2004
More Pointless iTunes fun with Python

iTunes isn't too great at working with selected and de-selected tracks. You can't sort by selection, for instance - you can't sort your library so as to show all de-selected tracks then all selected tracks. Nor can you build smart playlists based on whether a tune is selected or not.

Well, not without getting your hands dirty, that is. ;-)

Since my iPod is now rather full, I've de-selected some albums, and some individual tracks. Now, I'd like to burn the albums that I've de-selected onto CD, and remove them from iTunes altogether. My hard disk is getting a bit full, too. ;-) But, I only want to do this with whole albums - individual de-selected tracks should be left alone.

My library isn't that big. Any normal person would just scroll down through the library, and manually set up a playlist of stuff to remove. Not me, oh no, I'd much rather spend several times the time writing a script to do it all for me. Plonker. Anyway, here it is - create_deselected_albums_playlist.py. I hope someone finds it handy - it would be nice if I hadn't wasted my time entirely.

See also Driving iTunes from Python on Windows.

Posted by Simon Brunning at 04:55 PM | Permalink | Comments (4)
November 08, 2004
Make your own iPod cover

Make your own iPod cover, via burnbitter. I'm sure I can find something to use as an image...

Posted by Simon Brunning at 02:42 PM | Permalink | Comments (3)
November 05, 2004
Driving iTunes from Python on Windows

Inspired by David Janes' pytunes, I've been having a play with driving iTunes with Python.

The first thing that I've discovered is that running EnsureDispatch over iTunes utterly screws up pytunes. The lesson here is to always use EnsureDispatch. If you don't, your code might break as soon as somebody else's code does. This applies to COM scripting with Python in general, I think.

It's all pretty easy. If you're familiar with COM scripting with Python, then you already know almost everything you'll need to know. Grab the iTunes COM for Windows SDK, and off you go! Fun, if utterly useless, is driving iTunes from a Python interpreter:

>>> import win32com.client
>>> iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
>>> iTunes.LibrarySource.Playlists.ItemByName('Party Shuffle').PlayFirstTrack()
>>> iTunes.Pause()
>>> iTunes.Play()
>>> iTunes.PreviousTrack()
>>> iTunes.NextTrack()
>>> iTunes.CurrentTrack.Name
u'Would Not Come'
>>> iTunes.SoundVolume
50
>>> iTunes.SoundVolume = 25
>>> iTunes.SoundVolume
25
>>> iTunes.SoundVolume = 50
>>> iTunes.Windows.Item(1).Minimized = True

Perhaps slightly more usefully, you can also edit your tracks' metadata. For example, here's a mickey-mouse script that I used to clean up some dodgy quote marks in my library - quote_clean.py.

Update: This one is actually marginally useful - find tracks that have no images, or more than one, with wrong_image_count.py. Anyone know where I can find cover art for "River Station" by Jimmy Giuffre & André Jaume? Google doesn't know it exists. Perhaps it doesn't...

Update: See also See also More Pointless iTunes fun with Python.

Posted by Simon Brunning at 02:05 PM | Permalink | Comments (9)
October 27, 2004
iTunes 4.7

iTunes 4.7 is out. The minimise to system tray (or whatever) feature is very nice, but, ARRRRGH, now whenever I eject my iPod, it stops charging - so I can't listen to it and charge it at the same time.

And as for the iPod Photo, is it just me, or is this a rubbish idea?

Posted by Simon Brunning at 02:49 PM | Permalink | Comments (7)
October 22, 2004
Back In The U.S.S.R.

I decided to take a punt on AllOfMP3. I've grabbed much of the vinyl that I'm missing on CD, a lot of it stuff by The Beatles and The Police. It's all worked fine, and the MP3's are of good quality. My iPod is now nice and full. ;-)

BTW, the Bose SoundDock looks gorgeous, doesn't it? But £250!

Posted by Simon Brunning at 12:35 PM | Permalink | Comments (2)
October 21, 2004
AllOfMP3

AllOfMP3 - is it legal? Is looks too good to be true, but if it is legal, it's a great way of picking up high quality MP3s for cheap.

I wouldn't use it to get new stuff - I don't think that would be ethical. But I'd quite happily use it to pick up any stuff I own on vinyl...

Posted by Simon Brunning at 11:01 AM | Permalink | Comments (2)
October 12, 2004
pytunes

Check out pytunes - a Python interface to iTunes.

Apparently, Apple have exposed a COM interface to iTunes. If I'd known that, I might have written this myself. Unfortunately, the exposed interface is incomplete. You can't read all of the track meta data - 'My Rating', 'Play Count' and 'Last Played' are missing, for example. And you can't set anything - all the attributes are read only. This is a real shame, 'cos it means that I can't use the COM interface to do what I really want to do - transferring my iTunes library's meta data from one PC to another.

There are a number of ways of transferring the tracks themselves. I use iPod Agent. But this doesn't set all the meta data. 'My Rating', 'Play Count' and 'Last Played' don't get set, for example, and since some of my smart playlists are driven by these values, I really want this all transferred too.

Time to dust off winGuiAuto, perhaps, and its new big brother WATSUP?

Update: David has pointed out the iTunes COM for Windows SDK. The C header files in there seem to refer to the ability to read and set all the meta data that I need, so perhaps I can read and set everything I need to. I'll keep looking...

Posted by Simon Brunning at 01:53 PM | Permalink | Comments (10)
September 08, 2004
iPod shuffle

One thing's been keeping me sane while I've been working with Cthulhu's crud - my lovely new iPod. ;-)

I've now ripped just about every CD I own - every one that I might want to listen to, at any rate. Here's a full listing of what's on my iPod now. Be warned - the list itself is nearly 3 MB!

One of the best things about the iPod for me is the shuffle feature. Just fire it up, and it selects tracks at random from your iPod - it's just like having your own personal radio station.

I say at random, but I'm not sure that it is entirely at random. I'm fairly certain that highly rated tracks are picked more often than are lower rated tracks. (You can assign every track your own rating, one to five stars.) This is great - exactly what I'd want.

What I'm a lot less sure about is multiple tracks by the same artist. It seems to me that you hear two tracks by a single artist within a track or two of one another far more often than you should. But then, the human is very good at spotting patterns, even when the patterns aren't real. There are good evolutionary reasons for this - it's better to start at the tiger that isn't there than it is to ignore the tiger which is. So, it's quite possible that I'm imagining this. Without doing some stats, it's impossible to tell...

Anyway, technical help. Is there any easy way to transfer my iTunes library from one PC to another, without loosing my ratings and so on?

Posted by Simon Brunning at 01:14 PM | Permalink | Comments (6)
September 03, 2004
What's on my iPod II

Here's what's on my iPod, just in case you were interested. (Be warned - this is a 2 MB page!)

This listing was generated by the lovely iPod Agent, which will also be helping me out this evening by enabling me to dump all this stuff onto my home PC. The listing isn't quite how I'd like it - there's only one route into the tracks, whereas I'd like to be able to go in via genre, artist, album or composer, and the tracks don't link to anywhere - but it'll certainly do for now.

Posted by Simon Brunning at 12:46 PM | Permalink | Comments (1)
September 01, 2004
What's on my iPod

Music on my iPod: 15 genres, 66 artists, 117 albums, 1433 songs, 4.5 days, 8.48 GB. I've got 4.25 GB of data on there, too - a copy of my essentials DVD, so I'm down to five and a bit gig. But then, I've burned nearly every CD I own now, so I won't be needing that much more room!

If you're interested, here is my iTunes library in zip format.

I will be hunting around for CD copies of any vinyl that I own. I'm very anti-piracy, both the software and music flavours, but as far as I'm concerned, if I own the vinyl, I've paid for the song, and ripping from someone else's CD is legit. So, anyone have anything by The Beatles or The Police on CD that they wouldn't mind lending me? ;-)

My next job is to improve the metadata. Many of the tracks are missing composer details, and dates are often missing or wrong. I have all the CDs, so it's just a matter of banging it all into iTunes while I'm watching telly or something.

Then I want to put together an iTunes XML to HTML converter. I know that there are such things already, but I fancy doing my own all singing all dancing version. I'll want to do all the indexes - by genre, by artist, by album, by composer, you name it. And I want it to look nice. So far, so easy, I reckon, using Python, PyXML andCheetah. But I'd also like to make the artist, album and track names into links to the appropriate allmusic page, and I don't know if this is even possible. The Mp3 Tag Tools claoms to be able to do it, but it doesn't seem to work. It looks like allmusic has changed the format of its URLs, and not for the better - I can't see any meaning in them whatsoever. Sigh. Perhaps I'll drop them a line...

Posted by Simon Brunning at 03:10 PM | Permalink | Comments (9)