diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-01-15 03:26:36 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-01-15 03:26:36 (GMT) |
commit | b90f89a496676ec714e111a747344600f3988496 (patch) | |
tree | 161c61762992b5c1588c9a49f557ad88b31b091f /Lib/toaiff.py | |
parent | 495ad3c8ccb9ed3554177a3e8687676c78e667de (diff) | |
download | cpython-b90f89a496676ec714e111a747344600f3988496.zip cpython-b90f89a496676ec714e111a747344600f3988496.tar.gz cpython-b90f89a496676ec714e111a747344600f3988496.tar.bz2 |
Whitespace normalization.
Diffstat (limited to 'Lib/toaiff.py')
-rw-r--r-- | Lib/toaiff.py | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/Lib/toaiff.py b/Lib/toaiff.py index 25be46f..96d4642 100644 --- a/Lib/toaiff.py +++ b/Lib/toaiff.py @@ -54,51 +54,51 @@ uncompress.append('uncompress', '--') class error(Exception): - pass + pass def toaiff(filename): - temps = [] - ret = None - try: - ret = _toaiff(filename, temps) - finally: - for temp in temps[:]: - if temp != ret: - try: - os.unlink(temp) - except os.error: - pass - temps.remove(temp) - return ret + temps = [] + ret = None + try: + ret = _toaiff(filename, temps) + finally: + for temp in temps[:]: + if temp != ret: + try: + os.unlink(temp) + except os.error: + pass + temps.remove(temp) + return ret def _toaiff(filename, temps): - if filename[-2:] == '.Z': - fname = tempfile.mktemp() - 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: - 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 = `msg` - raise error, filename + ': ' + msg - if ftype == 'aiff': - return fname - if ftype is None or not table.has_key(ftype): - raise error, \ - filename + ': unsupported audio file type ' + `ftype` - temp = tempfile.mktemp() - temps.append(temp) - sts = table[ftype].copy(fname, temp) - if sts: - raise error, filename + ': conversion to aiff failed' - return temp + if filename[-2:] == '.Z': + fname = tempfile.mktemp() + 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: + 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 = `msg` + raise error, filename + ': ' + msg + if ftype == 'aiff': + return fname + if ftype is None or not table.has_key(ftype): + raise error, \ + filename + ': unsupported audio file type ' + `ftype` + temp = tempfile.mktemp() + temps.append(temp) + sts = table[ftype].copy(fname, temp) + if sts: + raise error, filename + ': conversion to aiff failed' + return temp |