本文整理匯總了Python中sndhdr.whathdr方法的典型用法代碼示例。如果您正苦於以下問題:Python sndhdr.whathdr方法的具體用法?Python sndhdr.whathdr怎麽用?Python sndhdr.whathdr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sndhdr
的用法示例。
在下文中一共展示了sndhdr.whathdr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _toaiff
# 需要導入模塊: import sndhdr [as 別名]
# 或者: from sndhdr import whathdr [as 別名]
def _toaiff(filename, temps):
if filename[-2:] == '.Z':
(fd, fname) = tempfile.mkstemp()
os.close(fd)
temps.append(fname)
sts = uncompress.copy(filename, fname)
if sts:
raise error, filename + ': uncompress failed'
else:
fname = filename
try:
ftype = sndhdr.whathdr(fname)
if ftype:
ftype = ftype[0] # All we're interested in
except IOError, msg:
if type(msg) == type(()) and len(msg) == 2 and \
type(msg[0]) == type(0) and type(msg[1]) == type(''):
msg = msg[1]
if type(msg) != type(''):
msg = repr(msg)
raise error, filename + ': ' + msg