golden hour
/usr/lib64/python2.7
⬆️ Go Up
Upload
File/Folder
Size
Actions
BaseHTTPServer.py
21.93 KB
Del
OK
BaseHTTPServer.pyc
21.18 KB
Del
OK
BaseHTTPServer.pyo
21.18 KB
Del
OK
Bastion.py
5.61 KB
Del
OK
Bastion.pyc
6.5 KB
Del
OK
Bastion.pyo
6.5 KB
Del
OK
CGIHTTPServer.py
12.84 KB
Del
OK
CGIHTTPServer.pyc
10.84 KB
Del
OK
CGIHTTPServer.pyo
10.84 KB
Del
OK
ConfigParser.py
27.1 KB
Del
OK
ConfigParser.pyc
24.62 KB
Del
OK
ConfigParser.pyo
24.62 KB
Del
OK
Cookie.py
24.66 KB
Del
OK
Cookie.pyc
21.64 KB
Del
OK
Cookie.pyo
21.64 KB
Del
OK
Demo
-
Del
OK
Doc
-
Del
OK
DocXMLRPCServer.py
10.52 KB
Del
OK
DocXMLRPCServer.pyc
9.96 KB
Del
OK
DocXMLRPCServer.pyo
9.85 KB
Del
OK
HTMLParser.py
16.58 KB
Del
OK
HTMLParser.pyc
13.39 KB
Del
OK
HTMLParser.pyo
13.1 KB
Del
OK
MimeWriter.py
6.33 KB
Del
OK
MimeWriter.pyc
7.19 KB
Del
OK
MimeWriter.pyo
7.19 KB
Del
OK
Queue.py
8.36 KB
Del
OK
Queue.pyc
9.19 KB
Del
OK
Queue.pyo
9.19 KB
Del
OK
SimpleHTTPServer.py
7.25 KB
Del
OK
SimpleHTTPServer.pyc
7.55 KB
Del
OK
SimpleHTTPServer.pyo
7.55 KB
Del
OK
SimpleXMLRPCServer.py
25.17 KB
Del
OK
SimpleXMLRPCServer.pyc
22.31 KB
Del
OK
SimpleXMLRPCServer.pyo
22.31 KB
Del
OK
SocketServer.py
23.29 KB
Del
OK
SocketServer.pyc
23.49 KB
Del
OK
SocketServer.pyo
23.49 KB
Del
OK
StringIO.py
10.41 KB
Del
OK
StringIO.pyc
11.21 KB
Del
OK
StringIO.pyo
11.21 KB
Del
OK
Tools
-
Del
OK
UserDict.py
5.67 KB
Del
OK
UserDict.pyc
8.61 KB
Del
OK
UserDict.pyo
8.61 KB
Del
OK
UserList.py
3.56 KB
Del
OK
UserList.pyc
6.42 KB
Del
OK
UserList.pyo
6.42 KB
Del
OK
UserString.py
9.46 KB
Del
OK
UserString.pyc
14.52 KB
Del
OK
UserString.pyo
14.52 KB
Del
OK
_LWPCookieJar.py
6.4 KB
Del
OK
_LWPCookieJar.pyc
5.4 KB
Del
OK
_LWPCookieJar.pyo
5.4 KB
Del
OK
_MozillaCookieJar.py
5.67 KB
Del
OK
_MozillaCookieJar.pyc
4.37 KB
Del
OK
_MozillaCookieJar.pyo
4.33 KB
Del
OK
__future__.py
4.28 KB
Del
OK
__future__.pyc
4.13 KB
Del
OK
__future__.pyo
4.13 KB
Del
OK
__phello__.foo.py
64 B
Del
OK
__phello__.foo.pyc
125 B
Del
OK
__phello__.foo.pyo
125 B
Del
OK
_abcoll.py
17.45 KB
Del
OK
_abcoll.pyc
24.4 KB
Del
OK
_abcoll.pyo
24.4 KB
Del
OK
_osx_support.py
18.03 KB
Del
OK
_osx_support.pyc
11.28 KB
Del
OK
_osx_support.pyo
11.28 KB
Del
OK
_pyio.py
67.24 KB
Del
OK
_pyio.pyc
62.71 KB
Del
OK
_pyio.pyo
62.71 KB
Del
OK
_strptime.py
19.75 KB
Del
OK
_strptime.pyc
14.53 KB
Del
OK
_strptime.pyo
14.53 KB
Del
OK
_sysconfigdata.py
17.56 KB
Del
OK
_sysconfigdata.pyc
20.72 KB
Del
OK
_sysconfigdata.pyo
20.72 KB
Del
OK
_threading_local.py
7.28 KB
Del
OK
_threading_local.pyc
6.45 KB
Del
OK
_threading_local.pyo
6.45 KB
Del
OK
_weakrefset.py
5.48 KB
Del
OK
_weakrefset.pyc
9.25 KB
Del
OK
_weakrefset.pyo
9.25 KB
Del
OK
abc.py
6.98 KB
Del
OK
abc.pyc
6 KB
Del
OK
abc.pyo
5.94 KB
Del
OK
aifc.py
32.94 KB
Del
OK
aifc.pyc
29.31 KB
Del
OK
aifc.pyo
29.31 KB
Del
OK
antigravity.py
60 B
Del
OK
antigravity.pyc
203 B
Del
OK
antigravity.pyo
203 B
Del
OK
anydbm.py
2.6 KB
Del
OK
anydbm.pyc
2.73 KB
Del
OK
anydbm.pyo
2.73 KB
Del
OK
argparse.py
86.46 KB
Del
OK
argparse.pyc
62.57 KB
Del
OK
argparse.pyo
62.41 KB
Del
OK
ast.py
11.53 KB
Del
OK
ast.pyc
12.65 KB
Del
OK
ast.pyo
12.65 KB
Del
OK
asynchat.py
11.13 KB
Del
OK
asynchat.pyc
8.44 KB
Del
OK
asynchat.pyo
8.44 KB
Del
OK
asyncore.py
20.36 KB
Del
OK
asyncore.pyc
18.4 KB
Del
OK
asyncore.pyo
18.4 KB
Del
OK
atexit.py
1.67 KB
Del
OK
atexit.pyc
2.15 KB
Del
OK
atexit.pyo
2.15 KB
Del
OK
audiodev.py
7.42 KB
Del
OK
audiodev.pyc
8.27 KB
Del
OK
audiodev.pyo
8.27 KB
Del
OK
base64.py
11.09 KB
Del
OK
base64.pyc
10.63 KB
Del
OK
base64.pyo
10.63 KB
Del
OK
bdb.py
21.21 KB
Del
OK
bdb.pyc
18.65 KB
Del
OK
bdb.pyo
18.65 KB
Del
OK
binhex.py
14.14 KB
Del
OK
binhex.pyc
15.04 KB
Del
OK
binhex.pyo
15.04 KB
Del
OK
bisect.py
2.53 KB
Del
OK
bisect.pyc
3 KB
Del
OK
bisect.pyo
3 KB
Del
OK
bsddb
-
Del
OK
cProfile.py
6.43 KB
Del
OK
cProfile.pyc
6.25 KB
Del
OK
cProfile.pyo
6.25 KB
Del
OK
calendar.py
22.76 KB
Del
OK
calendar.pyc
27.13 KB
Del
OK
calendar.pyo
27.13 KB
Del
OK
cgi.py
34.31 KB
Del
OK
cgi.pyc
31.99 KB
Del
OK
cgi.pyo
31.99 KB
Del
OK
cgitb.py
11.89 KB
Del
OK
cgitb.pyc
11.9 KB
Del
OK
cgitb.pyo
11.9 KB
Del
OK
chunk.py
5.25 KB
Del
OK
chunk.pyc
5.46 KB
Del
OK
chunk.pyo
5.46 KB
Del
OK
cmd.py
14.67 KB
Del
OK
cmd.pyc
13.71 KB
Del
OK
cmd.pyo
13.71 KB
Del
OK
code.py
9.95 KB
Del
OK
code.pyc
10.09 KB
Del
OK
code.pyo
10.09 KB
Del
OK
codecs.py
34.44 KB
Del
OK
codecs.pyc
35.74 KB
Del
OK
codecs.pyo
35.74 KB
Del
OK
codeop.py
5.86 KB
Del
OK
codeop.pyc
6.44 KB
Del
OK
codeop.pyo
6.44 KB
Del
OK
collections.py
25.28 KB
Del
OK
collections.pyc
23.99 KB
Del
OK
collections.pyo
23.94 KB
Del
OK
colorsys.py
3.6 KB
Del
OK
colorsys.pyc
3.9 KB
Del
OK
colorsys.pyo
3.9 KB
Del
OK
commands.py
2.49 KB
Del
OK
commands.pyc
2.41 KB
Del
OK
commands.pyo
2.41 KB
Del
OK
compileall.py
7.58 KB
Del
OK
compileall.pyc
6.85 KB
Del
OK
compileall.pyo
6.85 KB
Del
OK
compiler
-
Del
OK
config
-
Del
OK
contextlib.py
4.32 KB
Del
OK
contextlib.pyc
4.35 KB
Del
OK
contextlib.pyo
4.35 KB
Del
OK
cookielib.py
63.21 KB
Del
OK
cookielib.pyc
53.55 KB
Del
OK
cookielib.pyo
53.37 KB
Del
OK
copy.py
11.25 KB
Del
OK
copy.pyc
11.91 KB
Del
OK
copy.pyo
11.82 KB
Del
OK
copy_reg.py
6.64 KB
Del
OK
copy_reg.pyc
4.99 KB
Del
OK
copy_reg.pyo
4.95 KB
Del
OK
crypt.py
2.24 KB
Del
OK
crypt.pyc
2.89 KB
Del
OK
crypt.pyo
2.89 KB
Del
OK
csv.py
15.96 KB
Del
OK
csv.pyc
13.14 KB
Del
OK
csv.pyo
13.14 KB
Del
OK
ctypes
-
Del
OK
curses
-
Del
OK
dbhash.py
498 B
Del
OK
dbhash.pyc
718 B
Del
OK
dbhash.pyo
718 B
Del
OK
decimal.py
215.84 KB
Del
OK
decimal.pyc
167.33 KB
Del
OK
decimal.pyo
167.33 KB
Del
OK
difflib.py
80.42 KB
Del
OK
difflib.pyc
60.5 KB
Del
OK
difflib.pyo
60.45 KB
Del
OK
dircache.py
1.1 KB
Del
OK
dircache.pyc
1.54 KB
Del
OK
dircache.pyo
1.54 KB
Del
OK
dis.py
6.35 KB
Del
OK
dis.pyc
6.08 KB
Del
OK
dis.pyo
6.08 KB
Del
OK
distutils
-
Del
OK
doctest.py
102.01 KB
Del
OK
doctest.pyc
81.45 KB
Del
OK
doctest.pyo
81.17 KB
Del
OK
dumbdbm.py
8.61 KB
Del
OK
dumbdbm.pyc
6.41 KB
Del
OK
dumbdbm.pyo
6.41 KB
Del
OK
dummy_thread.py
4.31 KB
Del
OK
dummy_thread.pyc
5.27 KB
Del
OK
dummy_thread.pyo
5.27 KB
Del
OK
dummy_threading.py
2.74 KB
Del
OK
dummy_threading.pyc
1.25 KB
Del
OK
dummy_threading.pyo
1.25 KB
Del
OK
email
-
Del
OK
encodings
-
Del
OK
filecmp.py
9.36 KB
Del
OK
filecmp.pyc
9.4 KB
Del
OK
filecmp.pyo
9.4 KB
Del
OK
fileinput.py
13.81 KB
Del
OK
fileinput.pyc
14.48 KB
Del
OK
fileinput.pyo
14.48 KB
Del
OK
fnmatch.py
3.16 KB
Del
OK
fnmatch.pyc
3.45 KB
Del
OK
fnmatch.pyo
3.45 KB
Del
OK
formatter.py
14.56 KB
Del
OK
formatter.pyc
18.73 KB
Del
OK
formatter.pyo
18.73 KB
Del
OK
fpformat.py
4.59 KB
Del
OK
fpformat.pyc
4.56 KB
Del
OK
fpformat.pyo
4.56 KB
Del
OK
fractions.py
21.87 KB
Del
OK
fractions.pyc
19.27 KB
Del
OK
fractions.pyo
19.27 KB
Del
OK
ftplib.py
36.1 KB
Del
OK
ftplib.pyc
33.38 KB
Del
OK
ftplib.pyo
33.38 KB
Del
OK
functools.py
4.37 KB
Del
OK
functools.pyc
5.95 KB
Del
OK
functools.pyo
5.95 KB
Del
OK
genericpath.py
2.94 KB
Del
OK
genericpath.pyc
3.19 KB
Del
OK
genericpath.pyo
3.19 KB
Del
OK
getopt.py
7.15 KB
Del
OK
getopt.pyc
6.5 KB
Del
OK
getopt.pyo
6.45 KB
Del
OK
getpass.py
5.43 KB
Del
OK
getpass.pyc
4.63 KB
Del
OK
getpass.pyo
4.63 KB
Del
OK
gettext.py
19.47 KB
Del
OK
gettext.pyc
15.19 KB
Del
OK
gettext.pyo
15.19 KB
Del
OK
glob.py
2.86 KB
Del
OK
glob.pyc
2.83 KB
Del
OK
glob.pyo
2.83 KB
Del
OK
gzip.py
18.26 KB
Del
OK
gzip.pyc
14.72 KB
Del
OK
gzip.pyo
14.72 KB
Del
OK
hashlib.py
7.48 KB
Del
OK
hashlib.pyc
6.74 KB
Del
OK
hashlib.pyo
6.74 KB
Del
OK
heapq.py
17.76 KB
Del
OK
heapq.pyc
14.13 KB
Del
OK
heapq.pyo
14.13 KB
Del
OK
hmac.py
4.48 KB
Del
OK
hmac.pyc
4.44 KB
Del
OK
hmac.pyo
4.44 KB
Del
OK
hotshot
-
Del
OK
htmlentitydefs.py
17.63 KB
Del
OK
htmlentitydefs.pyc
6.22 KB
Del
OK
htmlentitydefs.pyo
6.22 KB
Del
OK
htmllib.py
12.57 KB
Del
OK
htmllib.pyc
19.83 KB
Del
OK
htmllib.pyo
19.83 KB
Del
OK
httplib.py
51.37 KB
Del
OK
httplib.pyc
37.54 KB
Del
OK
httplib.pyo
37.37 KB
Del
OK
idlelib
-
Del
OK
ihooks.py
18.54 KB
Del
OK
ihooks.pyc
20.87 KB
Del
OK
ihooks.pyo
20.87 KB
Del
OK
imaplib.py
47.34 KB
Del
OK
imaplib.pyc
44.45 KB
Del
OK
imaplib.pyo
41.8 KB
Del
OK
imghdr.py
3.46 KB
Del
OK
imghdr.pyc
4.73 KB
Del
OK
imghdr.pyo
4.73 KB
Del
OK
importlib
-
Del
OK
imputil.py
25.16 KB
Del
OK
imputil.pyc
15.26 KB
Del
OK
imputil.pyo
15.08 KB
Del
OK
inspect.py
41.47 KB
Del
OK
inspect.pyc
39.04 KB
Del
OK
inspect.pyo
39.04 KB
Del
OK
io.py
3.12 KB
Del
OK
io.pyc
3.4 KB
Del
OK
io.pyo
3.4 KB
Del
OK
json
-
Del
OK
keyword.py
1.95 KB
Del
OK
keyword.pyc
2.06 KB
Del
OK
keyword.pyo
2.06 KB
Del
OK
lib-dynload
-
Del
OK
lib-tk
-
Del
OK
lib2to3
-
Del
OK
linecache.py
3.87 KB
Del
OK
linecache.pyc
3.14 KB
Del
OK
linecache.pyo
3.14 KB
Del
OK
locale.py
87.33 KB
Del
OK
locale.pyc
48.77 KB
Del
OK
locale.pyo
48.77 KB
Del
OK
logging
-
Del
OK
macpath.py
6.11 KB
Del
OK
macpath.pyc
7.47 KB
Del
OK
macpath.pyo
7.47 KB
Del
OK
macurl2path.py
3.2 KB
Del
OK
macurl2path.pyc
2.71 KB
Del
OK
macurl2path.pyo
2.71 KB
Del
OK
mailbox.py
78.86 KB
Del
OK
mailbox.pyc
74.87 KB
Del
OK
mailbox.pyo
74.82 KB
Del
OK
mailcap.py
8.2 KB
Del
OK
mailcap.pyc
7.77 KB
Del
OK
mailcap.pyo
7.77 KB
Del
OK
markupbase.py
14.3 KB
Del
OK
markupbase.pyc
9.08 KB
Del
OK
markupbase.pyo
8.89 KB
Del
OK
md5.py
358 B
Del
OK
md5.pyc
378 B
Del
OK
md5.pyo
378 B
Del
OK
mhlib.py
32.65 KB
Del
OK
mhlib.pyc
33.01 KB
Del
OK
mhlib.pyo
33.01 KB
Del
OK
mimetools.py
7 KB
Del
OK
mimetools.pyc
8.03 KB
Del
OK
mimetools.pyo
8.03 KB
Del
OK
mimetypes.py
20.22 KB
Del
OK
mimetypes.pyc
17.86 KB
Del
OK
mimetypes.pyo
17.86 KB
Del
OK
mimify.py
14.67 KB
Del
OK
mimify.pyc
11.71 KB
Del
OK
mimify.pyo
11.71 KB
Del
OK
modulefinder.py
23.71 KB
Del
OK
modulefinder.pyc
18.27 KB
Del
OK
modulefinder.pyo
18.19 KB
Del
OK
multifile.py
4.71 KB
Del
OK
multifile.pyc
5.29 KB
Del
OK
multifile.pyo
5.25 KB
Del
OK
multiprocessing
-
Del
OK
mutex.py
1.83 KB
Del
OK
mutex.pyc
2.46 KB
Del
OK
mutex.pyo
2.46 KB
Del
OK
netrc.py
4.47 KB
Del
OK
netrc.pyc
3.83 KB
Del
OK
netrc.pyo
3.83 KB
Del
OK
new.py
610 B
Del
OK
new.pyc
862 B
Del
OK
new.pyo
862 B
Del
OK
nntplib.py
20.97 KB
Del
OK
nntplib.pyc
20.55 KB
Del
OK
nntplib.pyo
20.55 KB
Del
OK
ntpath.py
18.02 KB
Del
OK
ntpath.pyc
11.6 KB
Del
OK
ntpath.pyo
11.56 KB
Del
OK
nturl2path.py
2.32 KB
Del
OK
nturl2path.pyc
1.77 KB
Del
OK
nturl2path.pyo
1.77 KB
Del
OK
numbers.py
10.08 KB
Del
OK
numbers.pyc
13.68 KB
Del
OK
numbers.pyo
13.68 KB
Del
OK
opcode.py
5.35 KB
Del
OK
opcode.pyc
6 KB
Del
OK
opcode.pyo
6 KB
Del
OK
optparse.py
59.69 KB
Del
OK
optparse.pyc
52.78 KB
Del
OK
optparse.pyo
52.7 KB
Del
OK
os.py
25.17 KB
Del
OK
os.pyc
24.96 KB
Del
OK
os.pyo
24.96 KB
Del
OK
os2emxpath.py
4.5 KB
Del
OK
os2emxpath.pyc
4.39 KB
Del
OK
os2emxpath.pyo
4.39 KB
Del
OK
pdb.doc
7.73 KB
Del
OK
pdb.py
44.94 KB
Del
OK
pdb.pyc
42.59 KB
Del
OK
pdb.pyo
42.59 KB
Del
OK
pickle.py
44.09 KB
Del
OK
pickle.pyc
37.56 KB
Del
OK
pickle.pyo
37.37 KB
Del
OK
pickletools.py
72.79 KB
Del
OK
pickletools.pyc
55.77 KB
Del
OK
pickletools.pyo
54.95 KB
Del
OK
pipes.py
9.36 KB
Del
OK
pipes.pyc
9.09 KB
Del
OK
pipes.pyo
9.09 KB
Del
OK
pkgutil.py
19.87 KB
Del
OK
pkgutil.pyc
18.49 KB
Del
OK
pkgutil.pyo
18.49 KB
Del
OK
plat-linux2
-
Del
OK
platform.py
51.98 KB
Del
OK
platform.pyc
36.06 KB
Del
OK
platform.pyo
36.06 KB
Del
OK
plistlib.py
15.44 KB
Del
OK
plistlib.pyc
19.52 KB
Del
OK
plistlib.pyo
19.44 KB
Del
OK
popen2.py
8.22 KB
Del
OK
popen2.pyc
8.81 KB
Del
OK
popen2.pyo
8.77 KB
Del
OK
poplib.py
12.64 KB
Del
OK
poplib.pyc
13.16 KB
Del
OK
poplib.pyo
13.16 KB
Del
OK
posixfile.py
7.82 KB
Del
OK
posixfile.pyc
7.47 KB
Del
OK
posixfile.pyo
7.47 KB
Del
OK
posixpath.py
13.27 KB
Del
OK
posixpath.pyc
11.03 KB
Del
OK
posixpath.pyo
11.03 KB
Del
OK
pprint.py
11.73 KB
Del
OK
pprint.pyc
10.06 KB
Del
OK
pprint.pyo
9.89 KB
Del
OK
profile.py
22.25 KB
Del
OK
profile.pyc
16.07 KB
Del
OK
profile.pyo
15.83 KB
Del
OK
pstats.py
26.08 KB
Del
OK
pstats.pyc
24.43 KB
Del
OK
pstats.pyo
24.43 KB
Del
OK
pty.py
4.94 KB
Del
OK
pty.pyc
4.85 KB
Del
OK
pty.pyo
4.85 KB
Del
OK
py_compile.py
5.79 KB
Del
OK
py_compile.pyc
6.27 KB
Del
OK
py_compile.pyo
6.27 KB
Del
OK
pyclbr.py
13.07 KB
Del
OK
pyclbr.pyc
9.42 KB
Del
OK
pyclbr.pyo
9.42 KB
Del
OK
pydoc.py
91.12 KB
Del
OK
pydoc.pyc
88.35 KB
Del
OK
pydoc.pyo
88.29 KB
Del
OK
pydoc_data
-
Del
OK
quopri.py
6.81 KB
Del
OK
quopri.pyc
6.42 KB
Del
OK
quopri.pyo
6.42 KB
Del
OK
random.py
31.45 KB
Del
OK
random.pyc
24.99 KB
Del
OK
random.pyo
24.99 KB
Del
OK
re.py
12.66 KB
Del
OK
re.pyc
12.79 KB
Del
OK
re.pyo
12.79 KB
Del
OK
repr.py
4.2 KB
Del
OK
repr.pyc
5.26 KB
Del
OK
repr.pyo
5.26 KB
Del
OK
rexec.py
19.68 KB
Del
OK
rexec.pyc
23.58 KB
Del
OK
rexec.pyo
23.58 KB
Del
OK
rfc822.py
32.51 KB
Del
OK
rfc822.pyc
31.05 KB
Del
OK
rfc822.pyo
31.05 KB
Del
OK
rlcompleter.py
5.68 KB
Del
OK
rlcompleter.pyc
5.84 KB
Del
OK
rlcompleter.pyo
5.84 KB
Del
OK
robotparser.py
7.03 KB
Del
OK
robotparser.pyc
7.7 KB
Del
OK
robotparser.pyo
7.7 KB
Del
OK
runpy.py
10.45 KB
Del
OK
runpy.pyc
8.21 KB
Del
OK
runpy.pyo
8.21 KB
Del
OK
sched.py
4.97 KB
Del
OK
sched.pyc
4.88 KB
Del
OK
sched.pyo
4.88 KB
Del
OK
sets.py
18.6 KB
Del
OK
sets.pyc
16.5 KB
Del
OK
sets.pyo
16.5 KB
Del
OK
sgmllib.py
17.46 KB
Del
OK
sgmllib.pyc
15.07 KB
Del
OK
sgmllib.pyo
15.07 KB
Del
OK
sha.py
393 B
Del
OK
sha.pyc
421 B
Del
OK
sha.pyo
421 B
Del
OK
shelve.py
7.89 KB
Del
OK
shelve.pyc
10.03 KB
Del
OK
shelve.pyo
10.03 KB
Del
OK
shlex.py
10.88 KB
Del
OK
shlex.pyc
7.37 KB
Del
OK
shlex.pyo
7.37 KB
Del
OK
shutil.py
18.46 KB
Del
OK
shutil.pyc
18.1 KB
Del
OK
shutil.pyo
18.1 KB
Del
OK
site-packages
-
Del
OK
site.py
19.61 KB
Del
OK
site.pyc
19.11 KB
Del
OK
site.pyo
19.11 KB
Del
OK
smtpd.py
18.11 KB
Del
OK
smtpd.pyc
15.52 KB
Del
OK
smtpd.pyo
15.52 KB
Del
OK
smtplib.py
30.9 KB
Del
OK
smtplib.pyc
29.29 KB
Del
OK
smtplib.pyo
29.29 KB
Del
OK
sndhdr.py
5.83 KB
Del
OK
sndhdr.pyc
7.18 KB
Del
OK
sndhdr.pyo
7.18 KB
Del
OK
socket.py
20.03 KB
Del
OK
socket.pyc
15.73 KB
Del
OK
socket.pyo
15.64 KB
Del
OK
sqlite3
-
Del
OK
sre.py
384 B
Del
OK
sre.pyc
519 B
Del
OK
sre.pyo
519 B
Del
OK
sre_compile.py
15.99 KB
Del
OK
sre_compile.pyc
10.76 KB
Del
OK
sre_compile.pyo
10.65 KB
Del
OK
sre_constants.py
6.95 KB
Del
OK
sre_constants.pyc
5.97 KB
Del
OK
sre_constants.pyo
5.97 KB
Del
OK
sre_parse.py
26.84 KB
Del
OK
sre_parse.pyc
18.98 KB
Del
OK
sre_parse.pyo
18.98 KB
Del
OK
ssl.py
38.7 KB
Del
OK
ssl.pyc
32.05 KB
Del
OK
ssl.pyo
32.05 KB
Del
OK
stat.py
1.8 KB
Del
OK
stat.pyc
2.69 KB
Del
OK
stat.pyo
2.69 KB
Del
OK
statvfs.py
898 B
Del
OK
statvfs.pyc
620 B
Del
OK
statvfs.pyo
620 B
Del
OK
string.py
20.27 KB
Del
OK
string.pyc
19.54 KB
Del
OK
string.pyo
19.54 KB
Del
OK
stringold.py
12.16 KB
Del
OK
stringold.pyc
12.25 KB
Del
OK
stringold.pyo
12.25 KB
Del
OK
stringprep.py
13.21 KB
Del
OK
stringprep.pyc
14.15 KB
Del
OK
stringprep.pyo
14.08 KB
Del
OK
struct.py
82 B
Del
OK
struct.pyc
239 B
Del
OK
struct.pyo
239 B
Del
OK
subprocess.py
57.68 KB
Del
OK
subprocess.pyc
40.93 KB
Del
OK
subprocess.pyo
40.93 KB
Del
OK
sunau.py
16.15 KB
Del
OK
sunau.pyc
17.53 KB
Del
OK
sunau.pyo
17.53 KB
Del
OK
sunaudio.py
1.37 KB
Del
OK
sunaudio.pyc
1.94 KB
Del
OK
sunaudio.pyo
1.94 KB
Del
OK
symbol.py
2.01 KB
Del
OK
symbol.pyc
2.96 KB
Del
OK
symbol.pyo
2.96 KB
Del
OK
symtable.py
7.34 KB
Del
OK
symtable.pyc
11.59 KB
Del
OK
symtable.pyo
11.46 KB
Del
OK
sysconfig.py
21.88 KB
Del
OK
sysconfig.pyc
17.23 KB
Del
OK
sysconfig.pyo
17.23 KB
Del
OK
tabnanny.py
11.07 KB
Del
OK
tabnanny.pyc
8.05 KB
Del
OK
tabnanny.pyo
8.05 KB
Del
OK
tarfile.py
88.12 KB
Del
OK
tarfile.pyc
73.84 KB
Del
OK
tarfile.pyo
73.84 KB
Del
OK
telnetlib.py
26.18 KB
Del
OK
telnetlib.pyc
22.53 KB
Del
OK
telnetlib.pyo
22.53 KB
Del
OK
tempfile.py
17.91 KB
Del
OK
tempfile.pyc
19.35 KB
Del
OK
tempfile.pyo
19.35 KB
Del
OK
test
-
Del
OK
textwrap.py
16.64 KB
Del
OK
textwrap.pyc
11.62 KB
Del
OK
textwrap.pyo
11.53 KB
Del
OK
this.py
1002 B
Del
OK
this.pyc
1.19 KB
Del
OK
this.pyo
1.19 KB
Del
OK
threading.py
46.28 KB
Del
OK
threading.pyc
41.7 KB
Del
OK
threading.pyo
39.58 KB
Del
OK
timeit.py
11.82 KB
Del
OK
timeit.pyc
11.5 KB
Del
OK
timeit.pyo
11.5 KB
Del
OK
toaiff.py
3.07 KB
Del
OK
toaiff.pyc
3.03 KB
Del
OK
toaiff.pyo
3.03 KB
Del
OK
token.py
2.88 KB
Del
OK
token.pyc
3.73 KB
Del
OK
token.pyo
3.73 KB
Del
OK
tokenize.py
16.15 KB
Del
OK
tokenize.pyc
13.61 KB
Del
OK
tokenize.pyo
13.52 KB
Del
OK
trace.py
29.19 KB
Del
OK
trace.pyc
22.26 KB
Del
OK
trace.pyo
22.2 KB
Del
OK
traceback.py
10.99 KB
Del
OK
traceback.pyc
11.35 KB
Del
OK
traceback.pyo
11.35 KB
Del
OK
tty.py
879 B
Del
OK
tty.pyc
1.29 KB
Del
OK
tty.pyo
1.29 KB
Del
OK
types.py
1.99 KB
Del
OK
types.pyc
2.45 KB
Del
OK
types.pyo
2.45 KB
Del
OK
unittest
-
Del
OK
urllib.py
57.14 KB
Del
OK
urllib.pyc
49.1 KB
Del
OK
urllib.pyo
49 KB
Del
OK
urllib2.py
52.13 KB
Del
OK
urllib2.pyc
46.61 KB
Del
OK
urllib2.pyo
46.52 KB
Del
OK
urlparse.py
16.82 KB
Del
OK
urlparse.pyc
15.67 KB
Del
OK
urlparse.pyo
15.67 KB
Del
OK
user.py
1.59 KB
Del
OK
user.pyc
1.68 KB
Del
OK
user.pyo
1.68 KB
Del
OK
uu.py
6.4 KB
Del
OK
uu.pyc
4.21 KB
Del
OK
uu.pyo
4.21 KB
Del
OK
uuid.py
20.6 KB
Del
OK
uuid.pyc
20.68 KB
Del
OK
uuid.pyo
20.68 KB
Del
OK
warnings.py
13.71 KB
Del
OK
warnings.pyc
12.84 KB
Del
OK
warnings.pyo
12.02 KB
Del
OK
wave.py
17.67 KB
Del
OK
wave.pyc
19 KB
Del
OK
wave.pyo
18.94 KB
Del
OK
weakref.py
10.44 KB
Del
OK
weakref.pyc
13.72 KB
Del
OK
weakref.pyo
13.72 KB
Del
OK
webbrowser.py
22.68 KB
Del
OK
webbrowser.pyc
19.83 KB
Del
OK
webbrowser.pyo
19.78 KB
Del
OK
whichdb.py
3.3 KB
Del
OK
whichdb.pyc
2.19 KB
Del
OK
whichdb.pyo
2.19 KB
Del
OK
wsgiref
-
Del
OK
wsgiref.egg-info
187 B
Del
OK
xdrlib.py
5.43 KB
Del
OK
xdrlib.pyc
9.07 KB
Del
OK
xdrlib.pyo
9.07 KB
Del
OK
xml
-
Del
OK
xmllib.py
34.05 KB
Del
OK
xmllib.pyc
26.22 KB
Del
OK
xmllib.pyo
26.22 KB
Del
OK
xmlrpclib.py
50.78 KB
Del
OK
xmlrpclib.pyc
42.89 KB
Del
OK
xmlrpclib.pyo
42.71 KB
Del
OK
zipfile.py
56.45 KB
Del
OK
zipfile.pyc
40.33 KB
Del
OK
zipfile.pyo
40.33 KB
Del
OK
Edit: aifc.py
"""Stuff to parse AIFF-C and AIFF files. Unless explicitly stated otherwise, the description below is true both for AIFF-C files and AIFF files. An AIFF-C file has the following structure. +-----------------+ | FORM | +-----------------+ | <size> | +----+------------+ | | AIFC | | +------------+ | | <chunks> | | | . | | | . | | | . | +----+------------+ An AIFF file has the string "AIFF" instead of "AIFC". A chunk consists of an identifier (4 bytes) followed by a size (4 bytes, big endian order), followed by the data. The size field does not include the size of the 8 byte header. The following chunk types are recognized. FVER <version number of AIFF-C defining document> (AIFF-C only). MARK <# of markers> (2 bytes) list of markers: <marker ID> (2 bytes, must be > 0) <position> (4 bytes) <marker name> ("pstring") COMM <# of channels> (2 bytes) <# of sound frames> (4 bytes) <size of the samples> (2 bytes) <sampling frequency> (10 bytes, IEEE 80-bit extended floating point) in AIFF-C files only: <compression type> (4 bytes) <human-readable version of compression type> ("pstring") SSND <offset> (4 bytes, not used by this program) <blocksize> (4 bytes, not used by this program) <sound data> A pstring consists of 1 byte length, a string of characters, and 0 or 1 byte pad to make the total length even. Usage. Reading AIFF files: f = aifc.open(file, 'r') where file is either the name of a file or an open file pointer. The open file pointer must have methods read(), seek(), and close(). In some types of audio files, if the setpos() method is not used, the seek() method is not necessary. This returns an instance of a class with the following public methods: getnchannels() -- returns number of audio channels (1 for mono, 2 for stereo) getsampwidth() -- returns sample width in bytes getframerate() -- returns sampling frequency getnframes() -- returns number of audio frames getcomptype() -- returns compression type ('NONE' for AIFF files) getcompname() -- returns human-readable version of compression type ('not compressed' for AIFF files) getparams() -- returns a tuple consisting of all of the above in the above order getmarkers() -- get the list of marks in the audio file or None if there are no marks getmark(id) -- get mark with the specified id (raises an error if the mark does not exist) readframes(n) -- returns at most n frames of audio rewind() -- rewind to the beginning of the audio stream setpos(pos) -- seek to the specified position tell() -- return the current position close() -- close the instance (make it unusable) The position returned by tell(), the position given to setpos() and the position of marks are all compatible and have nothing to do with the actual position in the file. The close() method is called automatically when the class instance is destroyed. Writing AIFF files: f = aifc.open(file, 'w') where file is either the name of a file or an open file pointer. The open file pointer must have methods write(), tell(), seek(), and close(). This returns an instance of a class with the following public methods: aiff() -- create an AIFF file (AIFF-C default) aifc() -- create an AIFF-C file setnchannels(n) -- set the number of channels setsampwidth(n) -- set the sample width setframerate(n) -- set the frame rate setnframes(n) -- set the number of frames setcomptype(type, name) -- set the compression type and the human-readable compression type setparams(tuple) -- set all parameters at once setmark(id, pos, name) -- add specified mark to the list of marks tell() -- return current position in output file (useful in combination with setmark()) writeframesraw(data) -- write audio frames without pathing up the file header writeframes(data) -- write audio frames and patch up the file header close() -- patch up the file header and close the output file You should set the parameters before the first writeframesraw or writeframes. The total number of frames does not need to be set, but when it is set to the correct value, the header does not have to be patched up. It is best to first set all parameters, perhaps possibly the compression type, and then write audio frames using writeframesraw. When all frames have been written, either call writeframes('') or close() to patch up the sizes in the header. Marks can be added anytime. If there are any marks, ypu must call close() after all frames have been written. The close() method is called automatically when the class instance is destroyed. When a file is opened with the extension '.aiff', an AIFF file is written, otherwise an AIFF-C file is written. This default can be changed by calling aiff() or aifc() before the first writeframes or writeframesraw. """ import struct import __builtin__ __all__ = ["Error","open","openfp"] class Error(Exception): pass _AIFC_version = 0xA2805140L # Version 1 of AIFF-C def _read_long(file): try: return struct.unpack('>l', file.read(4))[0] except struct.error: raise EOFError def _read_ulong(file): try: return struct.unpack('>L', file.read(4))[0] except struct.error: raise EOFError def _read_short(file): try: return struct.unpack('>h', file.read(2))[0] except struct.error: raise EOFError def _read_ushort(file): try: return struct.unpack('>H', file.read(2))[0] except struct.error: raise EOFError def _read_string(file): length = ord(file.read(1)) if length == 0: data = '' else: data = file.read(length) if length & 1 == 0: dummy = file.read(1) return data _HUGE_VAL = 1.79769313486231e+308 # See <limits.h> def _read_float(f): # 10 bytes expon = _read_short(f) # 2 bytes sign = 1 if expon < 0: sign = -1 expon = expon + 0x8000 himant = _read_ulong(f) # 4 bytes lomant = _read_ulong(f) # 4 bytes if expon == himant == lomant == 0: f = 0.0 elif expon == 0x7FFF: f = _HUGE_VAL else: expon = expon - 16383 f = (himant * 0x100000000L + lomant) * pow(2.0, expon - 63) return sign * f def _write_short(f, x): f.write(struct.pack('>h', x)) def _write_ushort(f, x): f.write(struct.pack('>H', x)) def _write_long(f, x): f.write(struct.pack('>l', x)) def _write_ulong(f, x): f.write(struct.pack('>L', x)) def _write_string(f, s): if len(s) > 255: raise ValueError("string exceeds maximum pstring length") f.write(struct.pack('B', len(s))) f.write(s) if len(s) & 1 == 0: f.write(chr(0)) def _write_float(f, x): import math if x < 0: sign = 0x8000 x = x * -1 else: sign = 0 if x == 0: expon = 0 himant = 0 lomant = 0 else: fmant, expon = math.frexp(x) if expon > 16384 or fmant >= 1 or fmant != fmant: # Infinity or NaN expon = sign|0x7FFF himant = 0 lomant = 0 else: # Finite expon = expon + 16382 if expon < 0: # denormalized fmant = math.ldexp(fmant, expon) expon = 0 expon = expon | sign fmant = math.ldexp(fmant, 32) fsmant = math.floor(fmant) himant = long(fsmant) fmant = math.ldexp(fmant - fsmant, 32) fsmant = math.floor(fmant) lomant = long(fsmant) _write_ushort(f, expon) _write_ulong(f, himant) _write_ulong(f, lomant) from chunk import Chunk class Aifc_read: # Variables used in this class: # # These variables are available to the user though appropriate # methods of this class: # _file -- the open file with methods read(), close(), and seek() # set through the __init__() method # _nchannels -- the number of audio channels # available through the getnchannels() method # _nframes -- the number of audio frames # available through the getnframes() method # _sampwidth -- the number of bytes per audio sample # available through the getsampwidth() method # _framerate -- the sampling frequency # available through the getframerate() method # _comptype -- the AIFF-C compression type ('NONE' if AIFF) # available through the getcomptype() method # _compname -- the human-readable AIFF-C compression type # available through the getcomptype() method # _markers -- the marks in the audio file # available through the getmarkers() and getmark() # methods # _soundpos -- the position in the audio stream # available through the tell() method, set through the # setpos() method # # These variables are used internally only: # _version -- the AIFF-C version number # _decomp -- the decompressor from builtin module cl # _comm_chunk_read -- 1 iff the COMM chunk has been read # _aifc -- 1 iff reading an AIFF-C file # _ssnd_seek_needed -- 1 iff positioned correctly in audio # file for readframes() # _ssnd_chunk -- instantiation of a chunk class for the SSND chunk # _framesize -- size of one frame in the file def initfp(self, file): self._version = 0 self._decomp = None self._convert = None self._markers = [] self._soundpos = 0 self._file = file chunk = Chunk(file) if chunk.getname() != 'FORM': raise Error, 'file does not start with FORM id' formdata = chunk.read(4) if formdata == 'AIFF': self._aifc = 0 elif formdata == 'AIFC': self._aifc = 1 else: raise Error, 'not an AIFF or AIFF-C file' self._comm_chunk_read = 0 while 1: self._ssnd_seek_needed = 1 try: chunk = Chunk(self._file) except EOFError: break chunkname = chunk.getname() if chunkname == 'COMM': self._read_comm_chunk(chunk) self._comm_chunk_read = 1 elif chunkname == 'SSND': self._ssnd_chunk = chunk dummy = chunk.read(8) self._ssnd_seek_needed = 0 elif chunkname == 'FVER': self._version = _read_ulong(chunk) elif chunkname == 'MARK': self._readmark(chunk) chunk.skip() if not self._comm_chunk_read or not self._ssnd_chunk: raise Error, 'COMM chunk and/or SSND chunk missing' if self._aifc and self._decomp: import cl params = [cl.ORIGINAL_FORMAT, 0, cl.BITS_PER_COMPONENT, self._sampwidth * 8, cl.FRAME_RATE, self._framerate] if self._nchannels == 1: params[1] = cl.MONO elif self._nchannels == 2: params[1] = cl.STEREO_INTERLEAVED else: raise Error, 'cannot compress more than 2 channels' self._decomp.SetParams(params) def __init__(self, f): if type(f) == type(''): f = __builtin__.open(f, 'rb') # else, assume it is an open file object already self.initfp(f) # # User visible methods. # def getfp(self): return self._file def rewind(self): self._ssnd_seek_needed = 1 self._soundpos = 0 def close(self): if self._decomp: self._decomp.CloseDecompressor() self._decomp = None self._file.close() def tell(self): return self._soundpos def getnchannels(self): return self._nchannels def getnframes(self): return self._nframes def getsampwidth(self): return self._sampwidth def getframerate(self): return self._framerate def getcomptype(self): return self._comptype def getcompname(self): return self._compname ## def getversion(self): ## return self._version def getparams(self): return self.getnchannels(), self.getsampwidth(), \ self.getframerate(), self.getnframes(), \ self.getcomptype(), self.getcompname() def getmarkers(self): if len(self._markers) == 0: return None return self._markers def getmark(self, id): for marker in self._markers: if id == marker[0]: return marker raise Error, 'marker %r does not exist' % (id,) def setpos(self, pos): if pos < 0 or pos > self._nframes: raise Error, 'position not in range' self._soundpos = pos self._ssnd_seek_needed = 1 def readframes(self, nframes): if self._ssnd_seek_needed: self._ssnd_chunk.seek(0) dummy = self._ssnd_chunk.read(8) pos = self._soundpos * self._framesize if pos: self._ssnd_chunk.seek(pos + 8) self._ssnd_seek_needed = 0 if nframes == 0: return '' data = self._ssnd_chunk.read(nframes * self._framesize) if self._convert and data: data = self._convert(data) self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth) return data # # Internal methods. # def _decomp_data(self, data): import cl dummy = self._decomp.SetParam(cl.FRAME_BUFFER_SIZE, len(data) * 2) return self._decomp.Decompress(len(data) // self._nchannels, data) def _ulaw2lin(self, data): import audioop return audioop.ulaw2lin(data, 2) def _adpcm2lin(self, data): import audioop if not hasattr(self, '_adpcmstate'): # first time self._adpcmstate = None data, self._adpcmstate = audioop.adpcm2lin(data, 2, self._adpcmstate) return data def _read_comm_chunk(self, chunk): self._nchannels = _read_short(chunk) self._nframes = _read_long(chunk) self._sampwidth = (_read_short(chunk) + 7) // 8 self._framerate = int(_read_float(chunk)) self._framesize = self._nchannels * self._sampwidth if self._aifc: #DEBUG: SGI's soundeditor produces a bad size :-( kludge = 0 if chunk.chunksize == 18: kludge = 1 print 'Warning: bad COMM chunk size' chunk.chunksize = 23 #DEBUG end self._comptype = chunk.read(4) #DEBUG start if kludge: length = ord(chunk.file.read(1)) if length & 1 == 0: length = length + 1 chunk.chunksize = chunk.chunksize + length chunk.file.seek(-1, 1) #DEBUG end self._compname = _read_string(chunk) if self._comptype != 'NONE': if self._comptype == 'G722': try: import audioop except ImportError: pass else: self._convert = self._adpcm2lin self._framesize = self._framesize // 4 return # for ULAW and ALAW try Compression Library try: import cl except ImportError: if self._comptype == 'ULAW': try: import audioop self._convert = self._ulaw2lin self._framesize = self._framesize // 2 return except ImportError: pass raise Error, 'cannot read compressed AIFF-C files' if self._comptype == 'ULAW': scheme = cl.G711_ULAW self._framesize = self._framesize // 2 elif self._comptype == 'ALAW': scheme = cl.G711_ALAW self._framesize = self._framesize // 2 else: raise Error, 'unsupported compression type' self._decomp = cl.OpenDecompressor(scheme) self._convert = self._decomp_data else: self._comptype = 'NONE' self._compname = 'not compressed' def _readmark(self, chunk): nmarkers = _read_short(chunk) # Some files appear to contain invalid counts. # Cope with this by testing for EOF. try: for i in range(nmarkers): id = _read_short(chunk) pos = _read_long(chunk) name = _read_string(chunk) if pos or name: # some files appear to have # dummy markers consisting of # a position 0 and name '' self._markers.append((id, pos, name)) except EOFError: print 'Warning: MARK chunk contains only', print len(self._markers), if len(self._markers) == 1: print 'marker', else: print 'markers', print 'instead of', nmarkers class Aifc_write: # Variables used in this class: # # These variables are user settable through appropriate methods # of this class: # _file -- the open file with methods write(), close(), tell(), seek() # set through the __init__() method # _comptype -- the AIFF-C compression type ('NONE' in AIFF) # set through the setcomptype() or setparams() method # _compname -- the human-readable AIFF-C compression type # set through the setcomptype() or setparams() method # _nchannels -- the number of audio channels # set through the setnchannels() or setparams() method # _sampwidth -- the number of bytes per audio sample # set through the setsampwidth() or setparams() method # _framerate -- the sampling frequency # set through the setframerate() or setparams() method # _nframes -- the number of audio frames written to the header # set through the setnframes() or setparams() method # _aifc -- whether we're writing an AIFF-C file or an AIFF file # set through the aifc() method, reset through the # aiff() method # # These variables are used internally only: # _version -- the AIFF-C version number # _comp -- the compressor from builtin module cl # _nframeswritten -- the number of audio frames actually written # _datalength -- the size of the audio samples written to the header # _datawritten -- the size of the audio samples actually written def __init__(self, f): if type(f) == type(''): filename = f f = __builtin__.open(f, 'wb') else: # else, assume it is an open file object already filename = '???' self.initfp(f) if filename[-5:] == '.aiff': self._aifc = 0 else: self._aifc = 1 def initfp(self, file): self._file = file self._version = _AIFC_version self._comptype = 'NONE' self._compname = 'not compressed' self._comp = None self._convert = None self._nchannels = 0 self._sampwidth = 0 self._framerate = 0 self._nframes = 0 self._nframeswritten = 0 self._datawritten = 0 self._datalength = 0 self._markers = [] self._marklength = 0 self._aifc = 1 # AIFF-C is default def __del__(self): if self._file: self.close() # # User visible methods. # def aiff(self): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' self._aifc = 0 def aifc(self): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' self._aifc = 1 def setnchannels(self, nchannels): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if nchannels < 1: raise Error, 'bad # of channels' self._nchannels = nchannels def getnchannels(self): if not self._nchannels: raise Error, 'number of channels not set' return self._nchannels def setsampwidth(self, sampwidth): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if sampwidth < 1 or sampwidth > 4: raise Error, 'bad sample width' self._sampwidth = sampwidth def getsampwidth(self): if not self._sampwidth: raise Error, 'sample width not set' return self._sampwidth def setframerate(self, framerate): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if framerate <= 0: raise Error, 'bad frame rate' self._framerate = framerate def getframerate(self): if not self._framerate: raise Error, 'frame rate not set' return self._framerate def setnframes(self, nframes): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' self._nframes = nframes def getnframes(self): return self._nframeswritten def setcomptype(self, comptype, compname): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if comptype not in ('NONE', 'ULAW', 'ALAW', 'G722'): raise Error, 'unsupported compression type' self._comptype = comptype self._compname = compname def getcomptype(self): return self._comptype def getcompname(self): return self._compname ## def setversion(self, version): ## if self._nframeswritten: ## raise Error, 'cannot change parameters after starting to write' ## self._version = version def setparams(self, info): nchannels, sampwidth, framerate, nframes, comptype, compname = info if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if comptype not in ('NONE', 'ULAW', 'ALAW', 'G722'): raise Error, 'unsupported compression type' self.setnchannels(nchannels) self.setsampwidth(sampwidth) self.setframerate(framerate) self.setnframes(nframes) self.setcomptype(comptype, compname) def getparams(self): if not self._nchannels or not self._sampwidth or not self._framerate: raise Error, 'not all parameters set' return self._nchannels, self._sampwidth, self._framerate, \ self._nframes, self._comptype, self._compname def setmark(self, id, pos, name): if id <= 0: raise Error, 'marker ID must be > 0' if pos < 0: raise Error, 'marker position must be >= 0' if type(name) != type(''): raise Error, 'marker name must be a string' for i in range(len(self._markers)): if id == self._markers[i][0]: self._markers[i] = id, pos, name return self._markers.append((id, pos, name)) def getmark(self, id): for marker in self._markers: if id == marker[0]: return marker raise Error, 'marker %r does not exist' % (id,) def getmarkers(self): if len(self._markers) == 0: return None return self._markers def tell(self): return self._nframeswritten def writeframesraw(self, data): self._ensure_header_written(len(data)) nframes = len(data) // (self._sampwidth * self._nchannels) if self._convert: data = self._convert(data) self._file.write(data) self._nframeswritten = self._nframeswritten + nframes self._datawritten = self._datawritten + len(data) def writeframes(self, data): self.writeframesraw(data) if self._nframeswritten != self._nframes or \ self._datalength != self._datawritten: self._patchheader() def close(self): if self._file is None: return try: self._ensure_header_written(0) if self._datawritten & 1: # quick pad to even size self._file.write(chr(0)) self._datawritten = self._datawritten + 1 self._writemarkers() if self._nframeswritten != self._nframes or \ self._datalength != self._datawritten or \ self._marklength: self._patchheader() if self._comp: self._comp.CloseCompressor() self._comp = None finally: # Prevent ref cycles self._convert = None f = self._file self._file = None f.close() # # Internal methods. # def _comp_data(self, data): import cl dummy = self._comp.SetParam(cl.FRAME_BUFFER_SIZE, len(data)) dummy = self._comp.SetParam(cl.COMPRESSED_BUFFER_SIZE, len(data)) return self._comp.Compress(self._nframes, data) def _lin2ulaw(self, data): import audioop return audioop.lin2ulaw(data, 2) def _lin2adpcm(self, data): import audioop if not hasattr(self, '_adpcmstate'): self._adpcmstate = None data, self._adpcmstate = audioop.lin2adpcm(data, 2, self._adpcmstate) return data def _ensure_header_written(self, datasize): if not self._nframeswritten: if self._comptype in ('ULAW', 'ALAW'): if not self._sampwidth: self._sampwidth = 2 if self._sampwidth != 2: raise Error, 'sample width must be 2 when compressing with ULAW or ALAW' if self._comptype == 'G722': if not self._sampwidth: self._sampwidth = 2 if self._sampwidth != 2: raise Error, 'sample width must be 2 when compressing with G7.22 (ADPCM)' if not self._nchannels: raise Error, '# channels not specified' if not self._sampwidth: raise Error, 'sample width not specified' if not self._framerate: raise Error, 'sampling rate not specified' self._write_header(datasize) def _init_compression(self): if self._comptype == 'G722': self._convert = self._lin2adpcm return try: import cl except ImportError: if self._comptype == 'ULAW': try: import audioop self._convert = self._lin2ulaw return except ImportError: pass raise Error, 'cannot write compressed AIFF-C files' if self._comptype == 'ULAW': scheme = cl.G711_ULAW elif self._comptype == 'ALAW': scheme = cl.G711_ALAW else: raise Error, 'unsupported compression type' self._comp = cl.OpenCompressor(scheme) params = [cl.ORIGINAL_FORMAT, 0, cl.BITS_PER_COMPONENT, self._sampwidth * 8, cl.FRAME_RATE, self._framerate, cl.FRAME_BUFFER_SIZE, 100, cl.COMPRESSED_BUFFER_SIZE, 100] if self._nchannels == 1: params[1] = cl.MONO elif self._nchannels == 2: params[1] = cl.STEREO_INTERLEAVED else: raise Error, 'cannot compress more than 2 channels' self._comp.SetParams(params) # the compressor produces a header which we ignore dummy = self._comp.Compress(0, '') self._convert = self._comp_data def _write_header(self, initlength): if self._aifc and self._comptype != 'NONE': self._init_compression() self._file.write('FORM') if not self._nframes: self._nframes = initlength // (self._nchannels * self._sampwidth) self._datalength = self._nframes * self._nchannels * self._sampwidth if self._datalength & 1: self._datalength = self._datalength + 1 if self._aifc: if self._comptype in ('ULAW', 'ALAW'): self._datalength = self._datalength // 2 if self._datalength & 1: self._datalength = self._datalength + 1 elif self._comptype == 'G722': self._datalength = (self._datalength + 3) // 4 if self._datalength & 1: self._datalength = self._datalength + 1 self._form_length_pos = self._file.tell() commlength = self._write_form_length(self._datalength) if self._aifc: self._file.write('AIFC') self._file.write('FVER') _write_ulong(self._file, 4) _write_ulong(self._file, self._version) else: self._file.write('AIFF') self._file.write('COMM') _write_ulong(self._file, commlength) _write_short(self._file, self._nchannels) self._nframes_pos = self._file.tell() _write_ulong(self._file, self._nframes) _write_short(self._file, self._sampwidth * 8) _write_float(self._file, self._framerate) if self._aifc: self._file.write(self._comptype) _write_string(self._file, self._compname) self._file.write('SSND') self._ssnd_length_pos = self._file.tell() _write_ulong(self._file, self._datalength + 8) _write_ulong(self._file, 0) _write_ulong(self._file, 0) def _write_form_length(self, datalength): if self._aifc: commlength = 18 + 5 + len(self._compname) if commlength & 1: commlength = commlength + 1 verslength = 12 else: commlength = 18 verslength = 0 _write_ulong(self._file, 4 + verslength + self._marklength + \ 8 + commlength + 16 + datalength) return commlength def _patchheader(self): curpos = self._file.tell() if self._datawritten & 1: datalength = self._datawritten + 1 self._file.write(chr(0)) else: datalength = self._datawritten if datalength == self._datalength and \ self._nframes == self._nframeswritten and \ self._marklength == 0: self._file.seek(curpos, 0) return self._file.seek(self._form_length_pos, 0) dummy = self._write_form_length(datalength) self._file.seek(self._nframes_pos, 0) _write_ulong(self._file, self._nframeswritten) self._file.seek(self._ssnd_length_pos, 0) _write_ulong(self._file, datalength + 8) self._file.seek(curpos, 0) self._nframes = self._nframeswritten self._datalength = datalength def _writemarkers(self): if len(self._markers) == 0: return self._file.write('MARK') length = 2 for marker in self._markers: id, pos, name = marker length = length + len(name) + 1 + 6 if len(name) & 1 == 0: length = length + 1 _write_ulong(self._file, length) self._marklength = length + 8 _write_short(self._file, len(self._markers)) for marker in self._markers: id, pos, name = marker _write_short(self._file, id) _write_ulong(self._file, pos) _write_string(self._file, name) def open(f, mode=None): if mode is None: if hasattr(f, 'mode'): mode = f.mode else: mode = 'rb' if mode in ('r', 'rb'): return Aifc_read(f) elif mode in ('w', 'wb'): return Aifc_write(f) else: raise Error, "mode must be 'r', 'rb', 'w', or 'wb'" openfp = open # B/W compatibility if __name__ == '__main__': import sys if not sys.argv[1:]: sys.argv.append('/usr/demos/data/audio/bach.aiff') fn = sys.argv[1] f = open(fn, 'r') print "Reading", fn print "nchannels =", f.getnchannels() print "nframes =", f.getnframes() print "sampwidth =", f.getsampwidth() print "framerate =", f.getframerate() print "comptype =", f.getcomptype() print "compname =", f.getcompname() if sys.argv[2:]: gn = sys.argv[2] print "Writing", gn g = open(gn, 'w') g.setparams(f.getparams()) while 1: data = f.readframes(1024) if not data: break g.writeframes(data) g.close() f.close() print "Done."
Save