- A new parameter, "-cache_limit," has been added to modify the limit for automatic clearing of the audio cache. The old cache clearing script has been removed
- The "What's New Feed" panel has been temporarily disabled due to unstable performance.
This commit is contained in:
amd64fox
2023-05-16 16:31:37 +03:00
parent 74bf0653ec
commit ad7d5b0f72
13 changed files with 73 additions and 310 deletions

View File

@@ -1,6 +1,6 @@
@echo off
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content)} -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -cache_off -block_update_on -start_spoti -new_theme -adsections_off -lyrics_stat spotify """" | Invoke-Expression"
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content)} -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -block_update_on -start_spoti -new_theme -adsections_off -lyrics_stat spotify """" | Invoke-Expression"
pause
exit /b

View File

@@ -1,43 +0,0 @@
<#
Name: Clear Spotify Cache.
Description: The script clears outdated cache from the listened music in Spotify.
Fires every time you completely close the client (If the client was minimized to tray then the script will not work).
For the APPDATA\Spotify\Data folder, the rule is that all cache files that are not used
by the customer more than the specified number of days will be deleted.
#>
$day = 7 # Number of days after which the cache is considered stale
# Clear the \Data folder if it finds an outdated cache
try {
$SpotifyData = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Spotify\Data"
If (!(Test-Path -Path $SpotifyData)) {
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Folder Local\Spotify\Data not found" | Out-File log.txt -append
exit
}
$check = Get-ChildItem $SpotifyData -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day)
if ($check.Length -ge 1) {
$count = $check
$sum = $count | Measure-Object -Property Length -sum
if ($sum.Sum -ge 1044344824) {
$gb = "{0:N2} Gb" -f (($check | Measure-Object Length -s).sum / 1Gb)
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Removed $gb obsolete cache" | Out-File log.txt -append
}
else {
$mb = "{0:N2} Mb" -f (($check | Measure-Object Length -s).sum / 1Mb)
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Removed $mb obsolete cache" | Out-File log.txt -append
}
Get-ChildItem $SpotifyData -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day) | Remove-Item
}
if ($check.Length -lt 1) {
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Stale cache not found" | Out-File log.txt -append
}
}
catch {
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") $error[0].Exception" | Out-File log.txt -append
}
exit

View File

@@ -1,44 +0,0 @@
<#
Имя: Очистка кеша Spotify.
Описание: Скрипт очищает устаревший кеш от прослушанной музыки в Spotify.
Срабатывает каждый раз когда вы полностью закрываете клиент (Если клиент был свернут в трей то скрипт не сработает).
Для папки APPDATA\Spotify\Data действует правило, все файлы кеша которые не использовались
клиентом больше указанного количества дней будут удалены.
#>
$day = 7 # Количество дней после которых кеш считается устаревшим
# Очищаем папку \Data если был найден устаревший кеш
try {
$SpotifyData = Join-Path -Path $env:LOCALAPPDATA -ChildPath "Spotify\Data"
If (!(Test-Path -Path $SpotifyData)) {
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Папка Local\Spotify\Data не найдена" | Out-File log.txt -append
exit
}
$check = Get-ChildItem $SpotifyData -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day)
if ($check.Length -ge 1) {
$count = $check
$sum = $count | Measure-Object -Property Length -sum
if ($sum.Sum -ge 1044344824) {
$gb = "{0:N2} Gb" -f (($check | Measure-Object Length -s).sum / 1Gb)
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Удалено $gb устаревшего кеша" | Out-File log.txt -append
}
else {
$mb = "{0:N2} Mb" -f (($check | Measure-Object Length -s).sum / 1Mb)
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Удалено $mb устаревшего кеша" | Out-File log.txt -append
}
Get-ChildItem $SpotifyData -File -Recurse | Where-Object lastaccesstime -lt (get-date).AddDays(-$day) | Remove-Item
}
if ($check.Length -lt 1) {
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") Устаревшего кеша не найдено" | Out-File log.txt -append
}
}
catch {
"$(Get-Date -Format "dd/MM/yyyy HH:mm:ss") $error[0].Exception" | Out-File log.txt -append
}
exit

View File

@@ -1,3 +0,0 @@
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "%Appdata%\Spotify\cache\run_ps.bat" & Chr(34), 0
Set WshShell = Nothing

View File

@@ -1,3 +0,0 @@
@echo off
start "" /wait "%Appdata%\Spotify\Spotify.exe"
powershell.exe -ExecutionPolicy Bypass -nologo -noninteractive -command "& '.\cache_spotify.ps1'"

View File

@@ -10,7 +10,6 @@
Download3 = "Error again"
Download4 = "Check your network settings and run the installation again"
Download5 = "Downloading Spotify"
Download6 = "Curl error"
StopScript = "Script is stopped"
MsSpoti = "The Microsoft Store version of Spotify has been detected which is not supported"
MsSpoti2 = "Uninstall Spotify Microsoft Store edition [Y/N]"
@@ -37,11 +36,6 @@
UpdBlock = "Spotify updates blocked"
UpdUnblock = "Spotify updates are not blocked"
UpdSelect = "Want to block Spotify updates? [Y/N]"
CacheOn = "Audio cache cleaning is enabled ({0})"
CacheOff = "Audio cache cleaning is not enabled"
CacheSelect = "Do you want to install automatic audio cache cleaning for Spotify? [Y/N]"
CacheDays = "A cache that has not been used for more than the number of days specified by you will be deleted"
CacheDays2 = "Enter the number of days from 1 to 100"
ModSpoti = "Patching Spotify..."
Error = "Error"
FileLocBroken = "Location of Spotify files is broken, uninstall Spotify client and run the script again"

View File

@@ -10,7 +10,6 @@
Download3 = "Опять ошибка"
Download4 = "Проверьте настройки вашей сети и снова запустите установку"
Download5 = "Загрузка Spotify"
Download6 = "Curl error"
StopScript = "рипт остановлен"
MsSpoti = "Обнаружена версия Spotify из Microsoft Store, которая не поддерживается"
MsSpoti2 = "Хотите удалить Spotify Microsoft Store ? [Y/N]"
@@ -37,11 +36,6 @@
UpdBlock = "Обновления Spotify заблокированы"
UpdUnblock = "Обновления Spotify не заблокированы"
UpdSelect = "Хотите заблокировать обновления Spotify ? [Y/N]"
CacheOn = "Очистка аудио-кеша включена ({0})"
CacheOff = "Очистка аудио-кеша не включена"
CacheSelect = "Хотите установить автоматическую очистку аудио-кеша Spotify ? [Y/N]"
CacheDays = "Кеш, который не использовался больше указанного вами количества дней, будет удален"
CacheDays2 = "Пожалуйста, введите количество дней от 1 до 100"
ModSpoti = "Модифицирую Spotify..."
Error = "Ошибка"
FileLocBroken = "Расположение файлов Spotify нарушено, удалите клиент Spotify и снова запустите скрипт"