AssTagAnalyzer
Tag analyzer for Advanced SubStation Alpha file. This tool allows to parse .ass tag and manipulate them.
Installation and Update
pip install ass-tag-analyzer
Example
from ass_tag_analyzer import parse_line, ass_item_to_text, Format, AssTagFontName, AssValidTagFontName, AssInvalidTagFontName
# Parse an .ass line
line = parse_line(r"{\an7\pos(158,501)\fnArial\bord0.155884}Example")
print(line)
# Convert line to text
print(ass_item_to_text(line))
# Change how to convert float to string
Format.format_float = lambda number: round(number)
# Reconvert line to text. See how the \bord result is different
print(ass_item_to_text(line))
# Search an tag
for ass_item in line:
if isinstance(ass_item, AssTagFontName):
if isinstance(ass_item, AssValidTagFontName):
print(f'An \\fn tag has been found and the value is "{ass_item.name}"')
elif isinstance(ass_item, AssInvalidTagFontName):
# You need to get the style that is applied on the line.
pass
Result
[
AssTagListOpening(),
AssValidTagAlignment(is_legacy_tag=False, _AssValidTagAlignment__alignment=<Alignment.TOP_LEFT: 7>),
AssValidTagPosition(x=158.0, y=501.0),
AssValidTagFontName(_AssValidTagFontName__name='Arial'),
AssValidTagBorder(_AssValidTagBorder__size=0.155884),
AssTagListEnding(),
AssText(text='Example')
]
{\an7\pos(158,501)\fnArial\bord0.156}Example
{\an7\pos(158,501)\fnArial\bord0}Example
An \fn tag has been found and the value is "Arial"
Dependencies
Acknowledgments
- ass_tag_parser I used his library to create mine. I got a lot of inspiration from his work.
Release files for ass-tag-analyzer 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ass_tag_analyzer-0.0.5.tar.gz | 18.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ass_tag_analyzer-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.8 kB
Release files / ass_tag_analyzer-0.0.5.tar.gz
| Download URL | ass_tag_analyzer-0.0.5.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d526d3bff70d6db1946b7c349e79b9fde87c7fc69348b438b3e8962989475814
|
|
BLAKE2b-256 checksum How to use checksums |
044694e82b85be4be8164ae14d53abfef24cec5013927e5578efa9bbdd829992
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / ass_tag_analyzer-0.0.5-py3-none-any.whl
| Download URL | ass_tag_analyzer-0.0.5-py3-none-any.whl |
|---|---|
| Size | 30.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c64535f4f58a767d59d581ef2394e525d3131870c7fc96510d7690bed89a03a8
|
|
BLAKE2b-256 checksum How to use checksums |
d3edcdc7578c496431d4bb1891f7dcc4ecb8a641b5c2adf6ef5a7b14013a6687
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|