summaryrefslogtreecommitdiffstats
path: root/Lib/sndhdr.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-10-09 20:59:30 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-10-09 20:59:30 (GMT)
commit4487dd0ed5482d619279aa45099a22d0abc9615d (patch)
tree9e0919a9825e4a064ecd54209ec51bea3d49cbd9 /Lib/sndhdr.py
parentaad627f2f94c426fab6d8341ffd60ca36cc005b7 (diff)
downloadcpython-4487dd0ed5482d619279aa45099a22d0abc9615d.zip
cpython-4487dd0ed5482d619279aa45099a22d0abc9615d.tar.gz
cpython-4487dd0ed5482d619279aa45099a22d0abc9615d.tar.bz2
#18615: Make sndhdr return namedtuples.
Patch by Claudiu Popa.
Diffstat (limited to 'Lib/sndhdr.py')
-rw-r--r--Lib/sndhdr.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/sndhdr.py b/Lib/sndhdr.py
index 240e507..e5901ec 100644
--- a/Lib/sndhdr.py
+++ b/Lib/sndhdr.py
@@ -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