diff --git a/.gitignore b/.gitignore index ae22d615..74130318 100644 --- a/.gitignore +++ b/.gitignore @@ -21418,3 +21418,4 @@ frontend/src/renderer/dist-electron/win-unpacked/resources/backend/BodyBalanceBa backend/data/patients/202508060001/20250820102556/feet.mp4 frontend/src/renderer/src/services/api.js frontend/src/renderer/src/services/api.js +frontend/src/renderer/src/services/api.js diff --git a/backend/devices/screen_recorder.py b/backend/devices/screen_recorder.py index 90076bdc..808b334c 100644 --- a/backend/devices/screen_recorder.py +++ b/backend/devices/screen_recorder.py @@ -17,6 +17,7 @@ import json import base64 from pathlib import Path from typing import Optional, Dict, Any +import sys try: from .camera_manager import CameraManager @@ -110,7 +111,12 @@ class RecordingManager: self.recording_start_time = datetime.now() # 创建存储目录 - base_path = os.path.join('data', 'patients', patient_id, session_id) + if getattr(sys, 'frozen', False): + # 打包后的exe文件路径 + exe_dir = os.path.dirname(sys.executable) + base_path = os.path.join(exe_dir, 'data', 'patients', patient_id, session_id) + else: + base_path = os.path.join('data', 'patients', patient_id, session_id) try: os.makedirs(base_path, exist_ok=True) self.logger.info(f'录制目录创建成功: {base_path}') @@ -543,9 +549,14 @@ class RecordingManager: """ # 生成采集时间戳 timestamp = datetime.now().strftime('%Y%m%d_%H%M%S_%f')[:-3] # 精确到毫秒 - + data_dir="" + if getattr(sys, 'frozen', False): + # 打包后的exe文件路径 + exe_dir = os.path.dirname(sys.executable) + data_dir=(os.path.join(exe_dir, 'data/patients/{patient_id}/{session_id}/{timestamp}')) + else: + data_dir = Path(f'data/patients/{patient_id}/{session_id}/{timestamp}') # 创建数据存储目录 - data_dir = Path(f'data/patients/{patient_id}/{session_id}/{timestamp}') data_dir.mkdir(parents=True, exist_ok=True) # 设置目录权限为777(完全权限) diff --git a/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/recording_20250731_170917.mp4 b/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/recording_20250731_170917.mp4 deleted file mode 100644 index 2f29d991..00000000 Binary files a/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/recording_20250731_170917.mp4 and /dev/null differ diff --git a/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/screenshot_20250731_170908.jpg b/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/screenshot_20250731_170908.jpg deleted file mode 100644 index ded2d18c..00000000 Binary files a/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/screenshot_20250731_170908.jpg and /dev/null differ diff --git a/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/screenshot_20250731_170913.jpg b/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/screenshot_20250731_170913.jpg deleted file mode 100644 index 2fbf5da9..00000000 Binary files a/data/patients/0001/7872bb06-b7a4-4df1-9179-2d9dd45187d3/screenshot_20250731_170913.jpg and /dev/null differ diff --git a/data/patients/0002/0496660d-b954-4f88-b2a0-b0e4e764190b/recording_20250731_174928.mp4 b/data/patients/0002/0496660d-b954-4f88-b2a0-b0e4e764190b/recording_20250731_174928.mp4 deleted file mode 100644 index fc4ed138..00000000 Binary files a/data/patients/0002/0496660d-b954-4f88-b2a0-b0e4e764190b/recording_20250731_174928.mp4 and /dev/null differ diff --git a/data/patients/0002/0496660d-b954-4f88-b2a0-b0e4e764190b/screenshot_20250731_174921.jpg b/data/patients/0002/0496660d-b954-4f88-b2a0-b0e4e764190b/screenshot_20250731_174921.jpg deleted file mode 100644 index 8cba879f..00000000 Binary files a/data/patients/0002/0496660d-b954-4f88-b2a0-b0e4e764190b/screenshot_20250731_174921.jpg and /dev/null differ diff --git a/data/patients/2101/20250731141410/recording_20250731_141456.mp4 b/data/patients/2101/20250731141410/recording_20250731_141456.mp4 deleted file mode 100644 index 34944e86..00000000 Binary files a/data/patients/2101/20250731141410/recording_20250731_141456.mp4 and /dev/null differ diff --git a/data/patients/2101/20250731143727/recording_20250731_143805.mp4 b/data/patients/2101/20250731143727/recording_20250731_143805.mp4 deleted file mode 100644 index bccf3990..00000000 Binary files a/data/patients/2101/20250731143727/recording_20250731_143805.mp4 and /dev/null differ diff --git a/data/patients/2101/20250731143727/screenshot_20250731_143740.jpg b/data/patients/2101/20250731143727/screenshot_20250731_143740.jpg deleted file mode 100644 index 86482e9d..00000000 Binary files a/data/patients/2101/20250731143727/screenshot_20250731_143740.jpg and /dev/null differ diff --git a/data/patients/2101/20250731143727/screenshot_20250731_143753.jpg b/data/patients/2101/20250731143727/screenshot_20250731_143753.jpg deleted file mode 100644 index 66fa6ed1..00000000 Binary files a/data/patients/2101/20250731143727/screenshot_20250731_143753.jpg and /dev/null differ