diff --git a/app/library/lib.py b/app/library/lib.py index b98192b..0a51ec9 100644 --- a/app/library/lib.py +++ b/app/library/lib.py @@ -15,6 +15,7 @@ from PIL import ImageFont import library.vts as vts import os +from datetime import datetime with open('./config.json') as json_file: json_data = json.load(json_file) @@ -65,6 +66,30 @@ def ์–ป๊ธฐ(MLSV_YMD:str): print("๐Ÿฒ | Meal Info Image Saved") +def ํ•™์‚ฌ์ผ์ •_์–ป๊ธฐ(): + print("์„œ์ฝ”๊ฐ€๊ณ ์‹ถ๋‹ค๋ฐœ๋™") + ์˜ค๋Š˜ = datetime.now() + ํ•™์‚ฌ์ผ์ • = "" +# print(f"{ROOT}/library/skeleton.png") + ์‚ฌ์ง„ = Image.open(f"{ROOT}/library/skeleton_schoolevent.png") + + #if vts.get_vts_true_or_false() == True: ์‚ฌ์ง„ = Image.open(f'{ROOT}/library/skeleton-vts.png') + + ํ•™์‚ฌ์ผ์ •_ํฐํŠธ = ImageFont.truetype(font, 56) + ์„ธ๋ถ€_ํฐํŠธ = ImageFont.truetype(font, 24) + + ์ œ๋ชฉ์š”์†Œ = ImageDraw.Draw(์‚ฌ์ง„) + for i, line in enumerate(reversed(ํ•™์‚ฌ์ผ์ •.split('\n'))): + ์ œ๋ชฉ์š”์†Œ.text((75, 930 - i * 60), line, font=ํ•™์‚ฌ์ผ์ •_ํฐํŠธ, anchor="ls", fill=(255, 255, 255)) + + ์„ธ๋ถ€์š”์†Œ = ImageDraw.Draw(์‚ฌ์ง„) + ์„ธ๋ถ€์š”์†Œ.text((767, 80), f"{์˜ค๋Š˜.strftime("%Y")}๋…„ {์˜ค๋Š˜.strftime("%m")}์›”", font=์„ธ๋ถ€_ํฐํŠธ, fill=(255, 255, 255)) + #์„ธ๋ถ€์š”์†Œ.text((825, 200), f"{๊ธ‰์‹_์นผ๋กœ๋ฆฌ_์–ป๊ธฐ(MLSV_YMD)}", font=์„ธ๋ถ€_ํฐํŠธ, fill=(137, 202, 255)) + + ์‚ฌ์ง„.save(f'{ROOT}/temp/{์˜ค๋Š˜.strftime("%Y")}_{์˜ค๋Š˜.strftime("%m")}์›”.png') + + print("๐Ÿฒ | Meal Info Image Saved") + def ์Šคํ† ๋ฆฌ_์–ป๊ธฐ(MLSV_YMD:str): print("์ด๊ฑด ์™œ?") # 1:1 to 9:16 temp/{MLSV_YMD}.png diff --git a/app/library/schoolevent.json b/app/library/schoolevent.json new file mode 100644 index 0000000..d3082de --- /dev/null +++ b/app/library/schoolevent.json @@ -0,0 +1,14 @@ +{ + "1": { + "0": { + "start": 20250208, + "end": 20250302, + "data": "๊ฒจ์šธ๋ฐฉํ•™" + }, + "1": { + "start": 20250303, + "end": 20250303, + "data": "" + } + } +} \ No newline at end of file diff --git a/app/library/skeleton_schoolevent.png b/app/library/skeleton_schoolevent.png new file mode 100644 index 0000000..b9606ed Binary files /dev/null and b/app/library/skeleton_schoolevent.png differ diff --git a/app/run.py b/app/run.py index 9df6c87..86011ee 100644 --- a/app/run.py +++ b/app/run.py @@ -52,6 +52,19 @@ print("๐Ÿ—จ๏ธ | Uploading at Discord") lib.๋””์Šค์ฝ”๋“œ(MLSV_YMD) print("๐Ÿ—จ๏ธ | Uploaded at Discord") +print(f"๐Ÿ“† | Today Date : {MLSV_YMD}") +# Check if today is the last day of the month +today = datetime.now() +first_day_of_next_month = today.replace(day=28) + timedelta(days=4) +last_day_of_this_month = first_day_of_next_month - timedelta(days=first_day_of_next_month.day) +if today.date() == last_day_of_this_month.date(): + print("๐Ÿ“… | Today is the last day of the month.") + print("๐Ÿ“† | Uploading School Event Post") + lib.ํ•™์‚ฌ์ผ์ •_์–ป๊ธฐ(MLSV_YMD) + print("๐Ÿ“† | School Event Post Uploaded") +else: + print("๐Ÿ“… | Today is not the last day of the month.") + print("๐ŸŽ‰ | All tasks completed.") # Calculate running time print("๐Ÿ•’ | Running Time:", datetime.now() - start_time) diff --git a/app/temp.py b/app/temp.py new file mode 100644 index 0000000..f5168c5 --- /dev/null +++ b/app/temp.py @@ -0,0 +1,3 @@ +import library.lib as ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ + +๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ.ํ•™์‚ฌ์ผ์ •_์–ป๊ธฐ() \ No newline at end of file