forked from 0x2620/pandora
improve indiancine.ma poster script (better ratio for small posters); update preview ratio
This commit is contained in:
parent
6d2b8f33e3
commit
808ae4c1da
2 changed files with 12 additions and 12 deletions
|
@ -863,7 +863,7 @@
|
||||||
"video": {
|
"video": {
|
||||||
"download": false,
|
"download": false,
|
||||||
"formats": ["webm", "mp4"],
|
"formats": ["webm", "mp4"],
|
||||||
"previewRatio": 1.7777777778,
|
"previewRatio": 1.375,
|
||||||
"resolutions": [240, 480]
|
"resolutions": [240, 480]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ static_root = os.path.join(os.path.dirname(__file__), 'data')
|
||||||
|
|
||||||
def render_poster(title, director, year, frame, timeline, poster):
|
def render_poster(title, director, year, frame, timeline, poster):
|
||||||
|
|
||||||
poster_width = 640
|
poster_width = 704
|
||||||
poster_height = 1024
|
poster_height = 1024
|
||||||
frame_height = 480
|
frame_height = 512
|
||||||
frame_ratio = poster_width / frame_height
|
frame_ratio = poster_width / frame_height
|
||||||
timeline_height = 64
|
timeline_height = 64
|
||||||
text_margin = 24
|
text_margin = 24
|
||||||
|
@ -30,7 +30,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
poster_image = Image.new('RGB', (poster_width, poster_height))
|
poster_image = Image.new('RGB', (poster_width, poster_height))
|
||||||
draw = ImageDraw.Draw(poster_image)
|
draw = ImageDraw.Draw(poster_image)
|
||||||
font_file = os.path.join(static_root, 'SourceSansProSemibold.ttf')
|
font_file = os.path.join(static_root, 'SourceSansProSemibold.ttf')
|
||||||
font_size = {'cinema': 107, 'director': 32, 'title': 48, 'year': 387}
|
font_size = {'cinema': 117, 'director': 32, 'title': 48, 'year': 426}
|
||||||
font_lightness = {'cinema': 0.7, 'director': 0.8, 'title': 0.8, 'year': 0.6}
|
font_lightness = {'cinema': 0.7, 'director': 0.8, 'title': 0.8, 'year': 0.6}
|
||||||
poster_lightness = {'image': 0.2, 'text': 0.4}
|
poster_lightness = {'image': 0.2, 'text': 0.4}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
if year:
|
if year:
|
||||||
drawText(
|
drawText(
|
||||||
poster_image,
|
poster_image,
|
||||||
(-84, poster_height - timeline_height - font_size['year'] + 6),
|
(-93, poster_height - timeline_height - font_size['year'] + 48),
|
||||||
year,
|
year,
|
||||||
font_file,
|
font_file,
|
||||||
font_size['year'],
|
font_size['year'],
|
||||||
|
@ -63,7 +63,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
for x in [-1, 1]:
|
for x in [-1, 1]:
|
||||||
drawText(
|
drawText(
|
||||||
poster_image,
|
poster_image,
|
||||||
(-10 + x, poster_height - timeline_height - font_size['cinema'] + 1 + y),
|
(-11 + x, poster_height - timeline_height - font_size['cinema'] + 1 + y),
|
||||||
'Indiancine.ma',
|
'Indiancine.ma',
|
||||||
font_file,
|
font_file,
|
||||||
font_size['cinema'],
|
font_size['cinema'],
|
||||||
|
@ -71,7 +71,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
)
|
)
|
||||||
drawText(
|
drawText(
|
||||||
poster_image,
|
poster_image,
|
||||||
(-10, poster_height - timeline_height - font_size['cinema'] + 1),
|
(-11, poster_height - timeline_height - font_size['cinema'] + 1),
|
||||||
'Indiancine.ma',
|
'Indiancine.ma',
|
||||||
font_file,
|
font_file,
|
||||||
font_size['cinema'],
|
font_size['cinema'],
|
||||||
|
@ -81,7 +81,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
# director and title
|
# director and title
|
||||||
offset_top = frame_height + text_margin
|
offset_top = frame_height + text_margin
|
||||||
if not director:
|
if not director:
|
||||||
title_max_lines = 8
|
title_max_lines = 7
|
||||||
else:
|
else:
|
||||||
title_max_lines = min(len(wrapText(
|
title_max_lines = min(len(wrapText(
|
||||||
title,
|
title,
|
||||||
|
@ -89,8 +89,8 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
0,
|
0,
|
||||||
font_file,
|
font_file,
|
||||||
font_size['title']
|
font_size['title']
|
||||||
)), 7)
|
)), 6)
|
||||||
director_max_lines = 11 - int((title_max_lines * 3 - 1) / 2)
|
director_max_lines = 9 - int((title_max_lines * 3 - 1) / 2)
|
||||||
|
|
||||||
# director
|
# director
|
||||||
if director:
|
if director:
|
||||||
|
@ -110,7 +110,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
font_size['director'],
|
font_size['director'],
|
||||||
getRGB((hue, saturation, font_lightness['director']))
|
getRGB((hue, saturation, font_lightness['director']))
|
||||||
)
|
)
|
||||||
offset_top += font_size['director'] + 2
|
offset_top += font_size['director'] + 4
|
||||||
offset_top += size[1] - font_size['director'] + 6
|
offset_top += size[1] - font_size['director'] + 6
|
||||||
|
|
||||||
# title
|
# title
|
||||||
|
@ -140,7 +140,7 @@ def render_poster(title, director, year, frame, timeline, poster):
|
||||||
font_size['title'],
|
font_size['title'],
|
||||||
getRGB((hue, saturation, font_lightness['title']))
|
getRGB((hue, saturation, font_lightness['title']))
|
||||||
)
|
)
|
||||||
offset_top += font_size['title'] + 3
|
offset_top += font_size['title'] + 6
|
||||||
|
|
||||||
# frame
|
# frame
|
||||||
if frame:
|
if frame:
|
||||||
|
|
Loading…
Reference in a new issue