Metadata-Version: 2.4
Name: beiane-dlb
Version: 0.3.0
Summary: Multi-threaded downloader with Rich progress bars
Home-page: https://gitee.com/byusistudio/dlb
Author: ByUsi Studio
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rich>=13.0.0
Requires-Dist: requests>=2.31.0
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# DLB - 多线程下载工具库

[![MIT License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![Gitee Stars](https://gitee.com/byusi/dlb/badge/star.svg?theme=white)](https://gitee.com/byusi/dlb)

> 基于 Python 开发的高效多线程下载工具，支持进度显示和智能配置

## 功能特性

- **多线程加速**：支持自定义并发线程数 (`-j` 参数)
- **可视化进度**：使用 Rich 库实现美观的终端进度条，显示下载速度和剩余时间
- **智能配置**：自动保存用户设置到 `~/.dlb.json`
- **多语言支持**：自动适配中英文界面
- **Cookie 支持**：可通过配置或命令行设置请求 Cookies
- **断点续传**：支持自动续传未完成的下载任务
- **下载重试**：支持失败自动重试，采用指数退避策略
- **日志记录**：自动记录下载日志到 `~/.dlb/logs/dlb.log`

## 安装方式

### 通过 PyPI 安装 (推荐)
```bash
pip install beiane-dlb
```

### 从 Gitee 仓库安装
```bash
pip install git+https://gitee.com/byusistudio/dlb.git
```

### 开发版安装
```bash
git clone https://gitee.com/byusistudio/dlb.git
cd dlb
pip install -e .
```

## 快速开始

### 基础下载
```bash
dlb https://example.com/file1.zip https://example.com/file2.zip
```

### 高级用法
```bash
# 指定输出目录和线程数
dlb -o ./downloads -j 8 https://example.com/large-file.iso

# 设置 Cookie 并保存配置
dlb --cookie "session=abc123" --set-config -j 4

# 批量下载视频文件
dlb $(seq -f "https://video-site.com/video_%03d.mp4" 1 100)
```

## 配置文件

默认配置文件路径：`~/.dlb.json`

```json
{
  "language": "auto",
  "max_workers": 5,
  "max_downloads": 10,
  "cookies": "",
  "placeholder": false,
  "timeout": 30,
  "chunk_size": 1048576,
  "retries": 3
}
```

配置项说明：

| 配置项 | 类型 | 默认值 | 说明 |
|--------|------|--------|------|
| language | string | auto | 界面语言，可选值：auto、zh_CN、en_US |
| max_workers | int | 5 | 最大并发线程数 |
| max_downloads | int | 10 | 最大同时下载数量 |
| cookies | string | "" | HTTP 请求 Cookie |
| placeholder | bool | false | 是否创建占位文件 |
| timeout | int | 30 | 连接超时时间（秒） |
| chunk_size | int | 1048576 | 下载块大小（字节），默认 1MB |
| retries | int | 3 | 失败重试次数 |

## 构建与发布

### 环境准备

创建 `.env` 文件并配置 PyPI token：

```
PYPI_TOKEN=your_pypi_token_here
```

### Linux / macOS

```bash
bash build.sh
```

### Windows

```cmd
build.bat
```

## 项目结构

```
dlb/
├── dlb/
│   ├── __init__.py      # 包初始化
│   ├── cli.py           # 命令行接口
│   ├── config.py        # 配置管理
│   ├── core.py          # 核心下载逻辑
│   ├── i18n.py          # 国际化支持
│   ├── logger.py        # 日志记录
│   └── locales/         # 翻译文件
│       ├── en_US.json
│       └── zh_CN.json
├── build.sh             # Linux/macOS 构建脚本
├── build.bat            # Windows 构建脚本
├── .env.example         # 环境变量模板
├── pyproject.toml       # 项目配置
├── setup.py             # 安装配置
└── README.md            # 项目说明
```

## 版权与协议

**Copyright © 2025 北啊呢**  
本项目采用 [MIT 开源协议](LICENSE)，您可以自由地：

- 使用、复制、修改本软件
- 进行再分发和商业使用

## 项目地址

访问 Gitee 仓库获取最新代码：  
[gitee.com/byusistudio/dlb](https://gitee.com/byusistudio/dlb)

## 贡献指南

欢迎通过以下方式参与贡献：
1. 提交 Issue 报告问题
2. Fork 仓库后发起 Pull Request
3. 完善多语言翻译文件
4. 编写测试用例

## 技术支持

如遇使用问题，请优先查阅：

```bash
dlb --help
```

或提交 Issue 至项目仓库，我们将尽快为您解答。
