backend.pdf.generator

PDF setlist generator.

Renders a printable two-column setlist as a PDF using ReportLab. Singer-specific colours, live-mode annotations (inserted / skipped songs, feedback ratings) and a per-page schedule are included automatically.

class backend.pdf.generator.SetlistPDF(gig, schedule, singer_colors, style_mode='dark')[Quellcode]

Bases: object

Two-column PDF setlist renderer for a single gig.

The rendered document contains:

  • A header with gig name, date, timestamp and singer colour legend.

  • One column per two sets laid out side by side.

  • Per-song start times derived from the pre-computed schedule.

  • Live-mode annotations: [NEU] prefix for inserted songs, strikethrough for skipped songs, and [o] / [+] / [++] feedback markers.

  • Page numbers (Seite X/Y) in the bottom-right corner.

Parameter:
  • gig (Gig) – The gig to render.

  • schedule (dict[int, list[datetime]]) – Pre-computed start times per set position, as returned by calc_schedule().

  • singer_colors (dict[str, str]) – Mapping of first-name → hex colour string used to colour-code lead-singer names.

FONT = 'Helvetica'
FONT_SIZE = 8
COLS = 2
COL_WIDTH = 260
X_BASES = [40, 320]
Y_START = 124
Y_STEP = 15
Y_LIMIT = 800
PALETTES = {'dark': {'bg': Color(.043137,.070588,.12549,1), 'card': Color(.066667,.094118,.152941,1), 'comment': Color(.992157,.729412,.454902,1), 'line': Color(.486275,.227451,.086275,1), 'muted': Color(.580392,.639216,.721569,1), 'primary': Color(.976471,.45098,.086275,1), 'set_header_bg': Color(.168627,.101961,.062745,1), 'text': Color(.886275,.909804,.941176,1), 'warning': Color(.984314,.572549,.235294,1)}, 'print': {'bg': Color(1,1,1,1), 'card': Color(1,1,1,1), 'comment': Color(.760784,.254902,.047059,1), 'line': Color(.819608,.835294,.858824,1), 'muted': Color(.294118,.333333,.388235,1), 'primary': Color(.917647,.345098,.047059,1), 'set_header_bg': Color(1,.929412,.835294,1), 'text': Color(0,0,0,1), 'warning': Color(.917647,.345098,.047059,1)}}
build()[Quellcode]

Render the setlist to an in-memory PDF and return it.

Verursacht:

Any ReportLab exception propagates to the caller.

Rückgabe:

A buffer positioned at offset 0 containing the complete PDF document.

Rückgabetyp:

BytesIO