Skip to main content

ass_tag_parser

Build

A Python library for serialization and deserialization of ASS subtitle file format tags markup.

Not to confuse with parsing .ass files that can be manipulated with ass_parser.

Example:

from ass_tag_parser import parse_ass


result = parse_ass(
    r"{\an5\pos(175,460)\fnUtopia with Oldstyle figures\fs90\bord0\blur3"
    r"\1c&H131313&\t(0,1000,2,\1c&H131340&)\t(1000,2000,\1c&H1015B2&"
    r"\blur1.4)}Attack No. 1{NOTE:アタックNo.1}"
)
print(result)
print(result[2].meta)

Result:

[
    AssTagListOpening(),
    AssTagAlignment(alignment=5, legacy=False),
    AssTagPosition(x=175.0, y=460.0),
    AssTagFontName(name="Utopia with Oldstyle figures"),
    AssTagFontSize(size=90.0),
    AssTagBorder(size=0.0),
    AssTagBlurEdgesGauss(weight=3.0),
    AssTagColor(red=19, green=19, blue=19, target=1, short=False),
    AssTagAnimation(
        tags=[AssTagColor(red=64, green=19, blue=19, target=1, short=False)],
        time1=0.0,
        time2=1000.0,
        acceleration=2.0,
    ),
    AssTagAnimation(
        tags=[
            AssTagColor(red=178, green=21, blue=16, target=1, short=False),
            AssTagBlurEdgesGauss(weight=1.4),
        ],
        time1=1000.0,
        time2=2000.0,
        acceleration=None,
    ),
    AssTagListEnding(),
    AssText(text="Attack No. 1"),
    AssTagListOpening(),
    AssTagComment(text="NOTE:アタックNo.1"),
    AssTagListEnding(),
]
Meta(start=5, end=18, text="\\pos(175,460)")

Starting from version 2.2, drawing commands are parsed automatically.


Serializing the tree back

ASS tree: compose_ass. Note that you don't need to supply AssTagListOpening nor AssTagListEnding tags in the input item list – this function inserts them automatically.

Draw commands: compose_draw_commands.

Contributing

# Clone the repository:
git clone https://github.com/bubblesub/ass_tag_parser.git
cd ass_tag_parser

# Install to a local venv:
poetry install

# Install pre-commit hooks:
poetry run pre-commit install

# Enter the venv:
poetry shell

This project uses poetry for packaging, install instructions at poetry#installation

Metadata

Release files for ass-tag-parser 2.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ass-tag-parser 2.4.1
File Size Uploaded
ass_tag_parser-2.4.1.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ass-tag-parser 2.4.1
File Interpreter ABI Platform
ass_tag_parser-2.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 47.0 kB

Release files / ass_tag_parser-2.4.1.tar.gz

Download URL ass_tag_parser-2.4.1.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1f78b7f6f9f69e769d9fc87a977f0986534b65fa816c41016b80794c785102f7
BLAKE2b-256 checksum
How to use checksums
b75e8c1fd54d09efc82184600ca4167f218c337c23b2ce2ade42420ca002cd42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Linux/5.16.12-arch1-1

Release files / ass_tag_parser-2.4.1-py3-none-any.whl

Download URL ass_tag_parser-2.4.1-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cc3a5858c31fd781dad6e8d613f3212d8fd9a10d08356ba5797c2b8533ca439
BLAKE2b-256 checksum
How to use checksums
744233b7852ac6a9ec5fd31f96dd0360c3b23c9e6d34c0d8eb00d32fe319afba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.4 Linux/5.16.12-arch1-1

Release history Release notifications | RSS feed

This release

2.4.1 This release

2 release files

2.4

1 release file

2.3.2.1

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3

1 release file

2.2

1 release file

2.1

1 release file

2.0

1 release file

1.0

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page