
    VGhi
                     J    d dl Z ddlmZ ddlmZmZmZmZmZ  G d de      Z	y)    N   )PostProcessor   )PostProcessingErrorXAttrMetadataErrorXAttrUnavailableErrorhyphenate_datewrite_xattrc                   (    e Zd ZdZdddddddZd	 Zy
)XAttrMetadataPPa  Set extended attributes on downloaded file (if xattr support is found)

    More info about extended attributes for media:
        http://freedesktop.org/wiki/CommonExtendedAttributes/
        http://www.freedesktop.org/wiki/PhreedomDraft/
        http://dublincore.org/documents/usageguide/elements.shtml

    TODO:
        * capture youtube keywords and put them in 'user.dublincore.subject' (comma-separated)
        * figure out which xattrs can be used for 'duration', 'thumbnail', 'resolution'
    webpage_urltitleupload_dateuploaderformatdescription)zuser.xdg.referrer.urlzuser.dublincore.titlezuser.dublincore.datezuser.dublincore.contributorzuser.dublincore.formatzuser.dublincore.descriptionc                    t        j                  |d         j                  }| j                  d       | j                  j                         D ]G  \  }}	 |j                  |      }|r.|dk(  rt        |      }t        |d   ||j                                I | j#                  |d   ||       g |fS # t        $ r}t        t        |            d }~wt        $ rz}|j                  dk(  r| j                  d| d       nJ|j                  dk(  r| j                  d| d	       n%t         j                   d
k(  rdnd}t        d|       Y d }~d }~ww xY w)Nfilepathz!Writing metadata to file's xattrsr   NO_SPACEzhThere's no disk space left, disk quota exceeded or filesystem xattr limit exceeded. Extended attribute "z" was not written.VALUE_TOO_LONGz$Unable to write extended attribute "z" due to too long values.ntzYou need to use NTFSz0You may have to enable them in your "/etc/fstab"z5This filesystem doesn't support extended attributes. )osstatst_mtime	to_screenXATTR_MAPPINGitemsgetr	   r
   encoder   r   strr   reasonreport_warningname	try_utime)selfinfomtime	xattrnameinfonamevalueetips           e/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/yt_dlp/postprocessor/xattrpp.pyrunzXAttrMetadataPP.run&   s\   Z()22;<#'#5#5#;#;#= 	nIxn*=0 .u 5Z 0)U\\^L	n, 	tJ'64x ) 2)#a&11% 
n88z)''//8k9KMN XX!11''*NykYr(st57WW_1 R -0fgjfk.lmm
ns&   AB22	E;CEA/EEN)__name__
__module____qualname____doc__r   r.        r-   r   r      s)    
 "/!( -'1"* (5
Mr4   r   )
r   commonr   utilsr   r   r   r	   r
   r   r3   r4   r-   <module>r7      s!    	 ! 3m 3r4   