From 0fb58f41a59f9527788905b7e38a02cc283193cd Mon Sep 17 00:00:00 2001 From: Jack MB Date: Mon, 20 Jan 2025 17:33:37 +0100 Subject: [PATCH] bugfix residency and guest show artwork template on regeneration --- pages/api/automated-artwork.tsx | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/pages/api/automated-artwork.tsx b/pages/api/automated-artwork.tsx index 3e31581..6c6ceda 100644 --- a/pages/api/automated-artwork.tsx +++ b/pages/api/automated-artwork.tsx @@ -26,15 +26,35 @@ async function handle(request: Request) { return transformedUrl; }); - let title = searchParams.get("title") || "Guest Show w/ Yāri"; - title = title.replace(/w\/.*/, "").trim(); - - const artists = searchParams.get("artists") || "Moehecan"; + // get data from params + let title = searchParams.get("title") || "Steve Bicknell"; + let artists = searchParams.get("artists") || "Residency"; const date = searchParams.get("date") || "Thu 12 Sep / 15:00-16:00 (CET)"; const colour = searchParams.get("colour") || "#00CB0D"; - const isResidency = title.toLowerCase() === "residency"; - const isGuestShow = title.toLowerCase() === "guest show"; + // remove w/ from title if present + title = title.replace(/w\/.*/, "").trim(); + + // check if its residency or guest show as artwork template is slightly different + let isResidency = title.toLowerCase() === "residency"; + let isGuestShow = title.toLowerCase() === "guest show"; + + // swap title and artists if its residency and regeneration artwork + // this because title comes is as name of artist | residency + // which is different from all other shows where artists come after first pipe on regeneration + if (artists.toLowerCase().includes("residency")) { + isResidency = true; + const tempArtists = artists; + artists = title; + title = tempArtists; + } + + if (artists.toLowerCase().includes("guest show")) { + isGuestShow = true; + const tempArtists = artists; + artists = title; + title = tempArtists; + } const fontLight = await fetch( new URL("../../assets/VisueltLight.otf", import.meta.url)