Added tune previews
This commit is contained in:
@@ -18,7 +18,7 @@ RenderResult = Result[Path, list[RenderError]]
|
||||
class RenderOutput(enum.Enum):
|
||||
PDF = "pdf"
|
||||
PNG_CROPPED = "png-cropped"
|
||||
PNG_PREVIEW = "png-preview"
|
||||
PREVIEW = "preview"
|
||||
|
||||
|
||||
async def render(
|
||||
@@ -61,16 +61,16 @@ async def render_file(
|
||||
]
|
||||
output_file = output_file.with_suffix(".cropped.png")
|
||||
# output_file = output_file.with_suffix(".png")
|
||||
case RenderOutput.PNG_PREVIEW:
|
||||
case RenderOutput.PREVIEW:
|
||||
command = [
|
||||
"lilypond",
|
||||
"-f", "png",
|
||||
"-f", "svg",
|
||||
"-dpreview=#t",
|
||||
"-dno-print-pages",
|
||||
"-o", str(output_file),
|
||||
str(input_file)
|
||||
]
|
||||
output_file = output_file.with_suffix(".preview.png")
|
||||
output_file = output_file.with_suffix(".preview.svg")
|
||||
|
||||
proc = await asyncio.create_subprocess_exec(
|
||||
*command,
|
||||
|
||||
@@ -11,6 +11,13 @@ def tune_source(tune: LilypondTune) -> str:
|
||||
)
|
||||
|
||||
|
||||
def preview_source(tune: LilypondTune) -> str:
|
||||
return templates.get_template("lilypond/preview.ly").render(
|
||||
score_beginning=SCORE_BEGINNING,
|
||||
tune=tune,
|
||||
)
|
||||
|
||||
|
||||
def set_source(tune_set: LilypondSet) -> str:
|
||||
return templates.get_template("lilypond/tune_set.ly").render(
|
||||
score_beginning=SCORE_BEGINNING,
|
||||
|
||||
Reference in New Issue
Block a user