From a53d41d1afca9306372f3061dd78bccad82a50d3 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 6 Jun 2013 18:49:48 +0200 Subject: [PATCH] update arsenalberlin poster script; some cosmetic changes --- scripts/poster.arsenalberlin.py | 44 ++++++++++++++++++++++++--------- scripts/poster.indiancinema.py | 3 +-- scripts/poster.pandora.py | 3 +-- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/scripts/poster.arsenalberlin.py b/scripts/poster.arsenalberlin.py index be8622aa..810e3947 100755 --- a/scripts/poster.arsenalberlin.py +++ b/scripts/poster.arsenalberlin.py @@ -23,9 +23,9 @@ static_root = os.path.join(os.path.dirname(__file__), 'data') def render_poster(data, poster): title = ox.decode_html(data.get('title', '')) - director = u', '.join(data.get('director', [])) - director = ox.decode_html(director) + director = ox.decode_html(u', '.join(data.get('director', []))) year = str(data.get('year', '')) + version = data.get('version') frame = data.get('frame') timeline = data.get('timeline') @@ -39,8 +39,8 @@ def render_poster(data, poster): poster_image = Image.new('RGB', (poster_width, poster_height)) draw = ImageDraw.Draw(poster_image) font_file = os.path.join(static_root, 'SourceSansProSemibold.ttf') - font_size = {'arsenal': 120, 'director': 32, 'title': 48, 'year': 426} - font_lightness = {'arsenal': 0.7, 'director': 0.8, 'title': 0.8, 'year': 0.6} + font_size = {'arsenal': 120, 'director': 32, 'title': 48, 'version': 24, 'year': 426} + font_lightness = {'arsenal': 0.7, 'director': 0.8, 'title': 0.8, 'version': 0.8, 'year': 0.6} poster_lightness = {'image': 0.2, 'text': 0.4} if year: @@ -73,7 +73,7 @@ def render_poster(data, poster): drawText( poster_image, (-9 + x, poster_height - timeline_height - font_size['arsenal'] + 1 + y), - 'Indiancine.ma', + 'arsenalberl.in', font_file, font_size['arsenal'], getRGB((hue, saturation, poster_lightness['text'])) @@ -81,16 +81,16 @@ def render_poster(data, poster): drawText( poster_image, (-9, poster_height - timeline_height - font_size['arsenal'] + 1), - 'Indiancine.ma', + 'arsenalberl.in', font_file, font_size['arsenal'], getRGB((hue, saturation, font_lightness['arsenal'])) ) - # director and title + # text offset_top = frame_height + text_margin if not director: - title_max_lines = 8 + title_max_lines = 7 else: title_max_lines = min(len(wrapText( title, @@ -98,8 +98,8 @@ def render_poster(data, poster): 0, font_file, font_size['title'] - )), 7) - director_max_lines = 11 - int((title_max_lines * 3 - 1) / 2) + )), 6) + director_max_lines = 10 - int((title_max_lines * 3 - 1) / 2) # director if director: @@ -151,7 +151,7 @@ def render_poster(data, poster): font_size['title'], getRGB((hue, saturation, poster_lightness['text'])) ) - drawText( + size = drawText( poster_image, (text_margin, offset_top), line, @@ -160,6 +160,28 @@ def render_poster(data, poster): getRGB((hue, saturation, font_lightness['title'])) ) offset_top += font_size['title'] + 3 + offset_top += size[1] - font_size['title'] + 3 + + # version + if version: + for y in [-1, 1]: + for x in [-1, 1]: + drawText( + poster_image, + (text_margin + x, offset_top + y), + version, + font_file, + font_size['version'], + getRGB((hue, saturation, poster_lightness['text'])) + ) + size = drawText( + poster_image, + (text_margin, offset_top), + version, + font_file, + font_size['version'], + getRGB((hue, saturation, font_lightness['title'])) + ) # frame if frame: diff --git a/scripts/poster.indiancinema.py b/scripts/poster.indiancinema.py index de936afa..64d39f50 100755 --- a/scripts/poster.indiancinema.py +++ b/scripts/poster.indiancinema.py @@ -23,8 +23,7 @@ static_root = os.path.join(os.path.dirname(__file__), 'data') def render_poster(data, poster): title = ox.decode_html(data.get('title', '')) - director = u', '.join(data.get('director', [])) - director = ox.decode_html(director) + director = ox.decode_html(u', '.join(data.get('director', []))) year = str(data.get('year', '')) frame = data.get('frame') timeline = data.get('timeline') diff --git a/scripts/poster.pandora.py b/scripts/poster.pandora.py index 9f8f6492..ff7b1321 100755 --- a/scripts/poster.pandora.py +++ b/scripts/poster.pandora.py @@ -23,8 +23,7 @@ static_root = os.path.join(os.path.dirname(__file__), 'data') def render_poster(data, poster): title = ox.decode_html(data.get('title', '')) - director = u', '.join(data.get('director', [])) - director = ox.decode_html(director) + director = ox.decode_html(u', '.join(data.get('director', []))) year = str(data.get('year', '')) series = data.get('isSeries', False) oxdb_id = data['oxdbId']