Finding file details...

Kalibr space.captain.face at gmail.com
Thu May 29 06:26:27 EDT 2008


On May 29, 7:55 pm, Tim Golden <m... at timgolden.me.uk> wrote:
>
> You don't say, but I assume you're on Windows since you mention
> GetFileVersionInfo (which doesn't have anything to do with media
> files, by the way) and WMA. There may be packages out there
> to do all this already but if not you'll need to pull in a few disparate
> modules and mix'n'match.
>
> While ID3 readers (which determine the metadata for MP3) are reasonably
> common few of them come ready-compiled for Windows. I've used Ned
> Batchelder's id3reader [1] successfully for simple tasks so you might try
> that. On the WMA side, you can automate Windows Media Player to get
> metadata. (And it might work for .mp3; I've not tried).
>
> <code>
> import win32com.client
>
> player = win32com.client.gencache.EnsureDispatch ("WMPlayer.OCX")
> wmedia = player.mediaCollection.add (r"c:\temp\bells.mp3")
> try:
>   artist = wmedia.getItemInfo ("Artist")
> finally:
>   player.mediaCollection.remove (wmedia, False)
>
> print "bells.mp3 has artist", artist
>
> </code>
>
> You're going to have to dig around for docs on this one. And it's not
> pretty. Try starting from:
>
> http://msdn.microsoft.com/en-us/library/bb249009(VS.85).aspx
>
> TJG
>
> [1]http://nedbatchelder.com/code/modules/id3reader.html

Hmm, thanks for the info. Yes, I am using Winders (Vista to be exact)
and I just assumed that there must be a way to programmatically get
the stuff you get from choosing properties in the right click menu.
But I guess there isn't (hard to believe, because I can't see MS hard-
coding each and every file format's metadata into it's OS). I might
have to learn more about the command prompt ( I hear there is a module
for fiddling with it) and work from there.

Cheers for the links though, I will be checking them out :)



More information about the Python-list mailing list