mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
parent
aad627f2f9
commit
4487dd0ed5
5 changed files with 39 additions and 5 deletions
|
@ -32,6 +32,11 @@ explicitly given directories.
|
|||
|
||||
__all__ = ['what', 'whathdr']
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
SndHeaders = namedtuple('SndHeaders',
|
||||
'filetype framerate nchannels nframes sampwidth')
|
||||
|
||||
def what(filename):
|
||||
"""Guess the type of a sound file."""
|
||||
res = whathdr(filename)
|
||||
|
@ -45,7 +50,7 @@ def whathdr(filename):
|
|||
for tf in tests:
|
||||
res = tf(h, f)
|
||||
if res:
|
||||
return res
|
||||
return SndHeaders(*res)
|
||||
return None
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue