Media Kind in iTunes COM for Windows SDK

Posted by Joel Verhagen on Stack Overflow See other posts from Stack Overflow or by Joel Verhagen
Published on 2010-06-04T19:49:46Z Indexed on 2010/06/12 15:32 UTC
Read the original article Hit count: 429

Filed under:
|
|
|

I recently found out about the awesomeness of the iTunes COM for Windows SDK. I am using Python with win32com to talk to my iTunes library. Needless to say, my head is in the process of exploding. This API rocks.

I have one issue though, how do I access the Media Kind attribute of the track? I looked through the help file provided in the SDK and saw no sign of it. If you go into iTunes, you can modify the track's media kind. This way if you have an audiobook that is showing up in your music library, you can set the Media Kind to Audiobook and it will appear in the Books section in iTunes. Pretty nifty.

The reason I ask is because I have a whole crap load of audiobooks that are showing up in my LibraryPlaylist.

Here is my code thus far.

import win32com.client

iTunes = win32com.client.gencache.EnsureDispatch('iTunes.Application')
track = win32com.client.CastTo(iTunes.LibraryPlaylist.Tracks.Item(1), 'IITFileOrCDTrack')

print track.Artist, '-', track.Name
print
print 'Is this track an audiobook?'
print 'How the hell should I know?'

Thanks in advance.

© Stack Overflow or respective owner

Related posts about python

Related posts about itunes