-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart_litorganizer.bat
More file actions
139 lines (116 loc) · 3.71 KB
/
Copy pathstart_litorganizer.bat
File metadata and controls
139 lines (116 loc) · 3.71 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
133
134
135
136
137
138
139
@echo off
chcp 65001 >nul
:: ============================================================================
:: LitOrganizer v2.0.0 - Windows Launcher
:: ============================================================================
title LitOrganizer
echo.
echo LitOrganizer v2.0.0
echo Organize your academic literature efficiently
echo ─────────────────────────────
echo.
:: Get script directory and change to it
cd /d "%~dp0"
:: ============================================================================
:: STEP 1: Check for Python
:: ============================================================================
echo [1/4] Checking Python...
:: Try py launcher first
py -3 --version >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] Python found via py launcher
set "PYTHON_CMD=py -3"
goto :setup_venv
)
:: Try python command
python --version >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] Python found
set "PYTHON_CMD=python"
goto :setup_venv
)
:: Python not found
echo.
echo [ERROR] Python is not installed!
echo.
echo Install Python 3.10+ from:
echo https://www.python.org/downloads/
echo.
echo Make sure to check "Add Python to PATH" during installation.
echo.
pause
exit /b 1
:: ============================================================================
:: STEP 2: Virtual Environment
:: ============================================================================
:setup_venv
echo.
echo [2/4] Setting up environment...
if exist ".venv\Scripts\python.exe" (
echo [OK] Virtual environment exists
) else (
echo Creating virtual environment...
%PYTHON_CMD% -m venv .venv
if not exist ".venv\Scripts\python.exe" (
echo [ERROR] Failed to create virtual environment!
pause
exit /b 1
)
echo [OK] Created
)
:: Activate virtual environment
echo Activating virtual environment...
call .venv\Scripts\activate.bat
:: Verify activation
where python 2>nul | findstr /i ".venv" >nul
if %errorlevel% neq 0 (
echo [WARN] Virtual environment may not be activated properly
)
echo.
:: ============================================================================
:: STEP 3: Install Dependencies
:: ============================================================================
:install_deps
echo [3/4] Checking dependencies...
:: Update pip silently
echo Updating pip...
python -m pip install --upgrade pip >nul 2>&1
:: Check if core packages exist
python -c "import flask; import fitz; import pdfplumber" >nul 2>&1
if %errorlevel% equ 0 (
echo [OK] All dependencies already installed
goto :launch
)
:: Install dependencies
echo Installing packages (first run may take a few minutes)...
echo.
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo.
echo [WARN] requirements.txt install had issues, trying explicit packages...
pip install Flask flask-socketio PyMuPDF pdfplumber pdf2image pytesseract Pillow python-docx pandas openpyxl requests python-dateutil tqdm
)
:: Verify installation
echo.
python -c "import flask; import fitz; import pdfplumber" >nul 2>&1
if %errorlevel% neq 0 (
echo [ERROR] Core dependencies could not be installed!
echo Please check the error messages above.
echo.
pause
exit /b 1
)
echo [OK] Dependencies installed successfully
echo.
:: ============================================================================
:: STEP 4: Launch Application
:: ============================================================================
:launch
echo [4/4] Starting LitOrganizer...
echo ─────────────────────────────
echo.
python litorganizer.py
:: Cleanup
echo.
echo LitOrganizer closed.
pause