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. In the end, you should be able to take the code from here and create (and render) songbooks with it, producing PDFs and/or HTML (and possibly other formats, if I add them).

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

(it only does basic things at the moment)

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()

And to build a songbook, use the SongBook class, with a directory 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 2 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.

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

CHANGELOG for udn_songbook

This project attempts to adhere to semantic versioning

1.3.0

  • Add dynaconf and profile support
  • Docstrings everywhere
  • move to pathlib whereever possible
  • move to f-strings rather than str.format

1.2.0

  • Add support for singers notes to template
  • Add style (.singer) for singers' notes
  • Docstringi, type hints and other linting updates
  • Switch to ruff for python pre-commit, update versions
  • remove unhelpful self._filename override
  • Force normal font-style on elements inside backing vox

1.1.8

  • Fix template for index generation
  • Add latest CSS from ukebook-md
  • Fix singers options in makesheet
  • Unpunctuate song._index_entry for better sorting
  • Rename default stylesheet to 'portrait.css'

1.1.7

  • README updated with new udn_songbook.Song features

  • BUGFIX: default metadata to empty dict if not present in songsheet

  • BUGFIX: use absolute import for Song in transpose.py

1.1.6

  • Adds README to project files for PyPi

1.1.5

  • rename udn_render to udn_songsheet (script entry point)
  • BUGFIX: stop wiping metadata after parsing songsheets

1.1.4

  • support more than 100 songs in a songbook
  • move tools into udn_songbook/tools
  • new rendering tool
  • update templates to support standalone songsheets (no footer links)
  • BUGFIX: transpose no longer removes content after last chord.

1.1.3

  • add scripts to project files
  • add PDF rendering code
  • move to pathlib.Path for filenames
  • add udn_transpose entry point for transposing tool
  • UNIX-safe chordnames
  • template support for pychord.Chord objects

1.1.2

  • dependency and documentation updates
  • add license

1.1.1

  • more sane boolean template vars
  • new kwargs for templates (song & index)
  • updated dependencies (new versions of blck/click/weasyprint etc)

1.1.0

  • add page IDs
  • adds rendering code & template for songs
  • use pychord for chord naming
  • add transposition code using pychord
  • fix chord parsing to handle 'tails' like '*'
  • page numbering and content deduplication

1.0.4

  • require python >= 3.8

1.0.3

  • dependency updates
    • Adds LXML dependency
    • python >= 3.7
  • black-formatted
  • adds pre-commit checks (black, flake8)
  • adds index template

1.0.2

  • update dependencies for PyYAML (5 or greater)

1.0.1

  • update dependencies for newer versions of
    • BeautifulSoup4 4.9.3 to 5
    • ukedown v2-3
    • Markdown v3-4

1.0.0

  • Initial Release (limited functionality)
  • creates Song and SongBook objects from directories and files.
  • Generates Index

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.4.0.tar.gz (35.1 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.4.0-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: udn_songbook-1.4.0.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for udn_songbook-1.4.0.tar.gz
Algorithm Hash digest
SHA256 b73eb5803e23ddf6d2e3a9bc044e8030b9c392413e5047b364eb92b836c98c1b
MD5 597e76555625af9b2c56592dcf32105c
BLAKE2b-256 5f1e40454f126063e42591f8dd121527cfe962a45b3ced6f078052d261012225

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for udn_songbook-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef27f8a9b00d7145e902a39b1bbd2ebe2e01512ae65647fec8c4ecb4956d0415
MD5 0b08787cb77e1ebe73fdb800fd109f53
BLAKE2b-256 5fda38889ab8f3b15b6ed18fa7cc214f35096399a7b9491874bd79ef85e72c4f

See more details on using hashes here.

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