
    m i                         d dl Z d dlZd dlZd dlZd dlmZ d dlmZ  ej        e	          Z
ddedee         fdZded	edefd
Zd	edefdZd	edefdZdS )    N)Iterator)urlopenFcheck_writablereturnc              #     K   	 t           j        d         V  n# t          $ r Y nw xY wt           j        dk    r/t           j                            t          j        dd          V  d S g d}t          t          d          r |	                    dt          j                   |D ]}t           j                            |dd          }| r`t           j        
                    |          r!t          j        |t           j                  sdn t          j        |t           j                  s|V  t           j                            t           j                            d          d	d          V  d S )
NPYAV_TESTDATA_DIRntpyavdatasets)z/usr/local/sharez/usr/local/libz
/usr/sharez/usr/libreal_prefixr   ~z.pyav)osenvironKeyErrornamepathjoinsysprefixhasattrinsertexistsaccessW_OK
expanduser)r   basesbasedir_s       K/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/av/datasets.pyiter_data_dirsr       sk     j,-----    
w$gll3:vz:::::  E sM"" $Q
### 	 	w||D&*55 	w~~d## yrw//  yrw// 




',,rw))#..
D
DDDDDDs    
&&urlr   c                    t           j                            |          }||k    rt          | d          t	                      D ]E}t           j                            ||          }t           j                            |          r|c S Ft          t	          d                    }t           j                            ||          }t          	                    d|  d|            t          |           }|                                dk    r$t          d|                                           t           j                            |          }	 t          j        |           n-# t          $ r }|j        t          j        k    r Y d}~nd}~ww xY w|dz   }t#          |d	          5 }	 |                    d
          }	|	r|                    |	           nn/	 ddd           n# 1 swxY w Y   t          j        ||           |S )ag  Download the data at a URL, and cache it under the given name.

    The file is stored under `pyav/test` with the given name in the directory
    :envvar:`PYAV_TESTDATA_DIR`, or the first that is writeable of:

    - the current virtualenv
    - ``/usr/local/share``
    - ``/usr/local/lib``
    - ``/usr/share``
    - ``/usr/lib``
    - the user's home

    z is not normalized.TzDownloading z to    zHTTP Nz.tmpwbi   )r   r   normpath
ValueErrorr    r   r   nextloginfor   getcodedirnamemakedirsOSErrorerrnoEEXISTopenreadwriterename)
r!   r   
clean_namer   r   responseetmp_pathfhchunks
             r   cached_downloadr:   .   sL    !!$''JTD555666    w||D$''7>>$ 	KKK	 t$$%%D7<<d##DHH+C++T++,,,s||HS  5!1!1!3!3556667??4  D
D   7el"" #"""" f}H	h		 	MM$''E 	
                IhKs*   E( (
F2FF*1G((G,/G,c           
          t          d| z   t          j                            d|                     dt          j        j                                      S )zDownload and return a path to a sample from the FFmpeg test suite.

    Data is handled by :func:`cached_download`.

    See the `FFmpeg Automated Test Environment <https://www.ffmpeg.org/fate.html>`_

    z"http://fate.ffmpeg.org/fate-suite/z
fate-suite/r:   r   r   r   replacesepr   s    r   faterA   d   sC     ,t3
\4<<RW[#A#ABB      c           
          t          d| z   t          j                            d|                     dt          j        j                                      S )zDownload and return a path to a sample that is curated by the PyAV developers.

    Data is handled by :func:`cached_download`.

    zhttps://pyav.org/datasets/zpyav-curatedr<   r=   r@   s    r   curatedrD   r   sC     $t+
^T\\#rw{%C%CDD  rB   )F)r.   loggingr   r   typingr   urllib.requestr   	getLogger__name__r(   boolstrr    r:   rA   rD    rB   r   <module>rM      s
     				 



       " " " " " "g!! E  E4  EHSM  E  E  E  EF3 3C 3C 3 3 3 3ls s    	# 	# 	 	 	 	 	 	rB   