Message109752
On Jul 8, 2010, at 6:52 PM, Mark Lawrence wrote:
>
> Mark Lawrence <breamoreboy@yahoo.co.uk> added the comment:
>
> Robert, could you provide a patch for this?
>
> ----------
> nosy: +BreamoreBoy
> stage: -> needs patch
> versions: +Python 3.2
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue5024>
> _______________________________________
Okay, I'm not sure exactly how I'm supposed to go about this. Here's
the output from diff <new file> <original file> for sndhdr.py
131d130
< import wave
135,141c134,138
< f.seek(0)
< try:
< w = wave.openfp(f, 'r')
< except (EOFError, wave.Error):
< return None
< return ('wav', w.getframerate(), w.getnchannels(), \
< w.getnframes(), 8*w.getsampwidth())
---
> style = get_short_le(h[20:22])
> nchannels = get_short_le(h[22:24])
> rate = get_long_le(h[24:28])
> sample_bits = get_short_le(h[34:36])
> return 'wav', rate, nchannels, -1, sample_bits
$
All I did was use test_aifc() as inspiration, so the patched sndhdr.py
calls wave.py to get the file parameters.
Here's the new test_wav() in its entirety:
--------------------------------
def test_wav(h, f):
import wave
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
if h[:4] != 'RIFF' or h[8:12] != 'WAVE' or h[12:16] != 'fmt ':
return None
f.seek(0)
try:
w = wave.openfp(f, 'r')
except (EOFError, wave.Error):
return None
return ('wav', w.getframerate(), w.getnchannels(), \
w.getnframes(), 8*w.getsampwidth())
--------------------------------
If you want anything else, please ask.
Bob Pyle |
|
Date |
User |
Action |
Args |
2010-07-09 15:27:44 | rpyle | set | recipients:
+ rpyle, BreamoreBoy |
2010-07-09 15:27:42 | rpyle | link | issue5024 messages |
2010-07-09 15:27:42 | rpyle | create | |
|