Skip to content

Commit 35e407d

Browse files
committed
feat: rename block-updates to spotify-updates
1 parent ca670fa commit 35e407d

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

spicetify.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,19 @@ func main() {
150150
}
151151
return
152152

153-
case "block-updates":
153+
case "spotify-updates":
154154
commands = commands[1:]
155155
if len(commands) == 0 {
156-
utils.PrintError("No parameter given. It has to be \"on\" or \"off\".")
156+
utils.PrintError("No parameter given. It has to be \"block\" or \"unblock\".")
157157
return
158158
}
159159
param := commands[0]
160-
if param == "on" {
160+
if param == "block" {
161161
cmd.BlockSpotifyUpdates(true)
162-
} else if param == "off" {
162+
} else if param == "unblock" {
163163
cmd.BlockSpotifyUpdates(false)
164164
} else {
165-
utils.PrintError("Invalid parameter. It has to be \"on\" or \"off\".")
165+
utils.PrintError("Invalid parameter. It has to be \"block\" or \"unblock\".")
166166
}
167167
return
168168

@@ -371,7 +371,7 @@ watch Enter watch mode.
371371
restart Restart Spotify client.
372372
373373
` + utils.Bold("NON-CHAINABLE COMMANDS") + `
374-
block-updates Blocks Spotify updates. Patches spotify executable. Accepts "on" or "off" as parameter.
374+
spotify-updates Blocks Spotify updates. Patches spotify executable. Accepts "block" or "unblock" as parameter.
375375
376376
path Prints path of Spotify's executable, userdata, and more.
377377
1. Print executable path:

src/cmd/block-updates.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ import (
1111
)
1212

1313
// Block spotify updates. Taken from https://github.com/Delusoire/bespoke-cli/blob/main/cmd/spotify/update.go
14-
func BlockSpotifyUpdates(enabled bool) {
14+
func BlockSpotifyUpdates(disabled bool) {
15+
if runtime.GOOS == "linux" {
16+
utils.PrintError("Auto-updates on linux should be disabled in package manager you installed spotify with.")
17+
return
18+
}
1519
spotifyExecPath := GetSpotifyPath()
1620
switch runtime.GOOS {
1721
case "windows":
1822
spotifyExecPath = filepath.Join(spotifyExecPath, "Spotify.exe")
19-
case "linux":
20-
spotifyExecPath = filepath.Join(spotifyExecPath, "spotify")
2123
case "darwin":
2224
spotifyExecPath = filepath.Join(spotifyExecPath, "Spotify")
2325
}
@@ -39,12 +41,12 @@ func BlockSpotifyUpdates(enabled bool) {
3941
return
4042
}
4143
var str, msg string
42-
if enabled {
43-
str = "v2/update"
44-
msg = "Enabled"
45-
} else {
44+
if disabled {
4645
str = "no/thanks"
4746
msg = "Disabled"
47+
} else {
48+
str = "v2/update"
49+
msg = "Enabled"
4850
}
4951
file.WriteAt([]byte(str), int64(i+15))
5052
utils.PrintSuccess(msg + " Spotify updates!")

0 commit comments

Comments
 (0)