Kalibr wrote:
On May 29, 7:55 pm, Tim Golden <[EMAIL PROTECTED]> 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.
Ah. You didn't quite say that. Well, the thing is that the stuff in
the right-click menu (I think this is the case) comes from several
different sources. Some of it's held in Alternate
Data Streams. Some is Structured Storage within the docs themselves.
Some is simply, eg, ID3 data held in an MP3 file etc. I don't
think it all comes from one place. Again, I think.
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.
If you come up with useful info, do post back here. It's an area several
people have enquired about.
TJG
--
http://mail.python.org/mailman/listinfo/python-list