Skip to main content

A small example package

Project description

[WIP]lrcparser

A simple parser to parse lrc files.

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


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.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

lrcparser-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file lrcparser-0.1.1.tar.gz.

File metadata

  • Download URL: lrcparser-0.1.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for lrcparser-0.1.1.tar.gz
Algorithm Hash digest
SHA256 552a005c2ed51ef009fe4e861333316787366df4db41a4b0e535a7fd456624ab
MD5 e50f6e1f1dd3aea78d35d8d0e4d614bc
BLAKE2b-256 4b9805fdb32c9f76b39b48d81de538c9ee4bbcbfb59b61fb4f039cfcc617a718

See more details on using hashes here.

File details

Details for the file lrcparser-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lrcparser-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for lrcparser-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c54c23aeff94b74683cdca5484218243207a106fad8fc23b7c712c9c9eff5e05
MD5 0c9e3a967803f8bf9e7754235d71345a
BLAKE2b-256 0c07638b9238a8623114b494331720d45e9ddad6bf414ee9a10bbfbdd5753309

See more details on using hashes here.

Supported by

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