end-of-year poster py script, change of score/cover

This commit is contained in:
Wouter Groeneveld 2022-12-14 17:43:22 +01:00
parent 0b1dbb8131
commit 8f0ab079e8
6 changed files with 31 additions and 3 deletions

View File

@ -1,7 +1,7 @@
---
title: "Sylvester & Tweety: Breakfast on the Run"
date: 2022-04-13
score: 4
score: 3
howlongtobeat_id: 28627
howlongtobeat_hrs: 3
game_name: 'Looney Tunes: Twouble'

View File

@ -2,11 +2,10 @@
title: "Dexter Stardust: Adventures In Outer Space"
date: 2022-07-25
score: 4
howlongtobeat_id: 110341
howlongtobeat_hrs: 6
howlongtobeat_id: -1
game_name: "Dexter Stardust"
game_genre: "Adventure"
image: "/games/switch/dexter-stardust/dexter.jpg"
game_release_year: 2022
game_developer: 'Dexter Team Games'
tags:

View File

@ -0,0 +1,29 @@
import glob
import re
import os
def is_in_year(year, content):
return re.search(r"date:\s?\"?" + str(year) + "-", content) is not None
def end_of_year(year):
games = []
for name in glob.glob('../content/games/**/*.md'):
if not '/_index.md' in name:
with open(name) as file:
content = file.read()
if is_in_year(year, content):
parts = name.split('/')
games.append("../static/games/" + parts[-2] + "/" + parts[-1].replace(".md", "") + "/" + "cover.jpg")
return games
def montage(coverlist, year):
cmd = "montage " + " ".join(coverlist) + " -geometry +0+0 -tile 8x5 -resize 170x200! collage-" + str(year) + ".jpg"
os.system(cmd)
os.system("rm -rf *.jpg")
games_list = end_of_year(2021)
montage(games_list, 2021)
print(" -- done, see collage-[year].jpg")

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 32 KiB