From 35e407d5a2555a38983bb06786cb0cc9a1fa2cba Mon Sep 17 00:00:00 2001 From: ririxi Date: Sat, 7 Sep 2024 21:13:59 +0200 Subject: [PATCH] feat: rename `block-updates` to `spotify-updates` --- spicetify.go | 12 ++++++------ src/cmd/block-updates.go | 16 +++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/spicetify.go b/spicetify.go index 90860c92b2..10cd793f5a 100644 --- a/spicetify.go +++ b/spicetify.go @@ -150,19 +150,19 @@ func main() { } return - case "block-updates": + case "spotify-updates": commands = commands[1:] if len(commands) == 0 { - utils.PrintError("No parameter given. It has to be \"on\" or \"off\".") + utils.PrintError("No parameter given. It has to be \"block\" or \"unblock\".") return } param := commands[0] - if param == "on" { + if param == "block" { cmd.BlockSpotifyUpdates(true) - } else if param == "off" { + } else if param == "unblock" { cmd.BlockSpotifyUpdates(false) } else { - utils.PrintError("Invalid parameter. It has to be \"on\" or \"off\".") + utils.PrintError("Invalid parameter. It has to be \"block\" or \"unblock\".") } return @@ -371,7 +371,7 @@ watch Enter watch mode. restart Restart Spotify client. ` + utils.Bold("NON-CHAINABLE COMMANDS") + ` -block-updates Blocks Spotify updates. Patches spotify executable. Accepts "on" or "off" as parameter. +spotify-updates Blocks Spotify updates. Patches spotify executable. Accepts "block" or "unblock" as parameter. path Prints path of Spotify's executable, userdata, and more. 1. Print executable path: diff --git a/src/cmd/block-updates.go b/src/cmd/block-updates.go index 061143810c..d680fe655f 100644 --- a/src/cmd/block-updates.go +++ b/src/cmd/block-updates.go @@ -11,13 +11,15 @@ import ( ) // Block spotify updates. Taken from https://github.com/Delusoire/bespoke-cli/blob/main/cmd/spotify/update.go -func BlockSpotifyUpdates(enabled bool) { +func BlockSpotifyUpdates(disabled bool) { + if runtime.GOOS == "linux" { + utils.PrintError("Auto-updates on linux should be disabled in package manager you installed spotify with.") + return + } spotifyExecPath := GetSpotifyPath() switch runtime.GOOS { case "windows": spotifyExecPath = filepath.Join(spotifyExecPath, "Spotify.exe") - case "linux": - spotifyExecPath = filepath.Join(spotifyExecPath, "spotify") case "darwin": spotifyExecPath = filepath.Join(spotifyExecPath, "Spotify") } @@ -39,12 +41,12 @@ func BlockSpotifyUpdates(enabled bool) { return } var str, msg string - if enabled { - str = "v2/update" - msg = "Enabled" - } else { + if disabled { str = "no/thanks" msg = "Disabled" + } else { + str = "v2/update" + msg = "Enabled" } file.WriteAt([]byte(str), int64(i+15)) utils.PrintSuccess(msg + " Spotify updates!")