This release is a pre-release and may not be stable for production use.
easy ass
一个用于解析和操作ass字幕的python包
⚠️当前处于开发阶段,未经过严格测试
功能
✅ ScriptInfo、Styles、Events解析
✅ 大部分的覆写控制代码支持
✅ 字段类型,合法性检查
⬜ 绘图指令、方便的绘图支持(开发中)
⬜ C++内核实现 (计划)
安装
从 pip 中获取
pip install easyass
支持 python 3.7 及以上版本,没有额外的库依赖。
例子
from easyass import * # 引入 easyass 包
# 库不提供直接读取文件的api,需要自行读写
with open(r'test/test.ass', 'r', encoding='utf8') as fp: # 读一个 ass 文件
ass_str = fp.read()
ass_obj = Ass() # 创建一个 ass 实例
errs = ass_obj.parse(ass_str) # 解析 ass 文本
print(ass.script_info.Title) # 输出 title
ass_obj.script_info.Title = 'aabbcc' # 修改 title
print(ass_obj.styles[0].Name) # 获取第一条 styles 的名字
ass_obj.styles.append(StyleItem( # 添加一个 style 并指定其部分字段
Name='r2l',
Fontname='Microsoft YaHei',
Fontsize=30,
))
print(ass_obj.events[0].Start) # 获取第一条事件的开始时间
ass_obj.events[0].Text = 'good' # 修改第一条事件的文本
# 修改第一条事件的文本,并使用覆写代码
ass_obj.events[0].Text = Pos(1, 10) + 'good' + FontSize(size=30)
ass_obj.events[0].Text[0].x = 60 # 修改刚才添加的覆写代码中 Pos 的属性 x, 具体属性见 docstring
print(ass_obj.events[0].dump()) # 获取第一条事件的 ass 代码
lines, errs = ass_obj.dump()
with open(r'op.ass', 'w', encoding='utf8') as fp: # 修改后的ass写到文件
fp.write('\n'.join(lines)) # lines是一个字符串数组,包含每一行的内容
Metadata
Release files for easyass 1.0.0b12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easyass-1.0.0b12.tar.gz | 15.7 kB | Without provenance | Details for easyass-1.0.0b12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easyass-1.0.0b12-py3-none-any.whl | Python 3 | none | any | Details for easyass-1.0.0b12-py3-none-any.whl |
Total release size: 34.1 kB
Release files / easyass-1.0.0b12.tar.gz
| Download URL | easyass-1.0.0b12.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb95b8913eaf1c2ca45a487cced63cd03115591e95d86d33827a5c102d3ab937
|
|
BLAKE2b-256 checksum How to use checksums |
f244eaae7063617d1f0fe3ad40ccd56fbb3cea2833d2fd52da54229e423af969
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / easyass-1.0.0b12-py3-none-any.whl
| Download URL | easyass-1.0.0b12-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4df281d40ccc4acfc1ae1152c8e7efaf6da3dde50df609dc1ceef8a40febbbb9
|
|
BLAKE2b-256 checksum How to use checksums |
ca7998bbad1ca77b4362f25e0c1e054b9d913cbd3aa27621639c1a6563c781ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for easyass 1.0.0b12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.