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 to Python by Simon Brunning at October 12, 2004 01:53 PM
Comments

I know you've mentioned copying from one PC to another before. I don't understand why just copying the itunes directory doesn't work. On my work PC that is in C:\Documents and Settings\richard\My Documents\My Music\iTunes. Why can't you just copy that entire directory to another PC?

Posted by: Richard Chamberlain on October 12, 2004 02:15 PM

I currently don't have any way of getting 12GB from one PC to another. I'm sure that I can manage that, though, if I need to - if it will work. But when I import files into iTunes, it seems to blank out 'My Rating', 'Play Count' and 'Last Played'. How do you get around that?

Posted by: Simon Brunning on October 12, 2004 02:22 PM

Instead of importing why don't you replace the iTunes directory with your copied one? Obviously make sure iTunes isn't running at the time.

Of course if you're trying to merge then that is more difficult.

Posted by: Richard Chamberlain on October 12, 2004 02:26 PM

Are you SURE they aren't settable and are you sure that all that information isn't exposed? All of the things you want to do are most definitely exposed from the Mac interface. pytunes is most definitely a tiny subset of the capabilities of the COM interfaces that are exposed by iTunes. I've used the COM interface to discover iPods, create playlists and add tracks.

As far as migrating metadata from one iTunes to another, the music database is mirrored as an xml file (on Mac, anyway) that you can import into another instance of iTunes... but also, the metadata is mirrored in the tracks for the most part (depending on the version of id3 tag, and it doesn't include playlists, of course).

Posted by: Bob Ippolito on October 12, 2004 08:58 PM

Actually, Bob, I'm pretty sure that I *can* read and set everything that I want. The API calls aren't in the obvious place - on the track - but the SDK includes docs showing how to do this. I'll have a look into this when I have the time.

If the XML file exists in the PC version of iTunes, *I* can't find it. I can create an XML file by exporting, but importing into another instance if iTunes doesn't set the meta data.

But that's OK - it looks like I'll be able to do this with the COM interface.

Posted by: Simon Brunning on October 13, 2004 08:34 AM

I have an xml file and it's the iTunes directory I mentioed. It's called 'iTunes Music Library.xml'. That does contain all the information you want.

Posted by: Richard Chamberlain on October 13, 2004 11:22 AM

Nope, nothing there, Ricard.

Ah, found it. On my PC its pit it in C:\My Music\iTunes. I'll give it a bash...

Posted by: Simon Brunning on October 13, 2004 12:22 PM

I recently moved my itunes library from one pc to another. When I did this, the directory structure stayed exactly the same, and my rating came with it. I then copied that exact same itunes library to my desktop but under a different directory structure. When I did this, my rating did not come with it. I edited the xml file (located under the folder "itunes") and changed a couple songs to point to the correct directory structure. While I was in there, I noticed that the rating was specified within the xml file. However, even after updating the directory structure and re-adding the songs, my rating was still missing. Can anyone run with this?

Posted by: Joe B on March 14, 2005 04:14 AM

Same problem here, I watched the apple how-to vid on their site and my rating and play count are gone! I spoke to an apple guy today and he said something about setting it up right the first time before launching itunes, so I deleted both my Apple Computers folders in Application Data and Local Settings / application data. Then I forcefed it by duplicating these directories from the old pc, and made sure I had both systems running same version of itunes. The result? SQUAT! Just my songs without the data. Uber annoying.

Posted by: Niero on January 31, 2006 12:13 AM

bible quotes about sex penis torture suckit blonde boy snowboarding

Posted by: Sasha on October 27, 2008 06:32 AM

bible quotes about sex penis torture suckit blonde boy snowboarding

Posted by: Sasha on October 27, 2008 06:32 AM

girl hockey players huge cocks screwing girls girl scout uniforms tulare horse cock penetration

Posted by: Future_dim on October 29, 2008 05:08 AM

girl hockey players huge cocks screwing girls girl scout uniforms tulare horse cock penetration

Posted by: Future_dim on October 29, 2008 05:08 AM

Posted by: Future_dim on October 30, 2008 03:02 AM

Posted by: Future_dim on October 30, 2008 03:02 AM

Posted by: Future_dim on October 31, 2008 10:35 PM

Posted by: Future_dim on October 31, 2008 10:35 PM

Posted by: Future_dim on November 1, 2008 04:17 AM
Post a comment
Name:


Email Address:


URL:



Comments:


Remember info?