colors and sort
This commit is contained in:
parent
1770544a59
commit
89918e141c
2 changed files with 17 additions and 6 deletions
|
@ -501,6 +501,10 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"id": "title",
|
"id": "title",
|
||||||
"title": "Title",
|
"title": "Title",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"additionalSort": [
|
||||||
|
{"key": "type", "operator": "+"},
|
||||||
|
{"key": "batch", "operator": "+"}
|
||||||
|
],
|
||||||
"autocomplete": true,
|
"autocomplete": true,
|
||||||
"autocompleteSort": [{"key": "timesaccessed", "operator": "-"}],
|
"autocompleteSort": [{"key": "timesaccessed", "operator": "-"}],
|
||||||
"columnRequired": true,
|
"columnRequired": true,
|
||||||
|
|
|
@ -20,7 +20,10 @@ def render_poster(data, poster):
|
||||||
if not director and "type" in data:
|
if not director and "type" in data:
|
||||||
director = ", ".join(data["type"])
|
director = ", ".join(data["type"])
|
||||||
if director == "Voice Over" and data.get("batch"):
|
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', ''))
|
year = str(data.get('year', ''))
|
||||||
series = data.get('isSeries', False)
|
series = data.get('isSeries', False)
|
||||||
oxdb_id = data['oxdbId']
|
oxdb_id = data['oxdbId']
|
||||||
|
@ -46,15 +49,15 @@ def render_poster(data, poster):
|
||||||
elif type == "voice over":
|
elif type == "voice over":
|
||||||
i = 300
|
i = 300
|
||||||
if '1-' in director:
|
if '1-' in director:
|
||||||
i - 320
|
i = 300
|
||||||
if '2-' in director:
|
if '2-' in director:
|
||||||
i - 340
|
i = 320
|
||||||
if '3-' in director:
|
if '3-' in director:
|
||||||
i - 360
|
i = 340
|
||||||
if '4-' in director:
|
if '4-' in director:
|
||||||
i - 380
|
i = 360
|
||||||
if '5-' in director:
|
if '5-' in director:
|
||||||
i - 490
|
i = 380
|
||||||
if i < 127:
|
if i < 127:
|
||||||
color = (127, i, 0)
|
color = (127, i, 0)
|
||||||
elif i < 254:
|
elif i < 254:
|
||||||
|
@ -100,6 +103,7 @@ def render_poster(data, poster):
|
||||||
frame_image = frame_image.crop((0, top, frame_width, top + frame_height))
|
frame_image = frame_image.crop((0, top, frame_width, top + frame_height))
|
||||||
poster_image.paste(frame_image, (0, 0))
|
poster_image.paste(frame_image, (0, 0))
|
||||||
|
|
||||||
|
|
||||||
# timeline
|
# timeline
|
||||||
timeline_width = poster_width
|
timeline_width = poster_width
|
||||||
timeline_height = 64
|
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))
|
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)
|
draw.rectangle([(0, text_top), (text_width, text_bottom)], fill=text_color)
|
||||||
offset_top = text_top + text_margin
|
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:
|
if not director:
|
||||||
title_max_lines = 7
|
title_max_lines = 7
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue