A simple lyric file parser
Project description
[WIP]lrcparser
A simple lyric file parser.
Why this parser?
Pros:
- ...
- Well, to be honest, there's no strong reasons.
Cons:
- Lack of tests
- Potential bugs that may screw your files up
- ...
...But if you have tried this library and think it useful...
then just keep using it, thank you for your support :)
Usage
[ti:test_lyric]
[al:TEST ~AVOIDING ERRORS~]
[by:283375]
[offset:250]
[00:00.02]Line 1
[00:00.28]Line 2
[00:02.83]Line 3
[00:28.33]Line 4 with translation | 一般大家都这么打翻译
[00:28.33]可惜我更喜欢换行
[00:28.33]你说得对,但是《lrcparser》是由……
[28:33.75]Line 6
from lrcparser import *
with open('example.lrc', 'r', encoding='utf-8') as lrc_file:
parsed = LrcParser.parse(lrc_file.read(), parse_translations=True)
offset, lrc_lines, attributes = parsed.values()
>>> offset
250
>>> lrc_lines
[
LrcLine(
start_time=LrcTime(0, 0, 20),
text=LrcText(LrcTextSegment(LrcTime(0, 0, 20), "Line 1")),
translations=None,
),
LrcLine(
start_time=LrcTime(0, 0, 280),
text=LrcText(LrcTextSegment(LrcTime(0, 0, 280), "Line 2")),
translations=None,
),
LrcLine(
start_time=LrcTime(0, 2, 830),
text=LrcText(LrcTextSegment(LrcTime(0, 2, 830), "Line 3")),
translations=None,
),
LrcLine(
start_time=LrcTime(0, 28, 330),
text=LrcText(
LrcTextSegment(LrcTime(0, 28, 330), "Line 4 with translation")
),
translations=[
LrcText(LrcTextSegment(LrcTime(0, 28, 330), "一般大家都这么打翻译")),
LrcText(LrcTextSegment(LrcTime(0, 28, 330), "可惜我更喜欢换行")),
LrcText(LrcTextSegment(LrcTime(0, 28, 330), "你说得对,但是《lrcparser》是由……")),
],
),
LrcLine(
start_time=LrcTime(28, 33, 750),
text=LrcText(LrcTextSegment(LrcTime(28, 33, 750), "Line 6")),
translations=None,
),
]
>>> attributes
{
"ti": "test_lyric",
"al": "TEST ~AVOIDING ERRORS~",
"by": "283375",
"offset": "250",
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lrcparser-0.1.2.tar.gz
(11.6 kB
view details)
Built Distribution
lrcparser-0.1.2-py3-none-any.whl
(10.8 kB
view details)
File details
Details for the file lrcparser-0.1.2.tar.gz
.
File metadata
- Download URL: lrcparser-0.1.2.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 325488efefaa553475b44454e71f8efb94aa2016fbec4ebad58fc46d411be0f6 |
|
MD5 | cb3aa2126c3f1c9d1afc708d97b432fc |
|
BLAKE2b-256 | 7fff6b8baea39917bfc4b3c3f2a52e22d324e6bb6dd0dff099909630d3855f7e |
File details
Details for the file lrcparser-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: lrcparser-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee20b12855cc31b9d3f2e3bbeb9a96d2fbf62285b374b01e0e69d83d0c7037c7 |
|
MD5 | 868f73dfda18e834e3eeb2a84d01ca5d |
|
BLAKE2b-256 | 4325993bedc5df1f4ece34fac2d870df32072e6dbbfe70790d1317227e110d96 |