From 288bc06997968e2818a9f1ab90ed8d07e3f94718 Mon Sep 17 00:00:00 2001 From: Nuzair Rasheed <38219313+rednek46@users.noreply.github.com> Date: Tue, 31 Mar 2020 02:02:06 +0530 Subject: [PATCH] Enhancement requested in the issues and a bug fix. (#26) * Two enhancements The bat file now downloads the latest available patch (chrome_elf.zip) from github and applies it. So it is upto date always as requested by @HostFat . Another minor bug fix, the older bat when run accidentally again, re-patches spotify and the backup original chrome_elf.dll will be removed which is now fixed. The bat now checks if there is any backup present. * Two Enchancements. The bat file now downloads the latest available patch (chrome_elf.zip) from github and applies it. Requested by @HostFat . Another minor bug fix, the older bat when run again accidentally, re-patches spotify and the original chrome_elf.dll backup will be removed which is now fixed. The bat will now only create a backup if its a newer installation/if there is no backup. This also ensures updating the patch without losing the original files. --- BlockTheSpot.bat | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/BlockTheSpot.bat b/BlockTheSpot.bat index d8a147c..836468c 100644 --- a/BlockTheSpot.bat +++ b/BlockTheSpot.bat @@ -18,10 +18,17 @@ if %errorlevel% EQU 0 ( for /f delims^=^"^ tokens^=2 %%A in ('reg query HKCR\spotify\shell\open\command') do ( if exist "%%~dpA\Spotify.exe" set p=%%~dpA ) + +echo Downloading latest patch (chrome_elf.zip) +echo. +powershell.exe -ExecutionPolicy Bypass -Command (new-object System.Net.WebClient).DownloadFile('https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip','%~p0chrome_elf.zip') +echo Patching Spotify.. + if defined p ( - echo Patching Spotify powershell -command "Expand-Archive -Force '%~dp0chrome_elf.zip' '%~dp0'" - move "%APPDATA%\Spotify\chrome_elf.dll" "%APPDATA%\Spotify\chrome_elf.dll.bak" > NUL 2>&1 + if not exist "%APPDATA%\Spotify\chrome_elf.dll.bak" ( + move "%APPDATA%\Spotify\chrome_elf.dll" "%APPDATA%\Spotify\chrome_elf.dll.bak" > NUL 2>&1 + ) copy chrome_elf.dll "%APPDATA%\Spotify\" > NUL 2>&1 copy config.ini "%APPDATA%\Spotify\" > NUL 2>&1 del /s /q "chrome_elf.dll" > NUL 2>&1 @@ -43,6 +50,5 @@ if defined p ( del /s /q "chrome_elf.dll" > NUL 2>&1 del /s /q "config.ini" > NUL 2>&1 echo Patching Completed - start "" "%appdata%\Spotify\Spotify.exe" ) -pause +pause \ No newline at end of file