Skip to content

Cycloctane/pylibcue

Repository files navigation

pylibcue

pylibcue is a CUE sheet parser library for python. It provides fast and reliable CUE sheets parsing interfaces for python by wrapping libcue C library with Cython.

Note: since v0.2.1, pylibcue uses libcue fork with custom patches (Cycloctane/libcue) instead of original libcue to provide additional bugfixes and features.

Install

pip install pylibcue

Compile from source

Requirements: bison, flex, make.

Clone the repo with --recurse-submodules argument.

pip install --upgrade setuptools Cython build
make test
make

Usage

Create a CD instance by parsing a CUE sheet file or string:

import pylibcue

cd = pylibcue.parse_file("./example.cue", encoding="utf-8")
# or
cd = pylibcue.parse_str("...")

Extract CD metadata and iterate through tracks in CD:

print("Title:", cd.cdtext.title)
print("Artist:", cd.cdtext.performer)
print("Date:", cd.rem.date)
print("Tracks:")

for tr in cd:
    print(f"TRACK {tr.track_number:02d}: {tr.cdtext.title} - {tr.cdtext.performer}")

cueprint

pylibcue also provides a command line tool cueprint.py to dump all information from CUE sheet. (python version of cuetools cueprint and cuebreakpoints)

Use cueprint.py to see how many fields pylibcue can extract from CUE sheet:

cueprint.py ./example.cue
# or
python3 -m pylibcue.cueprint ./example.cue

License

pylibcue is licensed under the GNU General Public License v2.0.