feat(toolbox): 支持rar格式与7z格式解压,修改了下注释
This commit is contained in:
		
							parent
							
								
									a360cd7e74
								
							
						
					
					
						commit
						e470ee1f7f
					
				@ -14,6 +14,7 @@ if USE_PROXY:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # 代理网络的地址,打开你的科学上网软件查看代理的协议(socks5/http)、地址(localhost)和端口(11284)
 | 
					    # 代理网络的地址,打开你的科学上网软件查看代理的协议(socks5/http)、地址(localhost)和端口(11284)
 | 
				
			||||||
    proxies = { "http": "socks5h://localhost:11284", "https": "socks5h://localhost:11284", }
 | 
					    proxies = { "http": "socks5h://localhost:11284", "https": "socks5h://localhost:11284", }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print('网络代理状态:运行。')
 | 
					    print('网络代理状态:运行。')
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
    proxies = None
 | 
					    proxies = None
 | 
				
			||||||
 | 
				
			|||||||
@ -193,11 +193,13 @@ def extract_archive(file_path, dest_dir):
 | 
				
			|||||||
                print("Successfully extracted rar archive to {}".format(dest_dir))
 | 
					                print("Successfully extracted rar archive to {}".format(dest_dir))
 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            print("rar格式需要安装额外依赖")
 | 
					            print("rar格式需要安装额外依赖")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    elif file_extension == '.7z':
 | 
					    elif file_extension == '.7z':
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            import py7zr
 | 
					            import py7zr
 | 
				
			||||||
            with py7zr.SevenZipFile(file_path, mode='r') as f:
 | 
					            with py7zr.SevenZipFile(file_path, mode='r') as f:
 | 
				
			||||||
                f.extractall(path=dest_dir)
 | 
					                f.extractall(path=dest_dir)
 | 
				
			||||||
 | 
					                print("Successfully extracted 7z archive to {}".format(dest_dir))
 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            print("7z格式需要安装额外依赖")
 | 
					            print("7z格式需要安装额外依赖")
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user