diff --git a/data/gnu_autoupload.py b/data/gnu_autoupload.py index 44ea6f3..e885ee0 100644 --- a/data/gnu_autoupload.py +++ b/data/gnu_autoupload.py @@ -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')