-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate_windows.bat
More file actions
74 lines (63 loc) · 1.99 KB
/
Copy pathupdate_windows.bat
File metadata and controls
74 lines (63 loc) · 1.99 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
@echo off
setlocal enabledelayedexpansion
:: Get the directory where this batch file is located
set "APP_DIR=%~dp0"
set "APP_DIR=%APP_DIR:~0,-1%"
cd /d "%APP_DIR%"
:: Set variables
set REPO_OWNER=lc700x
set REPO_NAME=desktop2stereo
set BRANCH=update
set ZIP_FILE=%REPO_NAME%-%BRANCH%.zip
:: Construct the download URL
set DOWNLOAD_URL=https://github.com/%REPO_OWNER%/%REPO_NAME%/archive/refs/heads/%BRANCH%.zip
:: Download the ZIP archive
echo Downloading update from %DOWNLOAD_URL%
curl -L -o "%ZIP_FILE%" "%DOWNLOAD_URL%"
if errorlevel 1 (
echo Failed to download update.
pause
exit /b 1
)
:: Extract using PowerShell's Expand-Archive (safe and reliable)
powershell -Command "Expand-Archive -Path '%ZIP_FILE%' -DestinationPath './temp_extract' -Force"
if errorlevel 1 (
echo Failed to extract update.
pause
exit /b 1
)
:: Move contents from nested folder to current directory
for /d %%F in (temp_extract\*) do xcopy "%%F\*" ".\" /E /H /Y
:: Clean up
rmdir /S /Q temp_extract
:: Remove unnecessary platform folders
rmdir /S /Q src\streaming\rtmp\mac 2>nul
rmdir /S /Q src\streaming\rtmp\linux 2>nul
del /F /Q update_mac_linux 2>nul
del /F /Q update.bat 2>nul
del /F /Q main 2>nul
del "%ZIP_FILE%"
echo Latest Desktop2Stereo downloaded and extracted to current folder.
@REM Set paths
set "PYTHON_EXE=%APP_DIR%\src\python3\python.exe"
if not exist "!PYTHON_EXE!" (
echo [Error] Python not found at !PYTHON_EXE!
echo The Desktop2Stereo workspace seems incomplete.
pause
exit /b 1
)
@REM Update pip
echo [Desktop2Stereo Patch]
@REM Install new requirements
echo.
echo - Installing new requirements
"!PYTHON_EXE!" -m pip uninstall pyaudio -y 2>nul
"!PYTHON_EXE!" -m pip install -r "%APP_DIR%\requirements.txt" --no-cache-dir --no-warn-script-location -i https://repo.huaweicloud.com/repository/pypi/simple/ --trusted-host repo.huaweicloud.com
if errorlevel 1 (
echo Failed to install requirements
pause
exit /b 1
)
echo Python environment updated successfully.
pause
exit /b 0