mirror of
				https://github.com/devine-dl/devine.git
				synced 2025-11-04 11:54:50 +00:00 
			
		
		
		
	Get -j, -x, and -s from aria2c config, default to 16
This commit is contained in:
		
							parent
							
								
									dbfefc1d97
								
							
						
					
					
						commit
						a7bbac7bcc
					
				@ -10,6 +10,14 @@ which does not keep comments.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## aria2c (dict)
 | 
					## aria2c (dict)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- `max_concurrent_downloads`
 | 
				
			||||||
 | 
					  Maximum number of parallel downloads. Default: `5`  
 | 
				
			||||||
 | 
					  Note: Currently unused as downloads are multi-threaded by Devine rather than Aria2c.
 | 
				
			||||||
 | 
					  Devine internally has a constant set value of 16 for it's parallel downloads.
 | 
				
			||||||
 | 
					- `max_connection_per_server`
 | 
				
			||||||
 | 
					  Maximum number of connections to one server for each download. Default: `1`
 | 
				
			||||||
 | 
					- `split`
 | 
				
			||||||
 | 
					  Split a file into N chunks and download each chunk on it's own connection. Default: `5`
 | 
				
			||||||
- `file_allocation`
 | 
					- `file_allocation`
 | 
				
			||||||
  Specify file allocation method. Default: `"prealloc"`
 | 
					  Specify file allocation method. Default: `"prealloc"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -60,8 +60,12 @@ async def aria2c(
 | 
				
			|||||||
        async with start_pproxy(proxy) as pproxy_:
 | 
					        async with start_pproxy(proxy) as pproxy_:
 | 
				
			||||||
            return await aria2c(uri, out, headers, cookies, pproxy_, silent, segmented, progress, *args)
 | 
					            return await aria2c(uri, out, headers, cookies, pproxy_, silent, segmented, progress, *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    max_concurrent_downloads = int(config.aria2c.get("max_concurrent_downloads", 16))
 | 
				
			||||||
 | 
					    max_connection_per_server = int(config.aria2c.get("max_connection_per_server", 16))
 | 
				
			||||||
 | 
					    split = int(config.aria2c.get("split", 16))
 | 
				
			||||||
    file_allocation = config.aria2c.get("file_allocation", "prealloc")
 | 
					    file_allocation = config.aria2c.get("file_allocation", "prealloc")
 | 
				
			||||||
    if segmented:
 | 
					    if segmented:
 | 
				
			||||||
 | 
					        split = 1
 | 
				
			||||||
        file_allocation = "none"
 | 
					        file_allocation = "none"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    arguments = [
 | 
					    arguments = [
 | 
				
			||||||
@ -71,9 +75,9 @@ async def aria2c(
 | 
				
			|||||||
        "--all-proxy", proxy or "",
 | 
					        "--all-proxy", proxy or "",
 | 
				
			||||||
        "--continue=true",
 | 
					        "--continue=true",
 | 
				
			||||||
        # [Connection Options]
 | 
					        # [Connection Options]
 | 
				
			||||||
        "--max-concurrent-downloads=16",
 | 
					        f"--max-concurrent-downloads={max_concurrent_downloads}",
 | 
				
			||||||
        "--max-connection-per-server=16",
 | 
					        f"--max-connection-per-server={max_connection_per_server}",
 | 
				
			||||||
        f"--split={1 if segmented else 16}",  # each split uses their own connection
 | 
					        f"--split={split}",  # each split uses their own connection
 | 
				
			||||||
        "--max-file-not-found=5",  # counted towards --max-tries
 | 
					        "--max-file-not-found=5",  # counted towards --max-tries
 | 
				
			||||||
        "--max-tries=5",
 | 
					        "--max-tries=5",
 | 
				
			||||||
        "--retry-wait=2",
 | 
					        "--retry-wait=2",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user