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.5.tar.gz (86.5 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.5-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: udn_songbook-1.5.5.tar.gz
  • Upload date:
  • Size: 86.5 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.5.tar.gz
Algorithm Hash digest
SHA256 6201acc33367b47aa7712fa41e19da745465ef3ff0e832af2de528d12180de9d
MD5 d7a9885678c5086638a3d906bbc83247
BLAKE2b-256 fd28420a446868c99b73184cfcc45200a7b6f674c7dc9e19f064f6c98d35ad86

See more details on using hashes here.

Provenance

The following attestation bundles were made for udn_songbook-1.5.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: udn_songbook-1.5.5-py3-none-any.whl
  • Upload date:
  • Size: 46.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a68528826dd919533b1295e182502fc292513228aa6d92e1ddc9319ca46c7fef
MD5 27996b95ad7845e49dcfd0eae880f66f
BLAKE2b-256 5dc216e66d866a1a4005f2c982f8a68bf4c992f315b654b94dc443a60376f03c

See more details on using hashes here.

Provenance

The following attestation bundles were made for udn_songbook-1.5.5-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