-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStart_Server.bat
More file actions
132 lines (104 loc) · 2.91 KB
/
Start_Server.bat
File metadata and controls
132 lines (104 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@echo off
setlocal enabledelayedexpansion
title INTRA LAN SERVER
REM ===== Move to script directory =====
cd /d "%~dp0"
echo ======================================
echo INTRA LAN SERVER LAUNCHER
echo ======================================
echo.
REM ===== Backend folder check =====
set BACKEND_DIR=%cd%\backend
if not exist "%BACKEND_DIR%" (
echo [ERROR] Backend folder not found!
echo Expected location: %BACKEND_DIR%
pause
exit /b
)
cd /d "%BACKEND_DIR%"
echo [1/5] Checking Python installation...
python --version >nul 2>&1
if errorlevel 1 (
echo.
echo [ERROR] Python is not installed.
echo Please install Python from:
echo https://www.python.org/downloads/
pause
exit /b
)
echo Python detected.
echo.
REM ===== External Tools Check (FFmpeg, Tesseract, Ghostscript) =====
echo [1.5/5] Checking External Tools...
winget --version >nul 2>&1
if errorlevel 1 (
echo [!] winget not found. Please install FFmpeg, Tesseract, and Ghostscript manually.
goto :venv_start
)
where ffmpeg >nul 2>&1
if errorlevel 1 (
echo [!] FFmpeg missing. Installing via winget...
winget install --id=Gyan.FFmpeg -e --silent --accept-source-agreements --accept-package-agreements
if errorlevel 0 echo [OK] FFmpeg installed. Please restart script if it fails later.
) else (
echo [+] FFmpeg detected.
)
where tesseract >nul 2>&1
if errorlevel 1 (
echo [!] Tesseract missing. Installing via winget...
winget install --id=UB-Mannheim.TesseractOCR -e --silent --accept-source-agreements --accept-package-agreements
if errorlevel 0 echo [OK] Tesseract installed.
) else (
echo [+] Tesseract detected.
)
where gswin64c >nul 2>&1
if errorlevel 1 (
echo [!] Ghostscript missing. Installing via winget...
winget install --id=ArtifexSoftware.Ghostscript -e --silent --accept-source-agreements --accept-package-agreements
if errorlevel 0 echo [OK] Ghostscript installed.
) else (
echo [+] Ghostscript detected.
)
:venv_start
echo.
REM ===== Create virtual environment =====
if not exist venv (
echo [2/5] Creating virtual environment...
python -m venv venv
) else (
echo [2/5] Virtual environment already exists.
)
echo.
REM ===== Activate venv =====
echo [3/5] Activating virtual environment...
call venv\Scripts\activate
echo.
REM ===== Install dependencies =====
echo [4/5] Installing dependencies...
pip install --upgrade pip >nul
pip install -r requirements.txt
echo.
REM ===== Get local IP =====
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| findstr "IPv4 Address"') do (
set IP=%%a
)
set IP=!IP: =!
echo ======================================
echo SERVER STARTING
echo ======================================
echo.
echo Local access:
echo http://localhost:8000
echo.
echo LAN access:
echo http://!IP!:8000
echo.
echo Android app me ye IP daalo:
echo !IP!
echo.
REM ===== Open browser =====
start http://localhost:8000
echo [5/5] Starting Intra Backend Server...
echo.
python run_server.py
pause