From bf71af5744d71f1cb1c563ba68f32e5f43d43264 Mon Sep 17 00:00:00 2001 From: Jamie Hlusko <5944064+jhlusko@users.noreply.github.com> Date: Sun, 23 Aug 2026 17:47:05 -0400 Subject: [PATCH] Add OTS web editor links to catalogue --- build_catalogue.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build_catalogue.py b/build_catalogue.py index 82c73514..0d3cb572 100644 --- a/build_catalogue.py +++ b/build_catalogue.py @@ -22,16 +22,22 @@ of the script behaves identically regardless of which one is used. For each score we build download links for the .mscx, .mxl, and .pdf files, -using the pattern: +plus a link that opens the .mxl file in the OurTextScores web editor. Download +links use the pattern: https://github.com/OpenScore/StringQuartets/raw/refs/heads/main/scores//sq. """ import argparse import html from pathlib import Path +from urllib.parse import urlencode RAW_BASE = "https://github.com/OpenScore/StringQuartets/raw/refs/heads/main/scores" +RAW_CONTENT_BASE = ( + "https://raw.githubusercontent.com/OpenScore/StringQuartets/refs/heads/main/scores" +) IMSLP_BASE = "https://imslp.org/wiki/Special:ReverseLookup" +SCORE_EDITOR_BASE = "https://www.ourtextscores.com/score-editor/index.html" PART_NAMES = ["Violin_1", "Violin_2", "Viola", "Violoncello"] @@ -110,6 +116,8 @@ def build_rows(composers: dict, sets_: dict, scores: dict) -> list[dict]: mscx_url = f"{RAW_BASE}/{score_path}/sq{score_id}.mscx" mxl_url = f"{RAW_BASE}/{score_path}/sq{score_id}.mxl" pdf_url = f"{RAW_BASE}/{score_path}/sq{score_id}.pdf" + editor_score_url = f"{RAW_CONTENT_BASE}/{score_path}/sq{score_id}.mxl" + editor_url = f"{SCORE_EDITOR_BASE}?{urlencode({'score': editor_score_url})}" imslp_id = str(score.get("imslp", "")).lstrip("#").strip() imslp_url = f"{IMSLP_BASE}/{imslp_id}" if imslp_id else None @@ -128,6 +136,7 @@ def build_rows(composers: dict, sets_: dict, scores: dict) -> list[dict]: "mscx_url": mscx_url, "mxl_url": mxl_url, "pdf_url": pdf_url, + "editor_url": editor_url, "imslp_url": imslp_url, "part_urls": part_urls, } @@ -144,6 +153,7 @@ def render_row(row: dict) -> str: mscx_url = html.escape(row["mscx_url"], quote=True) mxl_url = html.escape(row["mxl_url"], quote=True) pdf_url = html.escape(row["pdf_url"], quote=True) + editor_url = html.escape(row["editor_url"], quote=True) files_cell = ( f'MuseScore; ' @@ -170,6 +180,7 @@ def render_row(row: dict) -> str: f"{files_cell}" f"{parts_cell}" f"{imslp_cell}" + f'Open in Web Editor' "" ) @@ -283,6 +294,7 @@ def render_row(row: dict) -> str: Score Files Part Files IMSLP + OTS Web Editor @@ -346,4 +358,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()