
    C1i                         S SK r S SKrS SKrS SKrS SKJr  S SKJr  \R                  " \	5      r
SS\S\\   4S jjrS\S\S\4S	 jrS\S\4S
 jrS\S\4S jrg)    N)Iterator)urlopencheck_writablereturnc              #   <  #     [         R                  S   v   [         R                  S:X  a2  [         R                  R                  [        R                  SS5      v   g / SQn[        [        S5      (       a   UR                  S[        R                  5        U H  n[         R                  R                  USS5      nU (       a}  [         R                  R                  U5      (       a-  [         R                  " U[         R                  5      (       d  M{  O,[         R                  " U[         R                  5      (       d  M  Uv   M     [         R                  R                  [         R                  R                  S5      S	S5      v   g ! [         a     GNf = f7f)
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       E/home/james-whalen/.local/lib/python3.13/site-packages/av/datasets.pyiter_data_dirsr       s    jj,-- 
ww$ggll3::vz::E sM""Q

#ww||D&*5ww~~d##yyrww// 0 yyrww//
  '',,rww))#.
DD;  s(   FF E2F
FFFFurlr   c                    [         R                  R                  U5      nX!:w  a  [        U S35      e[	        5        HJ  n[         R                  R                  X15      n[         R                  R                  U5      (       d  MH  Us  $    [        [	        S5      5      n[         R                  R                  X15      n[        R                  SU  SU 35        [        U 5      nUR                  5       S:w  a  [        SUR                  5        35      e[         R                  R                  U5      n [         R                  " U5        US-   n[#        US	5       n UR%                  S
5      n	U	(       a  UR'                  U	5        OOM-  SSS5        [         R(                  " Xt5        U$ ! [         a)  nUR                  [        R                   :w  a  e  SnANSnAff = f! , (       d  f       N\= f)aC  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:   .   s    !!$'JD6!4566 ww||D'77>>$K !
 t$%D77<<#DHH|C5TF+,s|HS 5!1!1!3 456677??4 D
D
 f}H	h	MM$'E  
 IIhK  77ell" #
 
	s$   4F* /G *
G4GG 
G.c           
          [        SU -   [        R                  R                  SU R	                  S[        R                  R
                  5      5      5      $ )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   s>     ,t3
\4<<RWW[[#AB     c           
          [        SU -   [        R                  R                  SU R	                  S[        R                  R
                  5      5      5      $ )z}Download 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   s>     $t+
^T\\#rww{{%CD rB   )F)r.   loggingr   r   typingr   urllib.requestr   	getLogger__name__r(   boolstrr    r:   rA   rD    rB   r   <module>rM      s      	 
  "! E4  EHSM  EF3 3C 3C 3ls s 	# 	# 	rB   