From 18d279d5179a2fe172c59db690af7ba56db1d86a Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Tue, 30 Nov 2021 20:26:27 +0300 Subject: [PATCH] Added disabling podcasts (optional) --- Install.ps1 | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index 0a6b8cc..90f4a81 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -16,6 +16,7 @@ Write-Host "*****************" $SpotifyDirectory = "$env:APPDATA\Spotify" $SpotifyExecutable = "$SpotifyDirectory\Spotify.exe" +$Podcasts_off = $false Stop-Process -Name Spotify @@ -158,6 +159,28 @@ Remove-Item -Recurse -LiteralPath $tempDirectory + + +do { + $ch = Read-Host -Prompt "Want to turn off podcasts ? (Y/N)" + if (!($ch -eq 'n' -or $ch -eq 'y')) { + + Write-Host "Oops, an incorrect value, " -ForegroundColor Red -NoNewline + Write-Host "enter again through..." -NoNewline + Start-Sleep -Milliseconds 1000 + Write-Host "3" -NoNewline + Start-Sleep -Milliseconds 1000 + Write-Host ".2" -NoNewline + Start-Sleep -Milliseconds 1000 + Write-Host ".1" + Start-Sleep -Milliseconds 1000 + Clear-Host + } +} +while ($ch -notmatch '^y$|^n$') +if ($ch -eq 'y') { $Podcasts_off = $true } + + # Мофифицируем файлы $xpui_spa_patch = "$env:APPDATA\Spotify\Apps\xpui.spa" @@ -182,6 +205,12 @@ If (Test-Path $xpui_js_patch) { <# Removing "Upgrade to premium" menu #> -replace 'visible:!e}[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.createElement[(]{1}[A-Za-z]{2}[,]{1}null[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.', $menu_split_js ` <# Disabling a playlist sponsor #> -replace "allSponsorships", "" + # Disable Podcast + if ($Podcasts_off) { + $new_js = $new_js ` + -replace '"album,playlist,artist,show,station,episode"', '"album,playlist,artist,station"' -replace ',this[.]enableShows=[a-z]', "" + } + Set-Content -Path $xpui_js_patch -Force -Value $new_js add-content -Path $xpui_js_patch -Value '// Patched by SpotX' -passthru | Out-Null $contentjs = [System.IO.File]::ReadAllText($xpui_js_patch) @@ -230,7 +259,13 @@ If (Test-Path $xpui_spa_patch) { <# Removing an empty block #> -replace 'adsEnabled:!0', 'adsEnabled:!1' ` <# Removing "Upgrade to premium" menu #> -replace 'visible:!e}[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.createElement[(]{1}[A-Za-z]{2}[,]{1}null[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.', $menu_split_js ` <# Disabling a playlist sponsor #> -replace "allSponsorships", "" ` - <# Disable Logging #> -replace "sp://logging/v3/\w+", "" + <# Disable Logging #> -replace "sp://logging/v3/\w+", "" + + # Disable Podcast + if ($Podcasts_off) { + $xpuiContents = $xpuiContents ` + -replace '"album,playlist,artist,show,station,episode"', '"album,playlist,artist,station"' -replace ',this[.]enableShows=[a-z]', "" + } $writer = New-Object System.IO.StreamWriter($entry_xpui.Open()) $writer.BaseStream.SetLength(0)