Skip to main content

小工具集 — 各类实用小功能

Project description

xigua — 小工具集

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

已包含模块

cos — COS 元数据 API 客户端

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

配置由调用方传入:

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 — 本地图片/视频元数据

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

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))

命令行:

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

依赖说明:

  • 图片:Pillow(HEIC/HEIF 需 pip install xigua[heif]
  • 视频:系统需安装 ffprobe

安装

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

发布

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xigua-0.1.8.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xigua-0.1.8-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file xigua-0.1.8.tar.gz.

File metadata

  • Download URL: xigua-0.1.8.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for xigua-0.1.8.tar.gz
Algorithm Hash digest
SHA256 38a262dc5ec9e3ce6bd22bc9cf7239165ca93e62d4d6ad4ab3127bd99508f1a0
MD5 7289da386faa68758dcf4dc63755efec
BLAKE2b-256 88da6776ac03efb1796e316347747bdfdb38383032f340056595e05d93eab0d2

See more details on using hashes here.

File details

Details for the file xigua-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: xigua-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for xigua-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f72ae7b6e756a2125deb4ce519f2a3b76c9df4becd9e85faf79aa6ec583d2de5
MD5 826906066ac43fe55c0cc56f8f3b9af2
BLAKE2b-256 14ae554e914b688d178554044fdf8db8aa20bdf0362e9c8403c600e5cc3e421c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page