작업 폴더 변경
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
config.py
|
config.py
|
||||||
data/__pycache__/
|
data/__pycache__/
|
||||||
|
app/__pycache__/
|
||||||
|
|||||||
@ -163,11 +163,12 @@ def main():
|
|||||||
MAIN['content'] = weather_content
|
MAIN['content'] = weather_content
|
||||||
|
|
||||||
today = datetime.today().strftime('%Y%m%d')
|
today = datetime.today().strftime('%Y%m%d')
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
data_dir = '/data' # 파일 저장 및 업로드 디렉토리
|
||||||
capture_script = os.path.join(script_dir, 'weather_capture.py')
|
|
||||||
|
capture_script = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'weather_capture.py')
|
||||||
weather_filename = f'weather_capture_{today}.png'
|
weather_filename = f'weather_capture_{today}.png'
|
||||||
weather_file = os.path.join(script_dir, weather_filename)
|
weather_file = os.path.join(data_dir, weather_filename)
|
||||||
thumb_file = os.path.join(script_dir, 'thumb.jpg')
|
thumb_file = os.path.join(data_dir, 'thumb.jpg')
|
||||||
|
|
||||||
if not capture_image(capture_script, weather_file):
|
if not capture_image(capture_script, weather_file):
|
||||||
return
|
return
|
||||||
@ -190,14 +191,14 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# weather_file만 삭제, thumb.jpg는 삭제하지 않음
|
## weather_file만 삭제, thumb.jpg는 삭제하지 않음
|
||||||
if os.path.isfile(weather_file):
|
#if os.path.isfile(weather_file):
|
||||||
os.remove(weather_file)
|
# os.remove(weather_file)
|
||||||
print(f"[정리 완료] 캡처 이미지 삭제됨: {weather_file}")
|
# print(f"[정리 완료] 캡처 이미지 삭제됨: {weather_file}")
|
||||||
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[삭제 오류] {type(e).__name__}: {e}")
|
print(f"[삭제 오류] {type(e).__name__}: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "run.sh 시작: $(date '+%Y-%m-%d %H:%M:%S')"
|
echo "run.sh 시작: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
python3 /data/gnu_autoupload.py >> /proc/1/fd/1 2>&1
|
python3 /app/gnu_autoupload.py >> /proc/1/fd/1 2>&1
|
||||||
@ -65,7 +65,11 @@ try:
|
|||||||
))
|
))
|
||||||
|
|
||||||
# 저장 경로 설정
|
# 저장 경로 설정
|
||||||
save_path = os.path.join(script_dir, f'weather_capture_{TODAY}.png')
|
# 기존
|
||||||
|
# save_path = os.path.join(script_dir, f'weather_capture_{TODAY}.png')
|
||||||
|
# 수정
|
||||||
|
save_path = os.path.join('/data', f'weather_capture_{TODAY}.png')
|
||||||
|
|
||||||
|
|
||||||
# 요소 스크린샷 저장
|
# 요소 스크린샷 저장
|
||||||
target_element.screenshot(save_path)
|
target_element.screenshot(save_path)
|
||||||
Reference in New Issue
Block a user