Skip to content

Commit 53b83ac

Browse files
committed
Brought updater in-line with main program
Added changelog show, along with other minor modifications already made in the main program
1 parent e20ff1b commit 53b83ac

1 file changed

Lines changed: 31 additions & 8 deletions

File tree

b-e updater.bat

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ set "textgray="
99
set "textgreen="
1010
set "textred="
1111
set "formatend="
12+
(set eline=^
13+
%=this line is empty=%
14+
)
1215

1316

1417
if /i "%1"=="--silent" (
@@ -63,16 +66,28 @@ if /i "%1"=="--silent" (
6366
if not exist "%updateFileName%" (goto AutoUpdateError)
6467

6568
>%TEMP%\batch_update.tmp findstr "tag_name" %updateFileName%
66-
<%TEMP%\batch_update.tmp set /p "ver_entry="
67-
set "ver=%ver_entry:~15,-2%"
69+
<%TEMP%\batch_update.tmp set /p "entry_ver="
70+
set "ver=%entry_ver:~15,-2%"
6871
set "UpdateVersion=v%ver:~1%"
6972

73+
>%TEMP%\batch_update.tmp findstr "body" %updateFileName%
74+
<%TEMP%\batch_update.tmp set /p "entry_body="
75+
set "changelog=%entry_body:~11,-1%"
76+
set "changelog=%changelog:\n#=\n\r\n#%"
77+
set "changelog=%changelog:#=#%"
78+
set "changelog=%changelog:\r=!formatend!\r%"
79+
set "changelog=%changelog: `= %"
80+
set "changelog=%changelog:` =!formatend! %"
81+
>%TEMP%\batch_update.tmp echo %changelog%
82+
for %%? in (%TEMP%\batch_update.tmp) do (set /A strlength=%%~z? - 2)
83+
if %strlength% gtr 1000 (set "changelog=%changelog:~0,1000%... %textgray%[More]%formatend%")
84+
7085
set regex_command=powershell -Command "$x = Get-Content %updateFileName% -Raw; $k = $x | Select-String -Pattern '(?s)url(((?^^^!url).)*?)batch\.encoder'; $g = $k.Matches.Value | Select-String -Pattern '^""[^^^^"""]+?^""",'; $g.Matches.Value"
7186

72-
FOR /F "tokens=*" %%g IN ('%regex_command%') do (SET API_link_entry=%%g)
73-
set "UpdateAPIURL=%API_link_entry:~1,-2%"
87+
FOR /F "tokens=*" %%g IN ('%regex_command%') do (SET entry_APILink=%%g)
88+
set "UpdateAPIURL=%entry_APILink:~1,-2%"
7489

75-
for %%a in (ver_entry, API_link_entry, UpdateVersion, UpdateAPIURL) do if not defined %%a goto AutoUpdateError
90+
for %%a in (entry_ver, entry_APILink, UpdateVersion, UpdateAPIURL) do if not defined %%a goto AutoUpdateError
7691

7792
echo.
7893
echo %iconyellow% ^^! %formatend% Version found^^! ^(%textgreen%%UpdateVersion%^%formatend%)
@@ -92,10 +107,18 @@ if /i "%1"=="--silent" (
92107
)
93108
)
94109
move /Y "batch encoder %UpdateVersion%%append%-u.bat" "batch encoder %UpdateVersion%%append%.bat" > nul
110+
111+
echo %icongreen% i %formatend% Download complete.
112+
echo. & echo.
113+
echo %changelog:\r\n=!eline!%%formatend%
114+
echo.
115+
echo You can read the full changelog at: https://github.com/Adam-Kay/Batch-Encoder/releases
116+
echo.
117+
95118
if "%par_silent%"=="true" (
96-
echo %icongreen% i %formatend% Download complete. The program will now clean up and exit.
119+
echo The program will now clean up and exit.
97120
) else (
98-
echo %icongreen% i %formatend% Download complete. The program will now clean up and restart.
121+
echo The program will now clean up and restart.
99122
)
100123

101124
call:GrayPause
@@ -115,7 +138,7 @@ if /i "%1"=="--silent" (
115138
del "%updateFileName%"
116139
echo.
117140
echo.
118-
echo %textred%************************************************************%formatend%
141+
echo [91m____________________________________________________________%formatend%
119142
echo.
120143
echo There was a problem with the auto-updater. You can download the latest version of the program at:
121144
echo https://github.com/Adam-Kay/Batch-Encoder/releases

0 commit comments

Comments
 (0)