medicafe 0.250820.4__py3-none-any.whl → 0.250820.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,325 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ echo ========================================
5
+ echo MediBot Crash Diagnostic Tool
6
+ echo ========================================
7
+ echo.
8
+ echo This tool will help identify where MediBot.bat is crashing
9
+ echo on the XP production machine.
10
+ echo.
11
+ echo Press Enter to start diagnostics...
12
+ call :maybe_pause
13
+
14
+ :: Test 1: Basic batch functionality
15
+ echo.
16
+ echo ========================================
17
+ echo Test 1: Basic Batch Functionality
18
+ echo ========================================
19
+ echo Testing basic batch commands...
20
+ echo Current directory: %CD%
21
+ echo Current time: %TIME%
22
+ echo Current date: %DATE%
23
+ echo.
24
+ echo Testing variable expansion...
25
+ set "test_var=Hello World"
26
+ echo Test variable: %test_var%
27
+ echo Delayed expansion test: !test_var!
28
+ echo.
29
+ echo Test 1 PASSED - Basic batch functionality works
30
+ echo Press Enter to continue...
31
+ call :maybe_pause
32
+
33
+ :: Test 2: Python installation
34
+ echo.
35
+ echo ========================================
36
+ echo Test 2: Python Installation
37
+ echo ========================================
38
+ echo Testing Python installation...
39
+ python --version >nul 2>&1
40
+ if errorlevel 1 (
41
+ echo ERROR: Python not found or not in PATH
42
+ echo Current PATH: %PATH%
43
+ echo.
44
+ echo Test 2 FAILED - Python not available
45
+ echo Press Enter to continue anyway...
46
+ call :maybe_pause
47
+ ) else (
48
+ echo Python found successfully
49
+ python --version
50
+ echo.
51
+ echo Test 2 PASSED - Python installation OK
52
+ echo Press Enter to continue...
53
+ call :maybe_pause
54
+ )
55
+
56
+ :: Test 3: Directory structure
57
+ echo.
58
+ echo ========================================
59
+ echo Test 3: Directory Structure
60
+ echo ========================================
61
+ echo Testing directory structure...
62
+ echo Current directory contents:
63
+ dir /b
64
+ echo.
65
+ echo Testing MediBot directory:
66
+ if exist "MediBot" (
67
+ echo MediBot directory exists
68
+ echo MediBot contents:
69
+ dir /b MediBot
70
+ ) else (
71
+ echo WARNING: MediBot directory not found
72
+ )
73
+ echo.
74
+ echo Test 3 PASSED - Directory structure checked
75
+ echo Press Enter to continue...
76
+ call :maybe_pause
77
+
78
+ :: Test 4: F: drive access
79
+ echo.
80
+ echo ========================================
81
+ echo Test 4: F: Drive Access
82
+ echo ========================================
83
+ echo Testing F: drive access...
84
+ if exist "F:\" (
85
+ echo F: drive exists
86
+ if exist "F:\Medibot" (
87
+ echo F:\Medibot directory exists
88
+ echo F:\Medibot contents:
89
+ dir /b "F:\Medibot" 2>nul || echo Cannot list F:\Medibot contents
90
+ ) else (
91
+ echo F:\Medibot directory does not exist
92
+ )
93
+ ) else (
94
+ echo F: drive does not exist
95
+ )
96
+ echo.
97
+ echo Test 4 PASSED - F: drive access checked
98
+ echo Press Enter to continue...
99
+ call :maybe_pause
100
+
101
+ :: Test 5: Python package access
102
+ echo.
103
+ echo ========================================
104
+ echo Test 5: Python Package Access
105
+ echo ========================================
106
+ echo Testing Python package access...
107
+ echo Testing pkg_resources import...
108
+ python -c "import pkg_resources" 2>nul
109
+ if errorlevel 1 (
110
+ echo ERROR: pkg_resources not available
111
+ ) else (
112
+ echo pkg_resources import successful
113
+ )
114
+
115
+ echo Testing MediCafe package...
116
+ python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" 2>nul
117
+ if errorlevel 1 (
118
+ echo ERROR: MediCafe package not found or error accessing
119
+ ) else (
120
+ echo MediCafe package found
121
+ )
122
+ echo.
123
+ echo Test 5 PASSED - Python package access checked
124
+ echo Press Enter to continue...
125
+ call :maybe_pause
126
+
127
+ :: Test 6: Internet connectivity
128
+ echo.
129
+ echo ========================================
130
+ echo Test 6: Internet Connectivity
131
+ echo ========================================
132
+ echo Testing internet connectivity...
133
+ ping -n 1 google.com >nul 2>&1
134
+ if errorlevel 1 (
135
+ echo WARNING: No internet connection detected
136
+ ) else (
137
+ echo Internet connection detected
138
+ )
139
+ echo.
140
+ echo Test 6 PASSED - Internet connectivity checked
141
+ echo Press Enter to continue...
142
+ call :maybe_pause
143
+
144
+ :: Test 7: Configuration file
145
+ echo.
146
+ echo ========================================
147
+ echo Test 7: Configuration File
148
+ echo ========================================
149
+ echo Testing configuration file access...
150
+ set "config_file=MediBot\json\config.json"
151
+ echo Checking for config file: %config_file%
152
+ if exist "%config_file%" (
153
+ echo Config file exists
154
+ ) else (
155
+ echo WARNING: Config file not found
156
+ )
157
+ echo.
158
+ echo Test 7 PASSED - Configuration file checked
159
+ echo Press Enter to continue...
160
+ call :maybe_pause
161
+
162
+ :: Test 8: Update script files
163
+ echo.
164
+ echo ========================================
165
+ echo Test 8: Update Script Files
166
+ echo ========================================
167
+ echo Testing update script files...
168
+ set "upgrade_medicafe_local=MediBot\update_medicafe.py"
169
+ set "upgrade_medicafe_legacy=F:\Medibot\update_medicafe.py"
170
+
171
+ echo Checking local update script: %upgrade_medicafe_local%
172
+ if exist "%upgrade_medicafe_local%" (
173
+ echo Local update script found
174
+ ) else (
175
+ echo Local update script not found
176
+ )
177
+
178
+ echo Checking legacy update script: %upgrade_medicafe_legacy%
179
+ if exist "%upgrade_medicafe_legacy%" (
180
+ echo Legacy update script found
181
+ ) else (
182
+ echo Legacy update script not found
183
+ )
184
+ echo.
185
+ echo Test 8 PASSED - Update script files checked
186
+ echo Press Enter to continue...
187
+ call :maybe_pause
188
+
189
+ :: Test 9: Python module imports
190
+ echo.
191
+ echo ========================================
192
+ echo Test 9: Python Module Imports
193
+ echo ========================================
194
+ echo Testing Python module imports...
195
+ echo Testing sys module...
196
+ python -c "import sys; print('Python version:', sys.version)" 2>nul
197
+ if errorlevel 1 (
198
+ echo ERROR: sys module import failed
199
+ ) else (
200
+ echo sys module import successful
201
+ )
202
+
203
+ echo Testing MediCafe module...
204
+ python -c "import MediCafe" 2>nul
205
+ if errorlevel 1 (
206
+ echo ERROR: MediCafe module import failed
207
+ ) else (
208
+ echo MediCafe module import successful
209
+ )
210
+ echo.
211
+ echo Test 9 PASSED - Python module imports checked
212
+ echo Press Enter to continue...
213
+ call :maybe_pause
214
+
215
+ :: Test 10: Command execution
216
+ echo.
217
+ echo ========================================
218
+ echo Test 10: Command Execution
219
+ echo ========================================
220
+ echo Testing command execution...
221
+ echo Testing simple command...
222
+ echo Hello World
223
+ if errorlevel 1 (
224
+ echo ERROR: Simple command execution failed
225
+ ) else (
226
+ echo Simple command execution successful
227
+ )
228
+
229
+ echo Testing Python command execution...
230
+ python -c "print('Python command execution test')" 2>nul
231
+ if errorlevel 1 (
232
+ echo ERROR: Python command execution failed
233
+ ) else (
234
+ echo Python command execution successful
235
+ )
236
+ echo.
237
+ echo Test 10 PASSED - Command execution checked
238
+ echo Press Enter to continue...
239
+ call :maybe_pause
240
+
241
+ :: Test 11: File operations
242
+ echo.
243
+ echo ========================================
244
+ echo Test 11: File Operations
245
+ echo ========================================
246
+ echo Testing file operations...
247
+ echo Creating test file...
248
+ echo Test content > test_file.txt
249
+ if exist "test_file.txt" (
250
+ echo Test file created successfully
251
+ echo Test file contents:
252
+ type test_file.txt
253
+ echo Deleting test file...
254
+ del test_file.txt
255
+ if not exist "test_file.txt" (
256
+ echo Test file deleted successfully
257
+ ) else (
258
+ echo ERROR: Could not delete test file
259
+ )
260
+ ) else (
261
+ echo ERROR: Could not create test file
262
+ )
263
+ echo.
264
+ echo Test 11 PASSED - File operations checked
265
+ echo Press Enter to continue...
266
+ pause >nul
267
+
268
+ :: Test 12: Menu functionality
269
+ if not defined NON_INTERACTIVE (
270
+ echo.
271
+ echo ========================================
272
+ echo Test 12: Menu Functionality
273
+ echo ========================================
274
+ echo Testing menu functionality...
275
+ echo.
276
+ echo Test Menu:
277
+ echo 1. Option 1
278
+ echo 2. Option 2
279
+ echo 3. Exit
280
+ echo.
281
+ set /p menu_choice="Enter choice (1-3): "
282
+ if "!menu_choice!"=="1" (
283
+ echo Option 1 selected
284
+ ) else if "!menu_choice!"=="2" (
285
+ echo Option 2 selected
286
+ ) else if "!menu_choice!"=="3" (
287
+ echo Exit selected
288
+ ) else (
289
+ echo Invalid choice: !menu_choice!
290
+ )
291
+ echo.
292
+ echo Test 12 PASSED - Menu functionality checked
293
+ echo Press Enter to continue...
294
+ call :maybe_pause
295
+ )
296
+
297
+ :: Final summary
298
+ echo.
299
+ echo ========================================
300
+ echo DIAGNOSTIC SUMMARY
301
+ echo ========================================
302
+ echo.
303
+ echo All diagnostic tests completed.
304
+ echo.
305
+ echo If the batch file is still crashing, the issue is likely:
306
+ echo 1. A specific command or operation not tested here
307
+ echo 2. A timing issue or race condition
308
+ echo 3. A specific file or path that doesn't exist
309
+ echo 4. A Python module dependency issue
310
+ echo 5. A Windows XP compatibility issue
311
+ echo.
312
+ echo Recommendations:
313
+ echo 1. Run the debug version (MediBot_debug.bat) to see exactly where it fails
314
+ echo 2. Check Windows Event Viewer for any error messages
315
+ echo 3. Try running the batch file from a command prompt to see error output
316
+ echo 4. Check if any antivirus software is blocking the execution
317
+ echo.
318
+ echo Press Enter to exit...
319
+ call :maybe_pause
320
+ exit /b 0
321
+
322
+ :maybe_pause
323
+ if defined NON_INTERACTIVE goto :eof
324
+ pause >nul
325
+ goto :eof
@@ -0,0 +1,175 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ echo [DIAGNOSTIC] ========================================
5
+ echo [DIAGNOSTIC] F: Drive and update_medicafe.py Diagnostic
6
+ echo [DIAGNOSTIC] ========================================
7
+ if defined NON_INTERACTIVE (
8
+ echo [DIAGNOSTIC] NON_INTERACTIVE detected - skipping F: drive diagnostics to avoid hangs
9
+ exit /b 0
10
+ )
11
+ echo [DIAGNOSTIC] Current directory: %CD%
12
+ echo [DIAGNOSTIC] Current time: %TIME%
13
+ echo [DIAGNOSTIC] Press Enter to start diagnostics...
14
+ call :maybe_pause
15
+
16
+ echo.
17
+ echo [DIAGNOSTIC] STEP 1: Checking F: drive existence
18
+ echo [DIAGNOSTIC] ========================================
19
+ if exist "F:\" (
20
+ echo [SUCCESS] F: drive exists
21
+ echo [DIAGNOSTIC] F: drive contents:
22
+ dir /b "F:\" 2>nul || echo [ERROR] Cannot list F: drive contents
23
+ ) else (
24
+ echo [ERROR] F: drive does not exist
25
+ )
26
+ echo [DIAGNOSTIC] Press Enter to continue...
27
+ call :maybe_pause
28
+
29
+ echo.
30
+ echo [DIAGNOSTIC] STEP 2: Checking F:\Medibot directory
31
+ echo [DIAGNOSTIC] ========================================
32
+ if exist "F:\Medibot" (
33
+ echo [SUCCESS] F:\Medibot directory exists
34
+ echo [DIAGNOSTIC] F:\Medibot contents:
35
+ dir /b "F:\Medibot" 2>nul || echo [ERROR] Cannot list F:\Medibot contents
36
+ ) else (
37
+ echo [ERROR] F:\Medibot directory does not exist
38
+ )
39
+ echo [DIAGNOSTIC] Press Enter to continue...
40
+ call :maybe_pause
41
+
42
+ echo.
43
+ echo [DIAGNOSTIC] STEP 3: Checking for update_medicafe.py in F:\Medibot
44
+ echo [DIAGNOSTIC] ========================================
45
+ if exist "F:\Medibot\update_medicafe.py" (
46
+ echo [SUCCESS] F:\Medibot\update_medicafe.py exists
47
+ echo [DIAGNOSTIC] File details:
48
+ dir "F:\Medibot\update_medicafe.py" 2>nul || echo [ERROR] Cannot get file details
49
+ ) else (
50
+ echo [ERROR] F:\Medibot\update_medicafe.py does not exist
51
+ )
52
+ echo [DIAGNOSTIC] Press Enter to continue...
53
+ call :maybe_pause
54
+
55
+ echo.
56
+ echo [DIAGNOSTIC] STEP 4: Checking local update_medicafe.py
57
+ echo [DIAGNOSTIC] ========================================
58
+ if exist "MediBot\update_medicafe.py" (
59
+ echo [SUCCESS] Local MediBot\update_medicafe.py exists
60
+ echo [DIAGNOSTIC] File details:
61
+ dir "MediBot\update_medicafe.py" 2>nul || echo [ERROR] Cannot get file details
62
+ ) else (
63
+ echo [ERROR] Local MediBot\update_medicafe.py does not exist
64
+ )
65
+ echo [DIAGNOSTIC] Press Enter to continue...
66
+ call :maybe_pause
67
+
68
+ echo.
69
+ echo [DIAGNOSTIC] STEP 5: Testing Python access to F: drive file
70
+ echo [DIAGNOSTIC] ========================================
71
+ if exist "F:\Medibot\update_medicafe.py" (
72
+ echo [DIAGNOSTIC] Testing Python access to F:\Medibot\update_medicafe.py...
73
+ python -c "import os; print('[SUCCESS] Python can access F: drive file') if os.path.exists('F:\\Medibot\\update_medicafe.py') else print('[ERROR] Python cannot access F: drive file')" 2>nul
74
+ if errorlevel 1 (
75
+ echo [ERROR] Python test failed for F: drive file
76
+ )
77
+ ) else (
78
+ echo [WARNING] Skipping Python test - F: drive file does not exist
79
+ )
80
+ echo [DIAGNOSTIC] Press Enter to continue...
81
+ call :maybe_pause
82
+
83
+ echo.
84
+ echo [DIAGNOSTIC] STEP 6: Testing Python access to local file
85
+ echo [DIAGNOSTIC] ========================================
86
+ if exist "MediBot\update_medicafe.py" (
87
+ echo [DIAGNOSTIC] Testing Python access to local MediBot\update_medicafe.py...
88
+ python -c "import os; print('[SUCCESS] Python can access local file') if os.path.exists('MediBot\\update_medicafe.py') else print('[ERROR] Python cannot access local file')" 2>nul
89
+ if errorlevel 1 (
90
+ echo [ERROR] Python test failed for local file
91
+ )
92
+ ) else (
93
+ echo [WARNING] Skipping Python test - local file does not exist
94
+ )
95
+ echo [DIAGNOSTIC] Press Enter to continue...
96
+ call :maybe_pause
97
+
98
+ echo.
99
+ echo [DIAGNOSTIC] STEP 7: Testing actual Python execution of F: drive file
100
+ echo [DIAGNOSTIC] ========================================
101
+ if exist "F:\Medibot\update_medicafe.py" (
102
+ echo [DIAGNOSTIC] Testing Python execution of F:\Medibot\update_medicafe.py...
103
+ echo [DIAGNOSTIC] This will test if Python can actually run the file
104
+ echo [DIAGNOSTIC] Command: python "F:\Medibot\update_medicafe.py" --help
105
+ python "F:\Medibot\update_medicafe.py" --help 2>nul
106
+ if errorlevel 1 (
107
+ echo [ERROR] Python execution of F: drive file failed
108
+ echo [DIAGNOSTIC] This is likely the source of the "can't find" error
109
+ ) else (
110
+ echo [SUCCESS] Python execution of F: drive file succeeded
111
+ )
112
+ ) else (
113
+ echo [WARNING] Skipping execution test - F: drive file does not exist
114
+ )
115
+ echo [DIAGNOSTIC] Press Enter to continue...
116
+ call :maybe_pause
117
+
118
+ echo.
119
+ echo [DIAGNOSTIC] STEP 8: Testing actual Python execution of local file
120
+ echo [DIAGNOSTIC] ========================================
121
+ if exist "MediBot\update_medicafe.py" (
122
+ echo [DIAGNOSTIC] Testing Python execution of local MediBot\update_medicafe.py...
123
+ echo [DIAGNOSTIC] This will test if Python can actually run the local file
124
+ echo [DIAGNOSTIC] Command: python "MediBot\update_medicafe.py" --help
125
+ python "MediBot\update_medicafe.py" --help 2>nul
126
+ if errorlevel 1 (
127
+ echo [ERROR] Python execution of local file failed
128
+ ) else (
129
+ echo [SUCCESS] Python execution of local file succeeded
130
+ )
131
+ ) else (
132
+ echo [WARNING] Skipping execution test - local file does not exist
133
+ )
134
+ echo [DIAGNOSTIC] Press Enter to continue...
135
+ call :maybe_pause
136
+
137
+ echo.
138
+ echo [DIAGNOSTIC] STEP 9: Checking Python PATH and environment
139
+ echo [DIAGNOSTIC] ========================================
140
+ echo [DIAGNOSTIC] Python version:
141
+ python --version 2>nul || echo [ERROR] Python not found
142
+ echo [DIAGNOSTIC] Python executable location:
143
+ python -c "import sys; print(sys.executable)" 2>nul || echo [ERROR] Cannot determine python executable path
144
+ echo [DIAGNOSTIC] Current PATH:
145
+ echo %PATH%
146
+ echo [DIAGNOSTIC] Press Enter to continue...
147
+ call :maybe_pause
148
+
149
+ echo.
150
+ echo [DIAGNOSTIC] STEP 10: Summary and recommendations
151
+ echo [DIAGNOSTIC] ========================================
152
+ echo [DIAGNOSTIC] Based on the diagnostics above:
153
+ echo [DIAGNOSTIC]
154
+ if exist "F:\Medibot\update_medicafe.py" (
155
+ echo [DIAGNOSTIC] - F: drive file exists but may have access issues
156
+ ) else (
157
+ echo [DIAGNOSTIC] - F: drive file does not exist (this is the main issue)
158
+ )
159
+ if exist "MediBot\update_medicafe.py" (
160
+ echo [DIAGNOSTIC] - Local file exists and should be used instead
161
+ ) else (
162
+ echo [DIAGNOSTIC] - Local file also missing (critical issue)
163
+ )
164
+ echo [DIAGNOSTIC]
165
+ echo [DIAGNOSTIC] RECOMMENDATION: The batch file should prioritize the local
166
+ echo [DIAGNOSTIC] MediBot\update_medicafe.py file over the F: drive version.
167
+ echo [DIAGNOSTIC]
168
+ echo [DIAGNOSTIC] Press Enter to exit...
169
+ call :maybe_pause
170
+ exit /b 0
171
+
172
+ :maybe_pause
173
+ if defined NON_INTERACTIVE goto :eof
174
+ pause >nul
175
+ goto :eof
@@ -0,0 +1,71 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ echo ========================================
5
+ echo FULL DEBUG SUITE START
6
+ echo ========================================
7
+ if /I "%~1"=="/interactive" (
8
+ set "NON_INTERACTIVE="
9
+ echo Running diagnostics interactively...
10
+ ) else (
11
+ set "NON_INTERACTIVE=1"
12
+ echo Running diagnostics non-interactively...
13
+ )
14
+ echo.
15
+
16
+ :: F: Drive Diagnostic
17
+ if defined NON_INTERACTIVE (
18
+ echo [SKIP] F: Drive diagnostic skipped in NON_INTERACTIVE mode
19
+ ) else (
20
+ call "%~dp0f_drive_diagnostic.bat"
21
+ if errorlevel 1 (
22
+ echo [WARN] F: Drive diagnostic reported issues
23
+ ) else (
24
+ echo [OK] F: Drive diagnostic passed
25
+ )
26
+ )
27
+
28
+ :: Crash Diagnostic
29
+ if defined NON_INTERACTIVE (
30
+ echo [SKIP] Crash diagnostic skipped in NON_INTERACTIVE mode
31
+ ) else (
32
+ call "%~dp0crash_diagnostic.bat"
33
+ if errorlevel 1 (
34
+ echo [WARN] Crash diagnostic reported issues
35
+ ) else (
36
+ echo [OK] Crash diagnostic passed
37
+ )
38
+ )
39
+
40
+ :: Basic Debug
41
+ if defined NON_INTERACTIVE (
42
+ echo [SKIP] Basic debug skipped in NON_INTERACTIVE mode
43
+ ) else (
44
+ call "%~dp0MediBot_debug.bat"
45
+ if errorlevel 1 (
46
+ echo [WARN] Basic debug reported issues
47
+ ) else (
48
+ echo [OK] Basic debug passed
49
+ )
50
+ )
51
+
52
+ :: Fixed Version Test removed (redundant script)
53
+
54
+ :: Additional automated checks
55
+ python --version >nul 2>&1 && echo [OK] Python found || echo [ERROR] Python not found in PATH
56
+ python -c "import pkg_resources; print('MediCafe=='+pkg_resources.get_distribution('medicafe').version)" >nul 2>&1 && echo [OK] MediCafe package found || echo [WARN] MediCafe package missing
57
+ ping -n 1 google.com >nul 2>&1 && echo [OK] Internet connectivity OK || echo [WARN] No internet
58
+ if exist "%~dp0update_medicafe.py" (echo [OK] Local update_medicafe.py present) else (echo [WARN] Local update_medicafe.py missing)
59
+ if exist "F:\" (
60
+ if exist "F:\Medibot\update_medicafe.py" (echo [OK] F:\Medibot\update_medicafe.py present) else (echo [WARN] F: update script missing)
61
+ ) else (
62
+ echo [WARN] F: drive not accessible
63
+ )
64
+
65
+ echo.
66
+ echo ========================================
67
+ echo FULL DEBUG SUITE DONE
68
+ echo ========================================
69
+ endlocal & exit /b 0
70
+
71
+
@@ -0,0 +1,98 @@
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ echo source_folder=%source_folder%
5
+ echo target_folder=%target_folder%
6
+ echo local_storage_path=%local_storage_path%
7
+ echo python_script=%python_script%
8
+ echo config_file=%config_file%
9
+ echo.
10
+
11
+ :: Expects these to be set by caller (MediBot.bat):
12
+ :: %source_folder% %target_folder% %python_script% %config_file% %local_storage_path%
13
+
14
+ :: Validate JSON update script path or prompt for alternate
15
+ if not exist "%python_script%" (
16
+ echo.
17
+ echo Warning: Python script for JSON updates not found at: %python_script%
18
+ echo.
19
+ set /p provide_alt_json="Enter 'Y' to provide alternate path, or any other key to continue: "
20
+ if /i "!provide_alt_json!"=="Y" (
21
+ echo.
22
+ echo Please enter the full path to your update_json.py file.
23
+ echo Example: C:\MediBot\scripts\update_json.py
24
+ echo Example with spaces: "G:\My Drive\MediBot\scripts\update_json.py"
25
+ echo.
26
+ set /p alt_json_path="Enter JSON update script path: "
27
+ set "alt_json_path=!alt_json_path:"=!"
28
+ if exist "!alt_json_path!" (
29
+ echo JSON update script found at: !alt_json_path!
30
+ set "python_script=!alt_json_path!"
31
+ ) else (
32
+ echo JSON update script not found at: !alt_json_path!
33
+ echo Continuing without JSON update script...
34
+ )
35
+ ) else (
36
+ echo Continuing without JSON update script...
37
+ )
38
+ )
39
+
40
+ :: Move any CSVs from local storage to source folder
41
+ if defined local_storage_path if exist "%local_storage_path%\*.csv" (
42
+ echo Checking for new CSV files in local storage...
43
+ for %%f in ("%local_storage_path%\*.csv") do (
44
+ echo Moving %%f to %source_folder%...
45
+ move "%%f" "%source_folder%"
46
+ )
47
+ )
48
+
49
+ :: Timestamp for new filename
50
+ for /f "tokens=1-5 delims=/: " %%a in ('echo %time%') do (
51
+ set "hour=%%a"
52
+ set "minute=%%b"
53
+ set "second=%%c"
54
+ )
55
+ for /f "tokens=2-4 delims=/ " %%a in ('echo %date%') do (
56
+ set "day=%%a"
57
+ set "month=%%b"
58
+ set "year=%%c"
59
+ )
60
+ set "timestamp=!year!!month!!day!_!hour!!minute!"
61
+
62
+ :: Find most recent CSV in source folder
63
+ set "latest_csv="
64
+ for /f "delims=" %%a in ('dir /b /a-d /o-d "%source_folder%\*.csv"') do (
65
+ set "latest_csv=%%a"
66
+ goto :have_csv
67
+ )
68
+ echo No CSV files found in %source_folder%.
69
+ set /p _="Press Enter to continue..."
70
+ exit /b 0
71
+
72
+ :have_csv
73
+ echo Validating latest CSV with config file...
74
+ if exist "%python_script%" if exist "%config_file%" (
75
+ for /f "delims=" %%a in ('python "%python_script%" "%config_file%"') do set "current_csv=%%a"
76
+ for %%f in ("!current_csv!") do set "current_csv_name=%%~nxf"
77
+ for %%f in ("%target_folder%\!latest_csv!") do set "latest_csv_name=%%~nxf"
78
+ if not "!current_csv_name!"=="!latest_csv_name!" (
79
+ echo Current CSV: !current_csv_name!
80
+ echo Latest CSV: !latest_csv_name!
81
+ set /p update_choice="Update config to latest CSV? (Y/N): "
82
+ if /i "!update_choice!"=="Y" (
83
+ python "%python_script%" "%config_file%" "%target_folder%\!latest_csv!"
84
+ )
85
+ )
86
+ )
87
+
88
+ move "%source_folder%\!latest_csv!" "%target_folder%\SX_CSV_!timestamp!.csv"
89
+ set "new_csv_path=%target_folder%\SX_CSV_!timestamp!.csv"
90
+ echo Processing CSV...
91
+ if exist "%python_script%" if exist "%config_file%" (
92
+ python "%python_script%" "%config_file%" "!new_csv_path!"
93
+ )
94
+ echo CSV Processor Complete.
95
+ set /p _="Press Enter to continue..."
96
+ exit /b 0
97
+
98
+