reimport
This commit is contained in:
26
twitch/Main.py
Normal file
26
twitch/Main.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import PIL.Image, PIL.ImageDraw, PIL.ImageFont
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
font = PIL.ImageFont.truetype(os.path.join(os.path.dirname(__file__), 'IBMPlexMono.ttf'), 20)
|
||||
nFrames = 60
|
||||
width = 500
|
||||
height = 500
|
||||
if __name__ == "__main__":
|
||||
tpe = sys.argv[1]
|
||||
username = sys.argv[2]
|
||||
description = sys.argv[3]
|
||||
target = sys.argv[4]
|
||||
|
||||
animated_gif = Image.open("./customAlertsMedia/"+tpe+".gif")
|
||||
|
||||
frames = []
|
||||
for frame in ImageSequence.Iterator(animated_gif):
|
||||
frame = frame.convert('RGB')
|
||||
d = PIL.ImageDraw.Draw(frame)
|
||||
d.text((0, 0), description, font=font, fill=(255, 255, 255))
|
||||
d.text((0, 100), username, font=font, fill=(255, 255, 255))
|
||||
frames.append(frame)
|
||||
frames[0].save(target+tpe+".gif", save_all=True, append_images=frames[1:], duration=100, loop=0, optimize=0, comment="")
|
||||
os.popen('cp ./customAlertsMedia/'+tpe+'.mp3 '+target+tpe+'.mp3')
|
||||
Reference in New Issue
Block a user