Metadata-Version: 2.4
Name: xigua
Version: 0.1.8
Summary: 小工具集 — 各类实用小功能
Author-email: xigua <2587125111@qq.com>
License: Copyright © 2024 xigua Authors. All Rights Reserve.
Project-URL: Homepage, https://pypi.org/project/xigua
Keywords: utilities,tools,metadata,exif,ffprobe,media,cos,upload
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: Pillow>=9.0.0
Requires-Dist: PyYAML<7.0,>=6.0
Requires-Dist: requests>=2.28.0
Provides-Extra: heif
Requires-Dist: pillow-heif>=0.10.0; extra == "heif"

# xigua — 小工具集

各类实用小功能，按模块组织，持续扩展。

## 已包含模块

### cos — COS 元数据 API 客户端

对接 COS 元数据管理 REST API，支持小文件直传、大文件分片断点续传、秒传、查询与删除。

配置由调用方传入：

```python
from xigua.cos import CosClient, CosConfig

# 方式一：直接传参
client = CosClient(
    api_base="https://your-api.example.com",
    token="your_token",
    bucket="your-bucket",
    biz_id="my_biz",
    sub_dir="docs",
    verbose=True,
)

# 方式二：从本地 YAML 加载（自行维护配置文件，勿提交到版本库）
client = CosClient.from_yaml("/path/to/cos.yaml", verbose=True)

# 上传文件或目录
results = client.upload_files(["/path/to/file.pdf", "/path/to/folder"])
url = client.get_url(results[0]["id"], expired=600)
```

### media — 本地图片/视频元数据

读取本地图片或视频的全部元数据（中文键名输出）。

```python
from xigua.media import MediaMetadataService

# 读取为字典
data = MediaMetadataService.read("/path/to/photo.jpg")

# 直接格式化输出
print(MediaMetadataService.format_file("/path/to/clip.mp4", fmt="text"))
print(MediaMetadataService.format_file("/path/to/clip.mp4", fmt="yaml", include_md5=False))
```

命令行：

```bash
xigua-media /path/to/photo.jpg
xigua-media /path/to/clip.mp4 --fmt text --no-md5
```

**依赖说明：**
- 图片：Pillow（HEIC/HEIF 需 `pip install xigua[heif]`）
- 视频：系统需安装 `ffprobe`

## 安装

```bash
pip install xigua
pip install xigua[heif]   # 支持 HEIC/HEIF
```

## 发布

```bash
cd /Users/xigua/pypi-publish
./publish xigua --bump patch
```
