songleaf.tools¶
The single source of truth for every surface: plain functions, flat arguments, JSON-ready results.
The CLI (python -m songleaf) is cw over TOOLS. Nothing here
knows about any surface. sources, store and renderer are the seams:
library callers pass them, the CLI hides them. Code that wants objects rather
than dicts uses songleaf.sources, songleaf.store and
songleaf.render directly.
Module Attributes
Every operation, in the order the CLI lists them. |
Functions
|
Find songs: fuzzy title and artist ( |
|
Make a one-page song sheet (PDF) for the best match of |
|
The keys of the stored songs. |
- songleaf.tools.TOOLS = (<function search>, <function sheet>, <function songs>)¶
Every operation, in the order the CLI lists them.
- songleaf.tools.search(query='', *, title='', artist='', lyrics='', limit=10, sources=None)[source]¶
Find songs: fuzzy title and artist (
query), or by title, artist, or whole words of the lyrics.
- songleaf.tools.sheet(query, *, output='', pick=1, refresh=False, layout='dense', sources=None, store=None, renderer=None)[source]¶
Make a one-page song sheet (PDF) for the best match of
query.querymay also be a song key, assearchandsongsshow them (kaggle_chords:1234): a stored song renders without searching, and the key of a known source is fetched from it directly.pickchooses the n-th best match instead of the best. The song is saved to the store;refreshfetches it from its source again, replacing the stored copy. The PDF goes tooutput, by default thesheetsdata directory.layoutisdense(the default), or options joined with+:overlap(chords over the words themselves),inline(chords in the line, before their syllable),packed(rows break where the lyrics do),two-column,shaded(sections, repeated lines and chord functions); for exampleinline+packed+two-column. Arendererdecides the layout itself, so it does not go withlayout.- Return type: