colors and sort

This commit is contained in:
j 2023-11-17 17:33:33 +01:00
parent 1770544a59
commit 89918e141c
2 changed files with 17 additions and 6 deletions

View File

@ -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,

View File

@ -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: