File: //opt/alt/python27/lib/python2.7/site-packages/future/backports/email/mime/audio.pyc
�
�A�[c           @` s�   d  Z  d d l m Z d d l m Z d d l m Z d g Z d d l Z d d l m Z d d l	 m
 Z
 d d	 l m Z i d
 d 6d d
 6d d 6d d 6Z
 d �  Z d e f d �  �  YZ d S(   u/   Class representing audio/* type MIME documents.i    (   t   unicode_literals(   t   division(   t   absolute_importu	   MIMEAudioN(   t   BytesIO(   t   encoders(   t   MIMENonMultipartu   basicu   auu   x-wavu   wavu   x-aiffu   aiffu   aifcc         C` sZ   |  d  } t  | � } x= t j D]2 } | | | � } | d k	 r  t j | d � Sq  Wd S(   u  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.
    i   i    N(   R   t   sndhdrt   testst   Nonet   _sndhdr_MIMEmapt   get(   t   datat   hdrt   fakefilet   testfnt   res(    (    sR   /opt/alt/python27/lib/python2.7/site-packages/future/backports/email/mime/audio.pyt   _whatsnd   s    
t	   MIMEAudioc           B` s    e  Z d  Z d e j d � Z RS(   u,   Class for generating audio/* MIME documents.c         K` sg   | d k r t | � } n  | d k r6 t d � � n  t j |  d | | � |  j | � | |  � d S(   u  Create an audio/* type MIME document.
        _audiodata is a string containing the raw audio data.  If this data
        can be decoded by the standard Python `sndhdr' module, then the
        subtype will be automatically included in the Content-Type header.
        Otherwise, you can specify  the specific audio subtype via the
        _subtype parameter.  If _subtype is not given, and no subtype can be
        guessed, a TypeError is raised.
        _encoder is a function which will perform the actual encoding for
        transport of the image data.  It takes one argument, which is this
        Image instance.  It should use get_payload() and set_payload() to
        change the payload to the encoded form.  It should also add any
        Content-Transfer-Encoding or other headers to the message as
        necessary.  The default encoding is Base64.
        Any additional keyword arguments are passed to the base class
        constructor, which turns them into parameters on the Content-Type
        header.
        u!   Could not find audio MIME subtypeu   audioN(   R   R   t	   TypeErrorR   t   __init__t   set_payload(   t   selft
   _audiodatat   _subtypet   _encodert   _params(    (    sR   /opt/alt/python27/lib/python2.7/site-packages/future/backports/email/mime/audio.pyR   .   s    
N(   t   __name__t
   __module__t   __doc__R   R   t
   encode_base64R   (    (    (    sR   /opt/alt/python27/lib/python2.7/site-packages/future/backports/email/mime/audio.pyR   +   s   (   R   t
   __future__R    R   R   t   __all__R   t   ioR   t   future.backports.emailR   t(   future.backports.email.mime.nonmultipartR   R	   R   R   (    (    (    sR   /opt/alt/python27/lib/python2.7/site-packages/future/backports/email/mime/audio.pyt   <module>   s