
    *bi]                         S SK JrJr  S SKJr  SSKJrJrJ	r	J
r
Jr  SSKJr  SSKJr  SSKJrJr  SSKJrJr  SS	KJrJrJr  \S
 5       r\S 5       rg)    )removepath)iscoroutinefunction   )	task_dicttask_dict_lock	user_dataLOGGERsabnzbd_client)Config)TorrentManager)bt_selection_buttonsnew_task)get_task_by_gidMirrorStatus)send_messagesend_status_messagedelete_messagec                   #    [         R                  (       d  [        US5      I S h  vN   g UR                  R                  nUR
                  R                  5       n[        U5      S:  a5  US   n[        U5      I S h  vN nUc  [        USU S35      I S h  vN   g OUR                  =n(       aN  [         IS h  vN   [        R                  " U5      nS S S 5      IS h  vN   Wc  [        US5      I S h  vN   g O%[        U5      S:X  a  Sn[        X5      I S h  vN   g [         R                  U:w  aV  WR                  R                  U:w  a<  U[         ;  d  [         U   R                  S5      (       d  [        US5      I S h  vN   g [#        WR$                  5      (       d  [        US	5      I S h  vN   g UR%                  5       I S h  vN [&        R(                  [&        R*                  [&        R,                  4;  a  [        US
5      I S h  vN   g UR/                  5       R1                  S5      (       d$  UR/                  5       R1                  S5      (       a  [        US5      I S h  vN   g  UR2                  (       d  UR5                  5       I S h  vN   UR7                  5       nUR                  R8                  (       a  [:        R<                  " U5      I S h  vN   OUR                  R>                  (       aC  URA                  5       n[B        RD                  RF                  RI                  U/5      I S h  vN   O( [B        RJ                  RM                  U5      I S h  vN   SUR                  l*        [W        W5      n	Sn[        XU	5      I S h  vN   g  GN GN, GN GN GN! , IS h  vN  (       d  f       GN= f GN GN GNM GN! GN GN GNo GNG GN N N~! [N         a#  n[P        RR                  " U S35         S nANS nAff = f!   [        US5      I S h  vN     g = f N7f)NzBase URL not defined!   zGID: <code>z</code> Not Found.zThis is not an active task!a  Reply to an active /cmd which was used to start the download or add gid along with cmd

This command mainly for selection incase you decided to select files from already added torrent/nzb. But you can always use /cmd with arg `s` to select files before download start.SUDOThis task is not for you!z*The task have finished the download stage!zTask should be in download or pause (incase message deleted by wrong) or queued status (incase you have used torrent or nzb file)!z
[METADATA]Tryingz(Try after downloading metadata finished!z6 Error in pause, this mostly happens after abuse aria2Tz)This is not a bittorrent or sabnzbd task!zZYour download paused. Choose files then press Done Selecting button to resume downloading.),r   BASE_URLr   	from_useridtextsplitlenr   reply_to_message_idr   r   getOWNER_IDlisteneruser_idr	   r   statusr   STATUS_DOWNLOADSTATUS_PAUSEDSTATUS_QUEUEDLname
startswithqueuedupdategidis_nzbr   	pause_jobis_qbithashr   qbittorrenttorrentsstoparia2
forcePause	Exceptionr
   errorselectr   )
_messager$   msgr-   taskreply_to_idid_eSBUTTONSs
             !/app/bot/modules/file_selector.pyr9   r9      su    ??7$;<<<""G
,,


C
3x!|!f$S))<w+cU:L(MNNN   33	3	3!>==-D "><w(EFFF  
SQ` 	
 7(((7"MM!!W,I%Yw-?-C-CF-K-K7$?@@@t{{++7$PQQQ[[]$$""### 
  Q
 	
 	
 	yy{l++tyy{/E/Eh/O/O7$NOOO{{++-((*C}}##$..s333&&iik$0099>>uEEE(..99#>>>
  $
 $C(H
fC
wX
...O 	= *N ">>> G 	) 	A 	R
	
 	P
   4 F ?  LL#ST 
7$OPPP /s  %P?N(AP??N+ P?N.#P?>N1?P?N7P?$N4%P?;O<%P?!O"A)P?O.P?:O;P?OAP?O!AP?5O$6P?<$P!  O'!AP! )O**AP! O-P! "O1 0O/1O1 5P! P?"P=#P?+P?.P?1P?4P?7O=O >O
	P?P?P?P?P?!P?$P?'P! *P! -P! /O1 1
P;PP! PP! !P:2P53P:8P?c                 d  #    UR                   R                  nUR                  R                  5       nUR                  n[        US   5      I S h  vN nUc,  UR                  SSS9I S h  vN   [        U5      I S h  vN   g X%R                  R                  :w  a  UR                  SSS9I S h  vN   g US   S:X  a  UR                  US   SS9I S h  vN   g US   S	:X  Ga  UR                  5       I S h  vN   US   n[        US
5      (       Ga  UR                  R                  (       GaG  [        R                  R                  R                  U/S9I S h  vN S   nUR                   R#                  SS5      S   n[        R                  R                  R%                  U5      I S h  vN n	U	 Hz  n
U
R&                  S:X  d  M  U SU
R(                   3U SU
R(                   S3/nU H<  n[*        R,                  " U5      I S h  vN (       d  M(   [/        U5      I S h  vN   M>     M|     UR0                  (       d2  [        R                  R                  R3                  U/5      I S h  vN   O[        R4                  R7                  U5      I S h  vN n	U	 HM  n
U
S   S:X  d  M  [*        R,                  " U
S   5      I S h  vN (       d  M6   [/        U
S   5      I S h  vN   MO     UR0                  (       d)   [        R4                  R9                  U5      I S h  vN   O:O9UR                  R@                  (       a  [B        RD                  " U5      I S h  vN   [G        U5      I S h  vN   [        U5      I S h  vN   g [        U5      I S h  vN   URI                  5       I S h  vN   g  GNh GNP GN@ GN GN GN GNo GN GN GN!    GM  = f GNn GNI GN GN !    GMQ  = f N! [:         a#  n[<        R>                  " U S35         S nANS nAff = f N N N N N{7f)Nr   zThis task has been cancelled!T)
show_alertr   r   pin   doneseeding)hashesr   /z.!qBselectedfalser   zU Error in resume, this mostly happens after abuse aria2. Try to use select cmd again!)%r   r   datar   r;   r   answerr   r#   r$   hasattrr0   r   r2   r3   infocontent_pathrsplitfilespriorityr)   aiopathexistsr   r+   startr5   getFilesunpauser7   r
   r8   r.   r   
resume_jobr   cancel_task)r:   queryr$   rM   r;   r=   r?   tor_infor   resff_pathsf_pathr@   s                 rB   confirm_selectionrb   f   st    oo  G::DmmG a))D|ll:tlLLLW%%%--'''ll64lHHH	aE	ll47tl444	aF	lln1g4##}}$$$(44==BB3%BPP  ,,33C;A>*66??EEcJJAzzQ&*V1QVVH#5$q7M"N&-F%,^^F%;;;!)*0.$8$8 '.  {{(44==CCSEJJJ*0099#>>A}/'..6:S4S4S!"(6"333  {{,22::3??? # ]]!! ++C000!'***W%%%W%%%   g *L% 	I4
 Q K
  <$8!)$(J>4S3!  @$  c!vw 
 1*%% s  AP0N8P0+N;,P0>N>?1P00O1$P0O"P08O9A"P0O
AP0.O/P0
AP0OP0O&O'O+AP01O2'P0O"P0.P0
O%P0O+(O()O+-P0"O6 %O4&O6 *6P0 P&!P03P(4P0P*P0P,P02P.3P0;P0>P0P0P0P0
P0P0P0OOP0"P0%P0(O++O1-P04O6 6
P# PP0P##P0(P0*P0,P0.P0N)aiofiles.osr   r   rU   asyncior    r   r   r	   r
   r   core.config_managerr   core.torrent_managerr   helper.ext_utils.bot_utilsr   r   helper.ext_utils.status_utilsr   r   $helper.telegram_helper.message_utilsr   r   r   r9   rb        rB   <module>rm      s]    / '  ) 1 J  
I/ 
I/X 
7! 
7!rl   