Skip to main content

songbook and songsheet management for songsheets in ukedown format

Project description

udn-songbook

What'cha talkin' about, Willis?

udn-songbook is a class-based abstraction of a songbook, using the ukedown rendering engine. Long-term it is intended to replace most of the code from the ukebook-md tools.

It supports a number of different profiles (combinations of on/off flags really) and can produce indexed PDF songbooks from a colleciton of files in ukedown format.

Requirements

Python packages

  • ukedown (markdown extensions)
  • weasyprint (PDF generation)
  • pychord (chord management)

development requirements - for future project enhancements

  • python-fretboard (chord generation)

The TL;DR

How to use the current functionality

Load a single songsheet and inspect it

from udn_songbook import Song
s = song('/path/to/filename')

# list the unique chords in the song
s.chords

# save it to disk
s.save(outputfile)

# transpose by an arbitrary number of semitones
s.transpose(semitones)

# generate a PDF from the current song, using built-in templates
s.pdf()

Build a book from a directory (or multiple directories) of UDN-format songsheets

from udn_songbook import SongBook
mybook = SongBook(inputs=['directory1', 'directory2', 'someotherfile.udn'])

Songbooks have an index auto-generated, and do not support mutiple songs with the same ID (which is essentially "Title - Artist").

If your inputs include multiple songs in this way, the last one imported will be used. So name them carefully.

A Songbook in this context is a collection of song objects with additional metadata, such as an index.

Tools

The pip package also installs some commandline tools, aimed at managing individual songsheets:

udn_transpose, which allows in-place (or optionally to a new file) transposing of an existing songsheet by an arbitrary number of semitones. The transposition is added to metadata

udn_songsheet, which renders a UDN songsheet to a file in either PDF (default) or HTML format. it also supports in-place transposition, without affecting the original input file.

udn_pdfbook - build a songbook and render it as a PDF file.

Profile and custom chord support

Profiles control the optional elements in song templates (chords, band notes, chord diagrams etc.)

A default set is defined in the defaults.toml file contained in this package. You can also pass additional configuration files in dynaconf TOML format, or define/update your settings in your ~/.config/udn_songbook/settings.toml file

Available profile settings

the "default" profile has all of these defined with comments:

[profile.default]
# show chord diagrams
diagrams = false
# show performance notes
notes = true
# show inline chords
chords = true
# show singer notes
singer_notes = true
# add writer credits to footer
credits = true
# show capo position to play in original key
capo = false
# which stylesheet applies
stylesheet = "portrait"

Chord names and pychord

pychord is quite opinionated about its chord names (or "qualities") and will reject some fairly common chord variations/voicings. You can define your own in your configuration file, also.

Here are the custom definitions in the default settings:

[chordtypes]
# define custom chord "types" here. A custom chord "quality" (as pychord calls them)
# is a list of numbered scale tones from a chromatic scale, starting at 0 for the root.
# these are semitones from root(0) upwards
# A standard major scale consits of these intervals: 0,2,4,5,7,9,11
# so 0, 4, 7, 8 is actually 1, 3, 5, b6 in scale tones.
# mapping the C major scale as an example:
# semitones: 0 1  2 3  4 5 6  7 8  9 10 11 12
# note:      C C# D Eb E F F# G G# A Bb B  C
# scale:     1    2    3 4    5    6    7  8
# A major chord (1, 3, 5 in scale tones) -> (0, 4, 7) in semitones
# and minor (1, b3, 5) -> (0, 3, 7) etc.
addb6 = [0, 4, 7, 8]
6sus2 = [0, 2, 7, 9]
7sus2 = [0, 2, 7, 10]
"add#11" = [0, 4, 7, 18]

what you need to use this:

  • a directory full of UDN-format files.
  • templates:
    • index.html.j2
    • song.html.j2
  • stylesheets (up to you, you can pass their names and location to the methods)
    • pdf.css
    • ukedown.css

The package has built-in templates, which use the MS Verdana font by default, so you'll want that, or of course you can change the stylesheets accordingly.

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

udn_songbook-1.5.6.tar.gz (163.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

udn_songbook-1.5.6-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file udn_songbook-1.5.6.tar.gz.

File metadata

  • Download URL: udn_songbook-1.5.6.tar.gz
  • Upload date:
  • Size: 163.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for udn_songbook-1.5.6.tar.gz
Algorithm Hash digest
SHA256 12e4323f93d1b3fd24796aad08492ef6803c28c8eabbb78613932d4cc103f7c0
MD5 0f38cfe31c871139ad703ba472714142
BLAKE2b-256 f8d9cca9ff4e1d427f795880721cee90e82db1916aaddd4e62020d546817831f

See more details on using hashes here.

Provenance

The following attestation bundles were made for udn_songbook-1.5.6.tar.gz:

Publisher: release.yml on lanky/udn-songbook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file udn_songbook-1.5.6-py3-none-any.whl.

File metadata

  • Download URL: udn_songbook-1.5.6-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for udn_songbook-1.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4850e30d1eb3abc152b9b4e039bed267dba09b9c0642e734090e5726643bcd3d
MD5 1a9fe845013b97cfc26b9e5578377e85
BLAKE2b-256 8a3f47cad79521ee64e606eb9506449986d9faf75e933a8e383e8e444d093848

See more details on using hashes here.

Provenance

The following attestation bundles were made for udn_songbook-1.5.6-py3-none-any.whl:

Publisher: release.yml on lanky/udn-songbook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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