diff --git a/Install.ps1 b/Install.ps1 index b6699ef..0a6b8cc 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -549,7 +549,7 @@ if ($ch -eq 'y') { if ($ch -match "^[1-9][0-9]?$|^100$") { $file_cache_spotify_ps1 = Get-Content $env:APPDATA\Spotify\cache-spotify.ps1 -Raw - $new_file_cache_spotify_ps1 = $file_cache_spotify_ps1 -replace 'seven', $ch -replace '-7', - $ch + $new_file_cache_spotify_ps1 = $file_cache_spotify_ps1 -replace '-7', - $ch Set-Content -Path $env:APPDATA\Spotify\cache-spotify.ps1 -Force -Value $new_file_cache_spotify_ps1 $contentcache_spotify_ps1 = [System.IO.File]::ReadAllText("$env:APPDATA\Spotify\cache-spotify.ps1") $contentcache_spotify_ps1 = $contentcache_spotify_ps1.Trim() diff --git a/Install_rus.ps1 b/Install_rus.ps1 index 20345f4..b5c382d 100644 --- a/Install_rus.ps1 +++ b/Install_rus.ps1 @@ -549,7 +549,7 @@ if ($ch -eq 'y') { if ($ch -match "^[1-9][0-9]?$|^100$") { $file_cache_spotify_ps1 = Get-Content $env:APPDATA\Spotify\cache-spotify.ps1 -Raw - $new_file_cache_spotify_ps1 = $file_cache_spotify_ps1 -replace 'seven', $ch -replace '-7', - $ch + $new_file_cache_spotify_ps1 = $file_cache_spotify_ps1 -replace '-7', - $ch Set-Content -Path $env:APPDATA\Spotify\cache-spotify.ps1 -Force -Value $new_file_cache_spotify_ps1 $contentcache_spotify_ps1 = [System.IO.File]::ReadAllText("$env:APPDATA\Spotify\cache-spotify.ps1") $contentcache_spotify_ps1 = $contentcache_spotify_ps1.Trim() diff --git a/README.md b/README.md index 5c9f487..3f6dfdb 100644 --- a/README.md +++ b/README.md @@ -75,4 +75,4 @@ If you are using Windows 7 or Windows 8.1, there may be errors in the installati * SpotX will only work correctly on the latest versions of Spotify, please make sure of this before asking a question. * The modifiable files are replaced by the Spotify installer every time it is updated, so you will need to apply the patch again when this happens. -* SpotX will be installed even if you are using Spicetify, but you may need to run Install.bat again after running the `spicetify apply` command. +* SpotX will be installed even if you are using Spicetify, but you may need to run Install.bat again after running the `spicetify apply` or other commands. diff --git a/Spotify.vbs b/Spotify.vbs index 44e0362..bc753fb 100644 --- a/Spotify.vbs +++ b/Spotify.vbs @@ -1,3 +1,3 @@ -command = "powershell.exe -ExecutionPolicy Bypass -nologo -noninteractive -command %appdata%\Spotify\cache-spotify.ps1" +command = "powershell.exe -ExecutionPolicy Bypass -nologo -noninteractive -command %Appdata%\Spotify\cache-spotify.ps1" set shell = CreateObject("WScript.Shell") shell.Run command,0, false diff --git a/Uninstall.bat b/Uninstall.bat index b37252a..99b1ba7 100644 --- a/Uninstall.bat +++ b/Uninstall.bat @@ -6,31 +6,31 @@ echo ***************** echo Removing Patch... -if exist "%APPDATA%\Spotify\chrome_elf_bak.dll" ( - del /s /q "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1 - move "%APPDATA%\Spotify\chrome_elf_bak.dll" "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1 +if exist "%Appdata%\Spotify\chrome_elf_bak.dll" ( + del /s /q "%Appdata%\Spotify\chrome_elf.dll" > NUL 2>&1 + move "%Appdata%\Spotify\chrome_elf_bak.dll" "%Appdata%\Spotify\chrome_elf.dll" > NUL 2>&1 ) -if exist "%APPDATA%\Spotify\config.ini" ( - del /s /q "%APPDATA%\Spotify\config.ini" > NUL 2>&1 +if exist "%Appdata%\Spotify\config.ini" ( + del /s /q "%Appdata%\Spotify\config.ini" > NUL 2>&1 ) -if exist "%APPDATA%\Spotify\Apps\xpui.bak" ( - del /s /q "%APPDATA%\Spotify\Apps\xpui.spa" > NUL 2>&1 - move "%APPDATA%\Spotify\Apps\xpui.bak" "%APPDATA%\Spotify\Apps\xpui.spa" > NUL 2>&1 +if exist "%Appdata%\Spotify\Apps\xpui.bak" ( + del /s /q "%Appdata%\Spotify\Apps\xpui.spa" > NUL 2>&1 + move "%Appdata%\Spotify\Apps\xpui.bak" "%Appdata%\Spotify\Apps\xpui.spa" > NUL 2>&1 ) -if exist "%APPDATA%\Spotify\Apps\xpui\xpui.js.bak" ( - del /s /q "%APPDATA%\Spotify\Apps\xpui\xpui.js" > NUL 2>&1 - move "%APPDATA%\Spotify\Apps\xpui\xpui.js.bak" "%APPDATA%\Spotify\Apps\xpui\xpui.js" > NUL 2>&1 +if exist "%Appdata%\Spotify\Apps\xpui\xpui.js.bak" ( + del /s /q "%Appdata%\Spotify\Apps\xpui\xpui.js" > NUL 2>&1 + move "%Appdata%\Spotify\Apps\xpui\xpui.js.bak" "%Appdata%\Spotify\Apps\xpui\xpui.js" > NUL 2>&1 ) -if exist "%APPDATA%\Spotify\blockthespot_log.txt" ( - del /s /q "%APPDATA%\Spotify\blockthespot_log.txt" > NUL 2>&1 +if exist "%Appdata%\Spotify\blockthespot_log.txt" ( + del /s /q "%Appdata%\Spotify\blockthespot_log.txt" > NUL 2>&1 ) @@ -39,28 +39,28 @@ if exist "%localappdata%\Spotify\Update" ( ) -if exist "%APPDATA%\Spotify\SpotifyMigrator.bak" ( - rename %APPDATA%\Spotify\SpotifyMigrator.bak SpotifyMigrator.exe > NUL 2>&1 +if exist "%Appdata%\Spotify\SpotifyMigrator.bak" ( + rename %Appdata%\Spotify\SpotifyMigrator.bak SpotifyMigrator.exe > NUL 2>&1 ) -if exist "%APPDATA%\Spotify\SpotifyMigrator.exe" ( -if exist "%APPDATA%\Spotify\SpotifyMigrator.bak" ( - del /f /s /q %APPDATA%\Spotify\SpotifyMigrator.bak > NUL 2>&1 +if exist "%Appdata%\Spotify\SpotifyMigrator.exe" ( +if exist "%Appdata%\Spotify\SpotifyMigrator.bak" ( + del /f /s /q %Appdata%\Spotify\SpotifyMigrator.bak > NUL 2>&1 ) ) -if exist "%APPDATA%\Spotify\Spotify.vbs" ( - del /f /s /q %APPDATA%\Spotify\Spotify.vbs > NUL 2>&1 +if exist "%Appdata%\Spotify\Spotify.vbs" ( + del /f /s /q %Appdata%\Spotify\Spotify.vbs > NUL 2>&1 ) -if exist "%APPDATA%\Spotify\cache-spotify.ps1" ( - del /f /s /q %APPDATA%\Spotify\cache-spotify.ps1 > NUL 2>&1 - del /f /s /q %USERPROFILE%\Desktop\Spotify.lnk > NUL 2>&1 +if exist "%Appdata%\Spotify\cache-spotify.ps1" ( + del /f /s /q %Appdata%\Spotify\cache-spotify.ps1 > NUL 2>&1 + del /f /s /q %Userprofile%\Desktop\Spotify.lnk > NUL 2>&1 -SET Esc_LinkDest=%USERPROFILE%\Desktop\Spotify.lnk -SET Esc_LinkTarget=%APPDATA%\Spotify\Spotify.exe -SET Esc_WorkLinkTarget=%APPDATA%\Spotify\ +SET Esc_LinkDest=%Userprofile%\Desktop\Spotify.lnk +SET Esc_LinkTarget=%Appdata%\Spotify\Spotify.exe +SET Esc_WorkLinkTarget=%Appdata%\Spotify\ SET cSctVBS=CreateShortcut.vbs (( echo Set oWS = WScript.CreateObject^("WScript.Shell"^) diff --git a/cache-spotify.ps1 b/cache-spotify.ps1 index a449a4e..0a51077 100644 --- a/cache-spotify.ps1 +++ b/cache-spotify.ps1 @@ -1,13 +1,13 @@ # Launch Spotify.exe and wait for the process to stop Start-Process -FilePath $env:APPDATA\Spotify\Spotify.exe; wait-process -name Spotify -# This block deletes files by the last access time to it, files that have not been changed and have not been opened for more than the number of days you have selected will be deleted. (number of days = seven) +# This block deletes files by the last access time to it, files that have not been changed and have not been opened for more than the number of days you have selected will be deleted. If you need to replace with another number of days, then substitute the value in the 6th row and 113th column (The default is 7 days). If(Test-Path -Path $env:LOCALAPPDATA\Spotify\Data){ -dir $env:LOCALAPPDATA\Spotify\Data -File -Recurse |? lastaccesstime -lt (get-date).AddDays(-7) |del +Get-ChildItem $env:LOCALAPPDATA\Spotify\Data -File -Recurse |Where-Object lastaccesstime -lt (get-date).AddDays(-7) |Remove-Item } # Delete the file mercury.db if its size exceeds 100 MB. If(Test-Path -Path $env:LOCALAPPDATA\Spotify\mercury.db){ $file_mercury = Get-Item "$env:LOCALAPPDATA\Spotify\mercury.db" -if ($file_mercury.length -gt 100MB) {dir $env:LOCALAPPDATA\Spotify\mercury.db -File -Recurse|del} +if ($file_mercury.length -gt 100MB) {Get-ChildItem $env:LOCALAPPDATA\Spotify\mercury.db -File -Recurse | Remove-Item} } \ No newline at end of file diff --git a/cache_spotify_ru.ps1 b/cache_spotify_ru.ps1 index 7991bf7..afb3c36 100644 --- a/cache_spotify_ru.ps1 +++ b/cache_spotify_ru.ps1 @@ -1,13 +1,13 @@ # Запускаем Spotify.exe и ждем завершения процесса Start-Process -FilePath $env:APPDATA\Spotify\Spotify.exe; wait-process -name Spotify -# Этот блок удаляет файлы кэша по времени последнего доступа к нему, тоесть файлы которые не были изменены и не открывались больше указанного вами количества дней, будут удалены. Если нужно заменить на другое значение подствьте своё число в ln 6 col 98 (количество дней = seven) +# Этот блок удаляет файлы кэша по времени последнего доступа к нему, тоесть файлы которые не были изменены и не открывались больше указанного вами количества дней, будут удалены. Если нужно заменить на другое значение подставьте своё значение в 6 строку и 118 столбец (По умолчанию равно 7 дней). If (Test-Path -Path $env:LOCALAPPDATA\Spotify\Data) { - dir $env:LOCALAPPDATA\Spotify\Data -File -Recurse | ? lastaccesstime -lt (get-date).AddDays(-7) | del + Get-ChildItem $env:LOCALAPPDATA\Spotify\Data -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-7) | Remove-Item } # Удаляем файл mercury.db если его размер привышает 100 MB. If (Test-Path -Path $env:LOCALAPPDATA\Spotify\mercury.db) { $file_mercury = Get-Item "$env:LOCALAPPDATA\Spotify\mercury.db" - if ($file_mercury.length -gt 100MB) { dir $env:LOCALAPPDATA\Spotify\mercury.db -File -Recurse | del } + if ($file_mercury.length -gt 100MB) { Get-ChildItem $env:LOCALAPPDATA\Spotify\mercury.db -File -Recurse | Remove-Item } }