
    hh                         d dl mZ d dlZd dlZ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 ddlmZ ddlmZ  G d d	ej                        Zd
 Zd Zedk(  r e        yy)    )print_functionN   )__version__)download)MAX_NUMBER_FILES)download_folderc                       e Zd ZddZy)_ShowVersionActionNc           
          t        dj                  t        t        j                  j                  t        j                  j                  t                                 |j                          y )Nzgdown {ver} at {pos})verpos)printformatr   ospathdirname__file__exit)selfparser	namespacevaluesoption_strings        G/var/www/html/dev/engine/venv/lib/python3.12/site-packages/gdown/cli.py__call__z_ShowVersionAction.__call__   sG    "))RWW__RWW__X5N%O * 	

 	    )N)__name__
__module____qualname__r    r   r   r
   r
      s    r   r
   c                     | ht        j                  d|       }|st        |j                         \  }}t	        |      }|dk(  r|dz  }|S |dk(  r|dz  }|S |dk(  r|dz  }|S |dk(  r	 |S y )	Nz([0-9]+)(GB|MB|KB|B)KBi   MBi   GBi   @B)rematch	TypeErrorgroupsfloat)argvmsizeunits       r   	file_sizer/      s    HH,d3OXXZ
dT{4<DLD  T\GOD
 	 T\GOD  S[ r   c                     t        j                  t         j                        } | j                  ddt        dd       | j                  dd	       | j                  d
dd	       | j                  dddd       | j                  ddd       | j                  ddd       | j                  dd	       | j                  dt
        d       | j                  ddd       | j                  ddd       | j                  dd d!dd"#       | j                  d$dd%j                  t        &             | j                  d'dd(j                  t        &             | j                  d)d*	       | j                         }|j                  d+k(  rEt        j                  r t        j                  j                  |_	        nt        j                  |_	        |j                  r*t!        j"                  d,t$        -       d }|j&                  }n=t)        j*                  d.|j&                        r|j&                  }d }nd }|j&                  }|j,                  rat/        |||j                  |j0                  |j2                  |j4                  |j6                   |j8                   |j:                  /	      }|d u}nvt=        ||j                  |j0                  |j2                  |j4                  |j6                   |j8                   ||j>                  |j@                  |j                  0      }|d u}|st        jB                  d1       y y )2N)formatter_classz-Vz	--versionzdisplay versionr   )actionhelpnargs	url_or_idz2url or file/folder id (with --id) to download from)r3   z-Oz--outputzoutput file name / pathz-qz--quiet
store_truezsuppress standard output)r2   r3   z--fuzzyz*(fild only) extract Google Drive's file IDz--idz:[DEPRECATED] flag to specify file/folder id instead of urlz--proxyz9<protocol://host:port> download using the specified proxyz--speedz7download speed limit in second (e.g., '10MB' -> 10MB/s))typer3   z--no-cookiesz0don't use cookies in ~/.cache/gdown/cookies.jsonz--no-check-certificatez(don't check the server's TLS certificatez
--continuez-c	continue_z6(file only) resume getting a partially-downloaded file)destr2   r3   z--folderzLdownload entire folder instead of a single file (max {max} files per folder))maxz--remaining-okzH(folder only) asserts that is ok to download max {max} files per folder.z--formatztFormat of Google Docs, Spreadsheets and Slides. Default is Google Docs: 'docx', Spreadsheet: 'xlsx', Slides: 'pptx'.-z}Option `--id` was deprecated in version 4.3.1 and will be removed in 5.0. You don't need to pass it anymore to use a file ID.)categoryz^https?://.*)	urlidoutputquietproxyspeeduse_cookiesverifyremaining_ok)r=   r?   r@   rA   rB   rC   rD   r>   fuzzyresumer   r   )"argparseArgumentParserArgumentDefaultsHelpFormatteradd_argumentr
   r/   r   r   
parse_argsr?   sixPY3sysstdoutbufferr>   warningswarnFutureWarningr5   r&   r'   folderr   r@   rA   rB   
no_cookiesno_check_certificaterE   r   rF   r8   r   )r   argsr=   r>   	filenamessuccessfilenames          r   mainr\   -   sJ   $$ >>F !   N   j/HI
i3M   9  
 I  
 H   F  
 ?  
  7  
 E   ''-v2Bv'C	   ""(&-=&">	   O   D{{c77**++DK**DKww0 #		
 ^^88NDNN3..CBCB{{#;;****** OO+000**

	 4';;****** OO+000**>>;;
 $& r   __main__)
__future__r   rH   os.pathr   r&   rO   rR   rM    r   r   r   r   Actionr
   r/   r\   r   r    r   r   <module>rb      sV    %   	 
  
   - , $D zF r   