
    ;Si                     @    d dl Z d dlZddlmZ ddlmZ  G d d      Zy)    N   )utils)typesc                       e Zd ZdZd Zed        Zed        Zed        Zed        Z	ed        Z
ed        Zed	        Zed
        Zed        Zed        Zed        Zed        Zd Zy)Filea3  
    Convenience class over media like photos or documents, which
    supports accessing the attributes in a more convenient way.

    If any of the attributes are not present in the current media,
    the properties will be `None`.

    The original media is available through the ``media`` attribute.
    c                     || _         y N)media)selfr
   s     \/var/www/OnlineNewsSite/project/venv/lib/python3.12/site-packages/telethon/tl/custom/file.py__init__zFile.__init__   s	    
    c                 @    t        j                  | j                        S )a  
        The old bot-API style ``file_id`` representing this file.

        .. warning::

            This feature has not been maintained for a long time and
            may not work. It will be removed in future versions.

        .. note::

            This file ID may not work under user accounts,
            but should still be usable by bot accounts.

            You can, however, still use it to identify
            a file in for example a database.
        )r   pack_bot_file_idr
   r   s    r   idzFile.id   s    $ %%djj11r   c                 B    | j                  t        j                  d      S )z1
        The file name of this document.
        	file_name)
_from_attrr   DocumentAttributeFilenamer   s    r   namez	File.name)   s    
 u>>LLr   c                     t        j                  | j                        xs4 t        j                  j                  | j                  xs d      d   xs dS )z
        The extension from the mime type of this file.

        If the mime type is unknown, the extension
        from the file name (if any) will be used.
         N)	mimetypesguess_extension	mime_typeospathsplitextr   r   s    r   extzFile.ext0   sG     %%dnn5 ww		R04	
r   c                     t        | j                  t        j                        ryt        | j                  t        j                        r| j                  j
                  S y)z-
        The mime-type of this file.
        z
image/jpegN)
isinstancer
   r   PhotoDocumentr   r   s    r   r   zFile.mime_type>   s@    
 djj%++.

ENN3::''' 4r   c                     t        | j                  t        j                        r&t	        d | j                  j
                  D              S | j                  t        j                  t        j                  fd      S )zO
        The width in pixels of this media if it's a photo or a video.
        c              3   6   K   | ]  }t        |d d        yw)wr   Ngetattr.0ss     r   	<genexpr>zFile.width.<locals>.<genexpr>N        Dawq#q)D   r(   	r#   r
   r   r$   maxsizesr   DocumentAttributeImageSizeDocumentAttributeVideor   s    r   widthz
File.widthH   s^    
 djj%++.D4::3C3CDDD,,e.J.J LMPR 	Rr   c                     t        | j                  t        j                        r&t	        d | j                  j
                  D              S | j                  t        j                  t        j                  fd      S )zP
        The height in pixels of this media if it's a photo or a video.
        c              3   6   K   | ]  }t        |d d        yw)hr   Nr)   r+   s     r   r.   zFile.height.<locals>.<genexpr>Y   r/   r0   r9   r1   r   s    r   heightzFile.heightS   s^    
 djj%++.D4::3C3CDDD++U-I-I KLOQ 	Qr   c                 b    | j                  t        j                  t        j                  fd      S )z@
        The duration in seconds of the audio or video.
        duration)r   r   DocumentAttributeAudior5   r   s    r   r<   zFile.duration^   s1    
 ((%*F*F HISU 	Ur   c                 B    | j                  t        j                  d      S )z(
        The title of the song.
        titler   r   r=   r   s    r   r?   z
File.titlef   s    
 u;;WEEr   c                 B    | j                  t        j                  d      S )z,
        The performer of the song.
        	performerr@   r   s    r   rB   zFile.performerm   s    
 u;;[IIr   c                 B    | j                  t        j                  d      S )zM
        A string with all emoji that represent the current sticker.
        altr   r   DocumentAttributeStickerr   s    r   emojiz
File.emojit   s    
 u==uEEr   c                 B    | j                  t        j                  d      S )zN
        The :tl:`InputStickerSet` to which the sticker file belongs.
        
stickersetrE   r   s    r   sticker_setzFile.sticker_set{   s    
 u==|LLr   c           	      F   t        | j                  t        j                        rCt	        t        dt        t        j                  | j                  j                              d      S t        | j                  t        j                        r| j                  j                  S y)z
        The size in bytes of this file.

        For photos, this is the heaviest thumbnail, as it often repressents the largest dimensions.
        N)default)r#   r
   r   r$   r2   filtermapr   _photo_size_byte_countr3   r%   sizer   s    r   rP   z	File.size   sg     djj%++.vdC(D(DdjjFVFV$WXbfgg

ENN3::??" 4r   c                     t        | j                  t        j                        r7| j                  j                  D ]  }t        ||      st        ||d       c S  y y r	   )r#   r
   r   r%   
attributesr*   )r   clsfieldattrs       r   r   zFile._from_attr   sK    djj%..1

-- 6dC("4556 2r   N)__name__
__module____qualname____doc__r   propertyr   r   r!   r   r6   r:   r<   r?   rB   rG   rJ   rP   r    r   r   r   r      s    2 2& M M 
 
 ( ( R R Q Q U U F F J J F F M M 	# 	#6r   r   )r   r   r   r   tlr   r   r[   r   r   <module>r]      s     	  J6 J6r   