Back to index

python3.2  3.2.2
Classes | Functions | Variables
email.mime.audio Namespace Reference

Classes

class  MIMEAudio

Functions

def _whatsnd

Variables

list __all__ = ['MIMEAudio']
dictionary _sndhdr_MIMEmap

Function Documentation

def email.mime.audio._whatsnd (   data) [private]
Try to identify a sound file type.

sndhdr.what() has a pretty cruddy interface, unfortunately.  This is why
we re-do it here.  It would be easier to reverse engineer the Unix 'file'
command and use the standard 'magic' file, as shipped with a modern Unix.

Definition at line 25 of file audio.py.

00025 
00026 def _whatsnd(data):
00027     """Try to identify a sound file type.
00028 
00029     sndhdr.what() has a pretty cruddy interface, unfortunately.  This is why
00030     we re-do it here.  It would be easier to reverse engineer the Unix 'file'
00031     command and use the standard 'magic' file, as shipped with a modern Unix.
00032     """
00033     hdr = data[:512]
00034     fakefile = BytesIO(hdr)
00035     for testfn in sndhdr.tests:
00036         res = testfn(hdr, fakefile)
00037         if res is not None:
00038             return _sndhdr_MIMEmap.get(res[0])
00039     return None
00040 
00041 


Here is the caller graph for this function:


Variable Documentation

Definition at line 7 of file audio.py.

Initial value:
00001 {'au'  : 'basic',
00002                    'wav' :'x-wav',
00003                    'aiff':'x-aiff',
00004                    'aifc':'x-aiff',
00005                    }

Definition at line 17 of file audio.py.