Skip to content

Commit

Permalink
feat: rename block-updates to spotify-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Sep 7, 2024
1 parent ca670fa commit 35e407d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 6 additions & 6 deletions spicetify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
16 changes: 9 additions & 7 deletions src/cmd/block-updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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!")
Expand Down

0 comments on commit 35e407d

Please sign in to comment.