From 89918e141cea25735b82d4dabfbbc7f153c57ae8 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 17 Nov 2023 17:33:33 +0100 Subject: [PATCH] colors and sort --- config.jsonc | 4 ++++ scripts/poster.py | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/config.jsonc b/config.jsonc index c27a6fa..3345434 100644 --- a/config.jsonc +++ b/config.jsonc @@ -501,6 +501,10 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "id": "title", "title": "Title", "type": "string", + "additionalSort": [ + {"key": "type", "operator": "+"}, + {"key": "batch", "operator": "+"} + ], "autocomplete": true, "autocompleteSort": [{"key": "timesaccessed", "operator": "-"}], "columnRequired": true, diff --git a/scripts/poster.py b/scripts/poster.py index e908bd9..8009319 100755 --- a/scripts/poster.py +++ b/scripts/poster.py @@ -20,7 +20,10 @@ def render_poster(data, poster): if not director and "type" in data: director = ", ".join(data["type"]) if director == "Voice Over" and data.get("batch"): - director = "%s (vo)" % ", ".join(data["batch"]) + director = "%s (vo)" % (", ".join(data["batch"])).replace('Text-', '') + vo = True + else: + vo = False year = str(data.get('year', '')) series = data.get('isSeries', False) oxdb_id = data['oxdbId'] @@ -46,15 +49,15 @@ def render_poster(data, poster): elif type == "voice over": i = 300 if '1-' in director: - i - 320 + i = 300 if '2-' in director: - i - 340 + i = 320 if '3-' in director: - i - 360 + i = 340 if '4-' in director: - i - 380 + i = 360 if '5-' in director: - i - 490 + i = 380 if i < 127: color = (127, i, 0) elif i < 254: @@ -100,6 +103,7 @@ def render_poster(data, poster): frame_image = frame_image.crop((0, top, frame_width, top + frame_height)) poster_image.paste(frame_image, (0, 0)) + # timeline timeline_width = poster_width timeline_height = 64 @@ -118,6 +122,9 @@ def render_poster(data, poster): font_color = tuple(map(lambda x: x - 128 if series else x + 128, text_color)) draw.rectangle([(0, text_top), (text_width, text_bottom)], fill=text_color) offset_top = text_top + text_margin + if vo: + vo_text = (" ".join(data["batch"])).replace("Text-", "") + drawText(poster_image, (0, 0), vo_text, font_file, 100, font_color) if not director: title_max_lines = 7 else: