@@ -6505,18 +6505,20 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
6505
6505
print (f"{ output_filename } already exists, using existing file." )
6506
6506
return output_filename
6507
6507
print (f"Downloading { input_url } " , flush = True )
6508
- dl_success = False
6509
6508
6509
+ dl_success = False
6510
+ out_dir = os .path .dirname (os .path .abspath (output_filename )) or os .getcwd ()
6511
+ out_name = os .path .basename (output_filename )
6510
6512
try :
6511
6513
if os .name == 'nt' :
6512
6514
basepath = os .path .abspath (os .path .dirname (__file__ ))
6513
- a2cexe = (os .path .join (basepath , "aria2c-win.exe" ))
6514
- if os .path .exists (a2cexe ): #on windows try using embedded a2cexe
6515
- out_dir = os .path .dirname (output_filename )
6516
- out_name = os .path .basename (output_filename )
6515
+ a2cexe = os .path .join (basepath , "aria2c-win.exe" )
6516
+ if os .path .exists (a2cexe ): # on windows try using embedded aria2c
6517
6517
rc = subprocess .run ([
6518
- a2cexe , "-x" , "16" , "-s" , "16" , "--summary-interval=15" , "--console-log-level=error" , "--log-level=error" ,
6519
- "--download-result=default" , "--continue=true" , "--allow-overwrite=true" , "--file-allocation=none" , "--max-tries=3" ,
6518
+ a2cexe , "-x" , "16" , "-s" , "16" ,
6519
+ "--summary-interval=15" , "--console-log-level=error" , "--log-level=error" ,
6520
+ "--download-result=default" , "--continue=true" , "--allow-overwrite=true" ,
6521
+ "--file-allocation=none" , "--max-tries=3" ,
6520
6522
"-d" , out_dir , "-o" , out_name , input_url
6521
6523
], capture_output = capture_output , text = True , check = True , encoding = 'utf-8' )
6522
6524
dl_success = (rc .returncode == 0 and os .path .exists (output_filename ) and os .path .getsize (output_filename ) > min_file_size )
@@ -6525,11 +6527,11 @@ def downloader_internal(input_url, output_filename, capture_output, min_file_siz
6525
6527
6526
6528
try :
6527
6529
if not dl_success and shutil .which ("aria2c" ) is not None :
6528
- out_dir = os .path .dirname (output_filename )
6529
- out_name = os .path .basename (output_filename )
6530
6530
rc = subprocess .run ([
6531
- "aria2c" , "-x" , "16" , "-s" , "16" , "--summary-interval=15" , "--console-log-level=error" , "--log-level=error" ,
6532
- "--download-result=default" , "--allow-overwrite=true" , "--file-allocation=none" , "--max-tries=3" ,
6531
+ "aria2c" , "-x" , "16" , "-s" , "16" ,
6532
+ "--summary-interval=15" , "--console-log-level=error" , "--log-level=error" ,
6533
+ "--download-result=default" , "--allow-overwrite=true" ,
6534
+ "--file-allocation=none" , "--max-tries=3" ,
6533
6535
"-d" , out_dir , "-o" , out_name , input_url
6534
6536
], capture_output = capture_output , text = True , check = True , encoding = 'utf-8' )
6535
6537
dl_success = (rc .returncode == 0 and os .path .exists (output_filename ) and os .path .getsize (output_filename ) > min_file_size )
0 commit comments