본문 내용에 날씨 정보를 구체적으로 올릴 수 있도록 수정.

This commit is contained in:
2025-06-27 13:32:51 +09:00
parent cb1a98d940
commit fb62bb28b4

View File

@ -20,6 +20,7 @@ import pymysql
import ftputil
from config import DB_CONFIG, FTP_CONFIG, MAIN
from weather import get_precipitation_summary
# ---------------------------
@ -29,7 +30,7 @@ def capture_image(script_path, output_path, max_attempts=5):
for attempt in range(max_attempts):
print(f"[{datetime.now().strftime('%H:%M:%S')}] 이미지 캡처 시도 {attempt + 1}/{max_attempts}")
try:
subprocess.run(['python3', script_path], check=True)
subprocess.run([sys.executable, script_path], check=True)
except subprocess.CalledProcessError as e:
print(f"[오류] weather_capture.py 실행 실패: {e}")
if os.path.isfile(output_path):
@ -151,6 +152,12 @@ def write_board(board, subject, content, mb_id, nickname, ca_name=None, file_lis
# 메인 실행 함수
# ---------------------------
def main():
# 날씨 정보 문자열 얻기
weather_content = get_precipitation_summary()
# MAIN['content'] 업데이트
MAIN['content'] = weather_content
today = datetime.today().strftime('%Y%m%d')
script_dir = os.path.dirname(os.path.abspath(__file__))
capture_script = os.path.join(script_dir, 'weather_capture.py')