查找文件详细信息...... [英] Finding file details...

查看:53
本文介绍了查找文件详细信息......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想弄清楚如何找到文件的详细信息

(特别是现在的音乐)我正在制作一个小小的排序脚本,

我的目的是获取有关mp3和

wma文件的艺术家,专辑和流派的详细信息(将来可能更多)。我最接近的比赛是当我在PyMedia上遇到
时,但它只支持2.4(我有2.5)。

现在我在GetFileVersionInfo上看到了一点,但是似乎没有帮助(大部分都是我的头脑)。是否有任何模块我可以使用
来查找这类数据?我正试图不把它专门用于音乐中的b $ b,因为我可能希望将其扩展到图片,电影,文本

等文件中。我有什么想法可以解决这个问题吗?

I''ve been trying to figure out how to find the details of files
(specifically music for now) for a little sorting script I''m making,
My aim is to get details on the artist, album, and genre for mp3 and
wma files (possibly more in the future). My closest match was when I
stumbled accross PyMedia, but it only supports up to 2.4 (I have 2.5).
Now I see a bit mentioned on GetFileVersionInfo, but that doesn''t seem
to help (and most of it went over my head). Is there any module I can
use to find this sort of data? I''m trying to not make it specialised
in music, because I may want to extend this to picture, movie, text
etc. files in the future. Any ideas how I could go about this?

推荐答案

Kalibr写道:
Kalibr wrote:

I我一直试图弄清楚如何找到文件的详细信息

(特别是现在的音乐)我正在制作一个小的排序脚本,

我的目标是获取有关mp3和

wma文件的艺术家,专辑和流派的详细信息(将来可能更多)。我最接近的比赛是当我在PyMedia上遇到
时,但它只支持2.4(我有2.5)。

现在我在GetFileVersionInfo上看到了一点,但是似乎没有帮助(大部分都是我的头脑)。是否有任何模块我可以使用
来查找这类数据?我正试图不把它专门用于音乐中的b $ b,因为我可能希望将其扩展到图片,电影,文本

等文件中。我有什么想法可以解决这个问题吗?
I''ve been trying to figure out how to find the details of files
(specifically music for now) for a little sorting script I''m making,
My aim is to get details on the artist, album, and genre for mp3 and
wma files (possibly more in the future). My closest match was when I
stumbled accross PyMedia, but it only supports up to 2.4 (I have 2.5).
Now I see a bit mentioned on GetFileVersionInfo, but that doesn''t seem
to help (and most of it went over my head). Is there any module I can
use to find this sort of data? I''m trying to not make it specialised
in music, because I may want to extend this to picture, movie, text
etc. files in the future. Any ideas how I could go about this?



你不能说,但我认为你是在Windows上,因为你提到了

GetFileVersionInfo(这不是与媒体有什么关系

文件,顺便说一下)和WMA。那里可能有包裹

已经完成所有这些但是如果没有你需要提供一些不同的

模块和mix''n''match 。


虽然ID3阅读器(确定MP3的元数据)是合理的,但是很少有人为Windows准备好了。我已经成功地使用了Ned

Batchelder'的id3reader [1]来完成简单的任务,所以你可以试试

。在WMA方面,您可以自动化Windows Media Player以获取

元数据。 (它可能适用于.mp3;我没试过)。


< code>

import win32com.client


player = win32com.client.gencache.EnsureDispatch(" WMPlayer.OCX")

wmedia = player.mediaCollection.add(r" c:\ temp \ bells .mp3")

试试:

artist = wmedia.getItemInfo(" Artist")

finally:

player.mediaCollection.remove(wmedia,False)


print" bells.mp3 has artist",艺术家



你将不得不在这个问题上挖掘文档。并且它不是很好的b $ b。尝试从以下开始:

http://msdn.microsoft.com/en-us/libr...09(VS.85).aspx


TJG


[1] http://nedbatchelder.com /code/modules/id3reader.html


5月29日晚上7:55,Tim Golden< m ... @ timgolden.me.ukwrote :
On May 29, 7:55 pm, Tim Golden <m...@timgolden.me.ukwrote:

>

你不能说,但是我认为你提到了Windows,因为你提到了

GetFileVersionInfo(顺便说一句,这与媒体

文件没有任何关系)和WMA。那里可能有包裹

已经完成所有这些但是如果没有你需要提供一些不同的

模块和mix''n''match 。


虽然ID3阅读器(确定MP3的元数据)是合理的,但是很少有人为Windows准备好了。我已经成功地使用了Ned

Batchelder'的id3reader [1]来完成简单的任务,所以你可以试试

。在WMA方面,您可以自动化Windows Media Player以获取

元数据。 (它可能适用于.mp3;我没试过)。


< code>

import win32com.client


player = win32com.client.gencache.EnsureDispatch(" WMPlayer.OCX")

wmedia = player.mediaCollection.add(r" c:\ temp \ bells .mp3")

试试:

artist = wmedia.getItemInfo(" Artist")

finally:

player.mediaCollection.remove(wmedia,False)


print" bells.mp3 has artist",艺术家



你将不得不在这个问题上挖掘文档。并且它不是很好的b $ b。尝试从以下开始:

http://msdn.microsoft.com/en-us/libr...09(VS.85).aspx


TJG


[1] http://nedbatchelder.com/code/modules/id3reader.html
>
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/libr...09(VS.85).aspx

TJG

[1]http://nedbatchelder.com/code/modules/id3reader.html



嗯,谢谢你的信息。是的,我正在使用Winders(确切地说是Vista)

我只是假设必须有一种方法可以通过编程方式获得

从选择属性中获得的东西右键单击菜单。

但我猜不会(很难相信,因为我看不到MS很难 -

编码每种文件格式'将元数据放入其操作系统中。我可能

必须了解更多有关命令提示符的信息(我听说有一个模块

用于摆弄它)并从那里开始工作。

为这些链接干杯,我会检查它们:)

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 :)


Kalibr写道:
Kalibr wrote:

5月29日下午7:55,Tim Golden< m ... @ timgolden.me.ukwrote:
On May 29, 7:55 pm, Tim Golden <m...@timgolden.me.ukwrote:

>你不要说,但我认为你在Windows上,因为你提到了GetFileVersionInfo(顺便说一下,它与媒体
文件没有任何关系)和WMA。那里可能有包裹来完成所有这些,但如果没有,你需要提供一些不同的模块并混合''''匹配。
虽然ID3阅读器(确定MP3的元数据)是合理的,但很少有人为Windows准备编译。我已经成功地使用了Ned
Batchelder的id3reader [1]来完成简单的任务,所以你可以试试那个。在WMA方面,您可以自动化Windows Media Player以获取元数据。 (它可能适用于.mp3;我没试过)。

< code>
导入win32com.client

player = win32com.client .gencache.EnsureDispatch(" WMPlayer.OCX")
wmedia = player.mediaCollection.add(r" c:\ temp \ bells.mp3")
尝试:
artist = wmedia.getItemInfo(" Artist")
最后:
player.mediaCollection.remove(wmedia,False)

print" bells.mp3 has artist",artist

< / code>

你将不得不在这个问题上挖掘文档。而且它不是很漂亮。尝试从以下开始:

http://msdn.microsoft.com/en-us/libr...09(VS.85).aspx

TJG

[1] http://nedbatchelder.com/code/modules/id3reader.html
>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/libr...09(VS.85).aspx

TJG

[1]http://nedbatchelder.com/code/modules/id3reader.html



嗯,谢谢你的信息。是的,我正在使用Winders(确切地说是Vista)

我只是假设必须有一种方法可以通过编程方式获得

从选择属性中获得的东西右键菜单。


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.



啊。你不是那么说的。好吧,问题是

中的东西右键菜单(我认为就是这种情况)来自几个不同来源的b
。其中一些是在Alternate

Data Streams中进行的。有些是文档本身内的结构化存储。

有些是简单的,例如,MP3文件中保存的ID3数据等等。我不认为
认为这一切都来自于一个地方。再一次,我想。

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.


但我猜不会(很难相信,因为我看不到MS很难 -

将每个文件格式的元数据编码到它的操作系统中。我可能

必须要了解更多关于命令提示符的信息(我听说有一个模块

用于摆弄它)并从那里开始工作。
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.



如果您想出有用的信息,请在此处回复。这是一个人们询问过的几个地方。


TJG

If you come up with useful info, do post back here. It''s an area several
people have enquired about.

TJG


这篇关于查找文件详细信息......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆