
    Cc
                         d Z g dZddlmZ ddlmZmZ ddlmZm	Z	m
Z
mZ  G d de	      Z G d d	e      Z G d
 de      Z G d de      ZeZ G d de      Zy)a  True Audio audio stream information and tags.

True Audio is a lossless format designed for real-time encoding and
decoding. This module is based on the documentation at
http://www.true-audio.com/TTA_Lossless_Audio_Codec\_-_Format_Description

True Audio files use ID3 tags.
)	TrueAudioOpendeleteEasyTrueAudio    )
StreamInfo)ID3FileTyper   )cdataMutagenErrorconvert_errorendswithc                       e Zd Zy)errorN__name__
__module____qualname__     3/usr/lib/python3/dist-packages/mutagen/trueaudio.pyr   r          r   r   c                       e Zd Zy)TrueAudioHeaderErrorNr   r   r   r   r   r      r   r   r   c                   4    e Zd ZdZ eee      d        Zd Zy)TrueAudioInfozTrueAudioInfo()

    True Audio stream information.

    Attributes:
        length (`float`): audio length, in seconds
        sample_rate (`int`): audio sample rate, in Hz
    c                 H   |j                  |xs d       |j                  d      }t        |      dk7  s|j                  d      st	        d      t        j                  |dd       | _        t        j                  |dd       }t        |      | j                  z  | _
        y)zRaises TrueAudioHeaderErrorr         TTAzTTA header not found
      N)seekreadlen
startswithr   r	   int_lesample_rateuint_lefloatlength)selffileobjoffsetheadersampless        r   __init__zTrueAudioInfo.__init__*   s     	V[q!b!v;"F$5$5f$=&'=>> <<r"6--r".Gnt'7'77r   c                 8    d| j                   | j                  fz  S )Nz True Audio, %.2f seconds, %d Hz.)r(   r%   )r)   s    r   pprintzTrueAudioInfo.pprint6   s#    2KK))6+ + 	+r   N)	r   r   r   __doc__r   IOErrorr   r.   r0   r   r   r   r   r       s(     701	8 2	8+r   r   c                   *    e Zd ZdZeZdgZed        Zy)r   zTrueAudio(filething, ID3=None)

    A True Audio file.

    Arguments:
        filething (filething)
        ID3 (mutagen.id3.ID3)

    Attributes:
        info (`TrueAudioInfo`)
        tags (`mutagen.id3.ID3`)
    zaudio/x-ttac                     |j                  d      |j                  d      z   t        | j                         d      dz  z   S )Ns   ID3r   s   .tta   )r#   r   lower)filenamer*   r,   s      r   scorezTrueAudio.scoreL   s@    !!&)F,=,=f,EE)73a78 	9r   N)	r   r   r   r1   r   _Info_mimesstaticmethodr8   r   r   r   r   r   ;   s'     E_F9 9r   r   c                        e Zd ZdZddlmZ eZy)r   zEasyTrueAudio(filething, ID3=None)

    Like MP3, but uses EasyID3 for tags.

    Arguments:
        filething (filething)
        ID3 (mutagen.id3.ID3)

    Attributes:
        info (`TrueAudioInfo`)
        tags (`mutagen.easyid3.EasyID3`)
    r   )EasyID3N)r   r   r   r1   mutagen.easyid3r=   ID3r   r   r   r   r   U   s     /
Cr   r   N)r1   __all__mutagenr   mutagen.id3r   r   mutagen._utilr	   r
   r   r   r   r   r   r   r   r   r   r   r   <module>rD      s`    ;  + F F	L 		5 	+J +69 9. I r   