压缩包自动解压工具,支持多种压缩包格式。通过组合各种插件,编排流程,则可满足日常解压需求。
Project description
压缩包自动解压工具,支持多种压缩包格式。通过组合各种插件,编排流程,则可满足日常解压需求。
🎯 使用场景
- 场景一:当压缩包格式不确定,种类繁多,且已经知道密码时。
- 场景二:当压缩包存放位置分散,解压完成后需要移动到指定位置时。
- 场景三:当解压后的文件需要分类整理时。
- 场景四:当解压后的文件需要删除指定文件时。
总之,通过组合各种插件,设计出适合自己的解压流程。
⚙️ 安装
pip install auto-unpack
🖥️ 使用
创建项目文件夹大致结构如下:
project
├── banner.txt // 程序启动banner【可选】
├── .env // 环境变量文件
├── config
│ ├── application[.mode].yaml // 应用配置(不同模式)
│ ├── application.yaml // 应用配置
│ └── logging.yaml // 日志配置【可选】
├── main.py // 入口文件
└── passwords.txt // 密码表
logging.yaml 配置参考:config/logging.yaml
application.yaml 配置参考:
.env 环境变量:
# 运行模式,对应配置文件中的 application[.mode].yaml
MODE=local
# 配置文件目录 => config
config_dir=config
main.py 代码:
from auto_unpack import App
app = App()
if __name__ == '__main__':
app.run()
最后,运行 python main.py [--mode=local]
即可启动程序。
🧩 自定义流程插件
from pathlib import Path
from auto_unpack import App
from auto_unpack.plugin import PluginConfig, Plugin
class MyConfig(PluginConfig):
pass
class MyPlugin(Plugin[MyConfig]):
name: str = "my"
def init(self):
print("my plugin init")
def execute(self):
print("my plugin execute")
if __name__ == '__main__':
app = App()
# 通过类加载插件
app.load_plugin_by_class(MyConfig, MyPlugin)
# 通过配置文件/目录加载插件
app.load_plugin(Path('./plugins'))
app.load_plugin(Path('./plugins/my.py'))
# 运行程序
app.run()
配置使用
flow:
steps:
- name: my
...
🚨 注意事项
- 新流程请先小范围测试,确保功能正常,防止压缩包处理意外造成数据丢失或损坏。
📚 支持格式
- 压缩/解压缩: 7z、XZ、BZIP2、GZIP、TAR、ZIP 以及 WIM
- 仅解压缩: AR、ARJ、CAB、CHM、CPIO、CramFS、DMG、EXT、FAT、GPT、HFS、IHEX、ISO、LZH、LZMA、MBR、MSI、NSIS、NTFS、QCOW2、RAR、RPM、SquashFS、UDF、UEFI、VDI、VHD、VMDK、WIM、XAR 以及 Z
🔗 相关链接
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
auto_unpack-2.2.1.tar.gz
(14.2 MB
view hashes)
Built Distribution
Close
Hashes for auto_unpack-2.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 615b2cf0efb9f77208c630b354c1803cafa037442d45d033d430b104f1806de3 |
|
MD5 | 671c0e63304952df5944995c287d385c |
|
BLAKE2b-256 | 484eb8e6a82fb62d0abd7ee7bedd0d9ed9828fc0e5e6530fd2f18015dc02c9ba |