moved to dosgame.club masto instance
This commit is contained in:
parent
8f0ab079e8
commit
1175d6c1a9
|
@ -14,3 +14,5 @@ static/_pagefind
|
||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
!.yarn/sdks
|
!.yarn/sdks
|
||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
|
|
||||||
|
extras/*.jpg
|
||||||
|
|
|
@ -16,8 +16,8 @@ paginate = 20
|
||||||
[Author]
|
[Author]
|
||||||
name = "Jefklak"
|
name = "Jefklak"
|
||||||
email = "jef@jefklakscodex.com"
|
email = "jef@jefklakscodex.com"
|
||||||
mastodon = "@wouter@chat.brainbaking.com"
|
mastodon = "@jefklak@dosgame.club"
|
||||||
mastodonlink = "https://chat.brainbaking.com/@wouter"
|
mastodonlink = "https://dosgame.club/@jefklak"
|
||||||
githublink = "https://github.com/wgroeneveld"
|
githublink = "https://github.com/wgroeneveld"
|
||||||
|
|
||||||
# added since Hugo 0.9x to allow babel to be executed
|
# added since Hugo 0.9x to allow babel to be executed
|
||||||
|
|
|
@ -1,4 +1,32 @@
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"author": {
|
||||||
|
"name": "Wouter Groeneveld",
|
||||||
|
"picture": "/pictures/brainbaking.com"
|
||||||
|
},
|
||||||
|
"name": "My Personal Game Of The Year Awards",
|
||||||
|
"content": "The yearly Game Of The Year (GOTY) voting threads are starting to pop up everywhere, I think I might even be quite late to the party! As a retro gamer, GOTY lists merely amuse me, and the ones coming up on top are usually big budget AAA games that ra...",
|
||||||
|
"published": "2022-12-14T00:00:00+00:00",
|
||||||
|
"url": "https://brainbaking.com/post/2022/12/my-personal-game-of-the-year-awards/",
|
||||||
|
"type": "mention",
|
||||||
|
"source": "https://brainbaking.com/post/2022/12/my-personal-game-of-the-year-awards/",
|
||||||
|
"target": "https://jefklakscodex.com/",
|
||||||
|
"relativeTarget": "/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"author": {
|
||||||
|
"name": "Wouter Groeneveld",
|
||||||
|
"picture": "/pictures/brainbaking.com"
|
||||||
|
},
|
||||||
|
"name": "My Personal Game Of The Year Awards",
|
||||||
|
"content": "The yearly Game Of The Year (GOTY) voting threads are starting to pop up everywhere, I think I might even be quite late to the party! As a retro gamer, GOTY lists merely amuse me, and the ones coming up on top are usually big budget AAA games that ra...",
|
||||||
|
"published": "2022-12-14T00:00:00+00:00",
|
||||||
|
"url": "https://brainbaking.com/post/2022/12/my-personal-game-of-the-year-awards/",
|
||||||
|
"type": "mention",
|
||||||
|
"source": "https://brainbaking.com/post/2022/12/my-personal-game-of-the-year-awards/",
|
||||||
|
"target": "https://jefklakscodex.com/games/",
|
||||||
|
"relativeTarget": "/games/"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Wouter Groeneveld",
|
"name": "Wouter Groeneveld",
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import sys
|
||||||
|
|
||||||
def is_in_year(year, content):
|
def is_in_year(year, content):
|
||||||
return re.search(r"date:\s?\"?" + str(year) + "-", content) is not None
|
return re.search(r"date:\s?\"?" + str(year) + "-", content) is not None
|
||||||
|
@ -14,16 +16,78 @@ def end_of_year(year):
|
||||||
content = file.read()
|
content = file.read()
|
||||||
|
|
||||||
if is_in_year(year, content):
|
if is_in_year(year, content):
|
||||||
parts = name.split('/')
|
games.append(to_game_entry(content, name))
|
||||||
games.append("../static/games/" + parts[-2] + "/" + parts[-1].replace(".md", "") + "/" + "cover.jpg")
|
|
||||||
|
|
||||||
return games
|
return games
|
||||||
|
|
||||||
def montage(coverlist, year):
|
def to_game_entry(content, name):
|
||||||
cmd = "montage " + " ".join(coverlist) + " -geometry +0+0 -tile 8x5 -resize 170x200! collage-" + str(year) + ".jpg"
|
parts = name.split('/')
|
||||||
|
game_name = parts[-1].replace(".md", "")
|
||||||
|
game_platform = parts[-2]
|
||||||
|
cover = "../static/games/" + game_platform + "/" + game_name + "/" + "cover.jpg"
|
||||||
|
|
||||||
|
def pry_out(key, defval):
|
||||||
|
val = re.search(key + r":\s?(.*)", content)
|
||||||
|
if val is None:
|
||||||
|
return defval
|
||||||
|
if type(defval) is float:
|
||||||
|
return float(val.group(1))
|
||||||
|
if type(defval) is int:
|
||||||
|
return int(val.group(1))
|
||||||
|
return val.group(1).replace("\"", "")
|
||||||
|
|
||||||
|
return { "cover": cover, "hltb": pry_out("howlongtobeat_hrs", 0.0), "name": pry_out("game_name", ""), "platform": game_platform, "score": pry_out("score", 0) }
|
||||||
|
|
||||||
|
def montage(games_list, year):
|
||||||
|
coverlist = list(map(lambda game: game["cover"], games_list))
|
||||||
|
file = "collage-" + str(year) + ".jpg"
|
||||||
|
|
||||||
|
cmd = "montage " + " ".join(coverlist) + " -geometry +0+0 -tile 8x5 -resize 170x200! " + file
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
os.system("open " + file)
|
||||||
|
|
||||||
|
def print_stats(games_list):
|
||||||
|
games_list = sorted(games_list, key=lambda game: game["hltb"])
|
||||||
|
total_hours = sum(list(map(lambda game: game["hltb"], games_list)))
|
||||||
|
|
||||||
|
print(" -- total hours: " + str(total_hours))
|
||||||
|
print(" -- average hours: " + str(round(total_hours / len(games_list), 2)))
|
||||||
|
print(" -- average a day: " + str(round(total_hours / 355, 2)))
|
||||||
|
print()
|
||||||
|
|
||||||
|
print(" -- longest game: " + str(games_list[-1]["hltb"]) + " hours; " + games_list[-1]["name"])
|
||||||
|
print(" -- shortest game: " + str(games_list[0]["hltb"]) + " hours; " + games_list[0]["name"])
|
||||||
|
print()
|
||||||
|
|
||||||
|
per_platform = {}
|
||||||
|
for game in games_list:
|
||||||
|
if game["platform"] not in per_platform:
|
||||||
|
per_platform[game["platform"]] = [game]
|
||||||
|
else:
|
||||||
|
per_platform[game["platform"]].append(game)
|
||||||
|
|
||||||
|
for k, v in per_platform.items():
|
||||||
|
print(" -- Platform: " + k + " (" + str(len(v)) + "/" + str(len(games_list)) + ")")
|
||||||
|
|
||||||
|
|
||||||
|
def generate_chart(games_list):
|
||||||
|
x = list(map(lambda g: g["name"], games_list))
|
||||||
|
y = list(map(lambda g: g["score"], games_list))
|
||||||
|
|
||||||
|
plt.plot(x, y)
|
||||||
|
plt.xticks(rotation = 90)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
if len(sys.argv) <= 1:
|
||||||
|
print("Please provide a year [e.g. end-of-year-poster.py 2022].")
|
||||||
|
exit(-1)
|
||||||
|
year = int(sys.argv[1])
|
||||||
|
|
||||||
os.system("rm -rf *.jpg")
|
os.system("rm -rf *.jpg")
|
||||||
games_list = end_of_year(2021)
|
games_list = end_of_year(year)
|
||||||
montage(games_list, 2021)
|
|
||||||
print(" -- done, see collage-[year].jpg")
|
montage(games_list, year)
|
||||||
|
print_stats(games_list)
|
||||||
|
generate_chart(games_list)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue