Somebody once told me the world is gonna roll me

This commit is contained in:
Casey 2024-07-09 01:39:46 +03:00
parent 903c453540
commit 07ff2dcf01
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
4 changed files with 104 additions and 4 deletions

View File

@ -65,7 +65,13 @@ class AsyncBotManager:
) as im:
draw = ImageDraw.Draw(im)
draw.rectangle((0, 0, im.width, im.height), (0, 0, 0, 0))
draw.text((left + 2, top + 2), text, font=font, fill=(255, 255, 255, 255), anchor="lt")
draw.text(
(left + 2, top + 2),
text,
font=font,
fill=(255, 255, 255, 255),
anchor="lt",
)
alpha = im.convert("L").filter(ImageFilter.MaxFilter(5))
im.putalpha(alpha)
@ -385,7 +391,7 @@ async def amain(conf_path: str = "settings.json", *_) -> None:
elem.get("font", "default"), elem.get("size", 8)
)
def update() -> PixelMap:
def update_time() -> PixelMap:
now = datetime.datetime.now(datetime.timezone.utc)
txt = now.strftime(time_format)
img = mgr.get_text_image(txt, font)
@ -393,7 +399,7 @@ async def amain(conf_path: str = "settings.json", *_) -> None:
img.close()
return pixmap
mgr.animation_functions.append(update)
mgr.animation_functions.append(update_time)
elif elem["type"] == "tile":
with Image.open(elem["path"]).convert("LA") as im:
for oy in range(elem.get("h", im.height)):
@ -468,6 +474,24 @@ async def amain(conf_path: str = "settings.json", *_) -> None:
mgr.put_bit(offset, bool((byte >> (7 - i)) & 1))
written += 1
offset += 1
elif elem["type"] == "shrek":
with open(elem["path"], "r") as fp:
lyrics = list(map(str.strip, fp))
font = ImageFont.truetype(elem["font"], 11)
def update_shrek() -> PixelMap:
with Image.new("LA", (325, 10), (0, 255)) as im:
draw = ImageDraw.Draw(im)
draw.rectangle((0, 0, 325, 10), fill=(0, 255))
now = datetime.datetime.now(datetime.timezone.utc)
line = lyrics[
int(now.timestamp() / elem["spf"]) % len(lyrics)
]
draw.text((2, -1), line, font=font, fill=(255, 255))
return mgr.get_image_diff(elem["x"], elem["y"], im)
mgr.animation_functions.append(update_shrek)
mgr.get_difference_image().save("result.png")
mgr.get_avoid_image().save("avoid.png")

BIN
creep2.ttf Executable file

Binary file not shown.

68
funnies/shrek.txt Normal file
View File

@ -0,0 +1,68 @@
Somebody once told me
The world is gonna roll me
I ain't the sharpest tool in the shed
She was looking kind of dumb
With her finger and her thumb
In the shape of an "L" on her forehead
Well, the years start coming
And they don't stop coming
Fed to the rules and I hit the ground running
Didn't make sense not to live for fun
Your brain gets smart, but your head gets dumb
So much to do, so much to see
So what's wrong with taking the back streets?
You'll never know if you don't go
You'll never shine if you don't glow
Hey now, you're an all star
Get your game on, go play
Hey now, you're a rock star
Get the show on, get paid
And all that glitters is gold
Only shooting stars break the mold
It's a cool place and they say it gets colder
You're bundled up now, wait 'til you get older
But the meteor men beg to differ
Judging by the hole in the satellite picture
The ice we skate is getting pretty thin
The water's getting warm so you might as well swim
My world's on fire, how about yours?
That's the way I like it and I never get bored
Hey now, you're an all star
Get your game on, go play
Hey now, you're a rock star
Get the show on, get paid
All that glitters is gold
Only shooting stars break the mold
(Go for the moon, go, go)
(Go for the moon, go, go)
(Go for the moon)
(Go, go, go for the moon)
Hey now, you're an all star
Get your game on, go play
Hey now, you're a rock star
Get the show on, get paid
And all that glitters is gold
Only shooting stars
Somebody once asked
"Could I spare some change for gas?
I need to get myself away from this place"
I said, "Yep, what a concept
I could use a little fuel myself"
And we could all use a little change
Well, the years start coming
And they don't stop coming
Fed to the rules and I hit the ground running
Didn't make sense not to live for fun
Your brain gets smart, but your head gets dumb
So much to do, so much to see
So what's wrong with taking the back streets?
You'll never know if you don't go (go!)
You'll never shine if you don't glow
Hey now, you're an all star
Get your game on, go play
Hey now, you're a rock star
Get the show on, get paid
And all that glitters is gold
Only shooting stars break the mold
And all that glitters is gold
Only shooting stars break the mold

View File

@ -76,8 +76,16 @@
{
"type": "image",
"path": "./pictures/hueh.png",
"x": 491,
"x": 490,
"y": 810
},
{
"type": "shrek",
"font": "./creep2.ttf",
"path": "./funnies/shrek.txt",
"x": 490,
"y": 700,
"spf": 20
}
]
}