【问题标题】:Are there any BSD Libraries that will find the length of an mp3?是否有任何 BSD 库可以找到 mp3 的长度?
【发布时间】:2009-07-31 18:28:17
【问题描述】:

我想要任何 BSD 库,我更喜欢 python,但任何语言都很棒。

【问题讨论】:

  • 你的意思是以字节为单位的长度还是以时间单位(即秒)为单位的长度?
  • 如果你“更喜欢python”,为什么要指定“BSD”?

标签: mp3 bsd


【解决方案1】:

保证取决于主机配置的好问题(可以是自定义或 虚假描述),而提到的一种方法是使用 HTTP HEAD

#Call HTTP HEAD in Python
import httplib
conn=httplib.HTTPConnection("www.abc.com")
conn.request("HEAD", "/dir/file1.mp3")
res=conn.getresponse()
fileSize=res.getheader('content-length')
#or res.getheaders() for all headers
conn.close()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-20
    • 1970-01-01
    • 2011-01-03
    • 1970-01-01
    • 2019-06-29
    • 2023-03-31
    相关资源
    最近更新 更多