IMDb Data and iTunes

Using python, it’s easy to get data from IMDb into your iTunes database.

You’ll need a few tools to get this working. appscript, py-IMDb and CocoaDialog. Install each of these, and for the latter, note where you store it. I’m not going to go through the code, as it is fairly well commented. If you can’t get it to work, leave a comment and I’ll see if I can help.

IMDB2iTunes.py

Note that you will need to save the file above, and rename it so it has a .py extension.

EyeTV and two tuners

I love my Mac Mini. It does almost everything I want. With the purchase of a second tuner, EyeTV actually becomes useful. Previously, when I tried to record two programs that adjoined one another, but were on different channels, then you were likely to miss the start of the second program, and/or the end of the first program. Even if you set some padding (I use -5/+15), because there was a single time where the transfer needs to take place, chances are you miss some TV.

So, with two tuners, the system flawlessly records two programs at once. Which means the pre/post padding is respected, as long as there is no clash with other scheduled recordings. It means you then need to edit (or just skip, if you plan on watching only, not keeping), but at least you get all of the material. Oh, and it takes up a bit more disk space.

But the hassle I discovered is that the USB subsystem seems to choke under the load, if you record a program and try to watch another. The picture and sound of the program you are watching becomes jumpy and broken.

I made the program smoother by putting the record buffer into RAM. (And making it much, much smaller).

Note that this is using a USB disk as the recording location, I’m hoping to get much better performance when I move the drive to a Firewire enclosure. However, I can record two programs without jumpiness, so it may be something to do with the Live TV Buffer and how it is handled.

I don’t use live buffering much anyway, so I may just live without.

Transfer ratings from one iTunes Mac to another

I’ve consolidated all of my media onto my new Mac Mini, but didn’t really think some things through when I first did it. For instance, I put all of my video data in before transferring my music across. I’ve still kept a copy of my music on the laptop, for what it’s worth, but because I just copied files, then I lost all of my rating data.

I looked at a couple of solutions for transferring the ratings, the most promising was a semi-manual method of creating smart playlists, one for each rating.

That was too old-tech for me, so I came up with a solution that uses Remote Apple Events. Now, to make the code easier, I’m using python and appscript, so make sure you have both of those installed.

 1     #! /usr/bin/python  
 2     
 3     import appscript  
 4     
 5     # Set up the two iTunes libraries.  
 6     local = appscript.app('itunes')  
 7     
 8     # You'll need to replace jens.local with your remote machine's name  
 9     remote = appscript.app(url='eppc://jens.local/itunes')  
10     
11     local.lib = local.playlists()[0].tracks()  
12     remote.lib = remote.playlists()[0].tracks()  
13     
14     # Create a dictionary with all local track names/artists/albums  
15     library = {}  
16     
17     for each in local.lib:  
18         key = each.name()+":"+each.artist()+":"+each.album()  
19         library[key] = each  
20     
21     # Iterate over every remote track.  
22     # If it is in the local library, take the local rating and  
23     #    apply that to the remote track.  
24     for each in remote.lib:  
25         key = each.name()+":"+each.artist()+":"+each.album()  
26         print key,  
27         if library.has_key(key):  
28             each.rating.set(library[key].rating())  
29             print "rated."  
30         else:  
31             print "doesn't exist in local library"  

That’s it. I’ve used this to transfer all of my ratings from local to remote iTunes. Granted, there is no check to see if I’ve got all of the local tracks on the remote machine - but that is mainly because I don’t have my Podcast library on the remote machine, and I hope (know?) I have all of the music, and that’s the stuff I care about.

Here’s a screenshot from my remote library.