Ë
    �yf±	  ã                   óV   — d dl Z ddlm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é   )Úcompat_os_name)Ú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ÚdescriptionÚuploaderÚformat)zuser.xdg.referrer.urlzuser.dublincore.titlezuser.dublincore.datezuser.dublincore.descriptionzuser.dublincore.contributorzuser.dublincore.formatc                 óŽ  — t        j                  |d   «      j                  }| j                  d«       	 | j                  j                  «       D ]G  \  }}|j                  |«      }|sŒ|dk(  rt        |«      }t        |d   ||j                  «       «       ŒI 	 | j#                  |d   ||«       g |fS # t        $ r}t        t        |«      «      ‚d }~wt        $ rg}|j                  dk(  r| j                  d«       n<|j                  dk(  r| j                  d«       nt         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_SPACEz|There's no disk space left, disk quota exceeded or filesystem xattr limit exceeded. Some extended attributes are not writtenÚVALUE_TOO_LONGz;Unable to write extended attributes 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_warningr   Ú	try_utime)ÚselfÚinfoÚmtimeÚ	xattrnameÚinfonameÚvalueÚeÚtips           ú>/usr/lib/python3/dist-packages/yt_dlp/postprocessor/xattrpp.pyÚrunzXAttrMetadataPP.run%   s@  € Ü—‘˜˜ZÑ(Ó)×2Ñ2ˆØ�‰Ð;Ô<ð	jØ'+×'9Ñ'9×'?Ñ'?Ó'Aò MÑ#�	˜8ØŸ™ Ó*�ÚØ =Ò0Ü .¨uÓ 5˜Ü  ZÑ 0°)¸U¿\¹\»^ÕLñMð* 	�‰�t˜JÑ'¨°Ô6Ø�4ˆxˆøô %ò 	.Ü%¤c¨!£fÓ-Ð-ûÜ!ò 
	jØ�x‰x˜:Ò%Ø×#Ñ#ð?õ@ð —‘Ð-Ò-Ø×#Ñ#Ð$aÕbä1?À4Ò1GÑ-ØNð ä)Ð,bÐcfÐbgÐ*hÓiÐiÿøð
	jús*   µ3B4 Á)0B4 Â4	EÂ=CÃEÃAD?Ä?EN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r.   © ó    r-   r   r      s'   „ ñ
ð "/à!(Ø -Ø'4Ø'1Ø"*ñ€Mór4   r   )r   Úcommonr   Úcompatr   Úutilsr   r   r	   r
   r   r   r3   r4   r-   ú<module>r8      s$   ðÛ 	å !Ý #÷õ ô1�mõ 1r4   