Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.1.1 - Unreleased

- Add `applescript` engine for direct Spotify.app control on macOS (thanks @adam91holt)
- CI: bump golangci-lint-action to support golangci-lint v2

## 0.1.0 - 2026-01-02
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Global flags:
- `--market <cc>` market country code
- `--language <tag>` language/locale (default `en`)
- `--device <name|id>` target device
- `--engine <auto|web|connect>` API engine (default `connect`)
- `--engine <auto|web|connect|applescript>` API engine (default `connect`, `applescript` is macOS-only)
- `--json` / `--plain`
- `--no-color`
- `-q, --quiet` / `-v, --verbose` / `-d, --debug`
Expand Down
4 changes: 2 additions & 2 deletions docs/spec.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# spogo CLI spec (v0.1.0)
# spogo CLI spec (v0.1.1)

One-liner: Spotify power CLI using web cookies; search + playback control.
Parser: Kong.
Expand Down Expand Up @@ -29,7 +29,7 @@ spogo [global flags] <command> [args]
- `--market <cc>` default: account market or `US`
- `--language <tag>` default: `en`
- `--device <name|id>` default: active device
- `--engine <auto|web|connect>` default: `connect`
- `--engine <auto|web|connect|applescript>` default: `connect` (`applescript` is macOS-only)
- `--no-input`

## Commands
Expand Down
23 changes: 22 additions & 1 deletion internal/app/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,29 @@ func (c *Context) Spotify() (spotify.API, error) {
}
c.spotifyClient = client
return client, nil
case "applescript":
var fallback spotify.API
if webClient, webErr := spotify.NewClient(spotify.Options{
TokenProvider: spotify.CookieTokenProvider{
Source: source,
},
Market: c.Profile.Market,
Language: c.Profile.Language,
Device: c.Profile.Device,
Timeout: c.Settings.Timeout,
}); webErr == nil {
fallback = webClient
}
client, err := spotify.NewAppleScriptClient(spotify.AppleScriptOptions{
Fallback: fallback,
})
if err != nil {
return nil, err
}
c.spotifyClient = client
return client, nil
default:
return nil, fmt.Errorf("unknown engine %q (use auto, web, or connect)", engine)
return nil, fmt.Errorf("unknown engine %q (use auto, web, connect, or applescript)", engine)
}
}

Expand Down
22 changes: 22 additions & 0 deletions internal/app/context_applescript_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//go:build !darwin

package app

import (
"strings"
"testing"

"github.com/steipete/spogo/internal/config"
)

func TestSpotifyAppleScriptEngine_NonDarwin(t *testing.T) {
t.Parallel()

ctx := &Context{Profile: config.Profile{CookiePath: "/tmp/cookies.json", Engine: "applescript"}}
if _, err := ctx.Spotify(); err == nil || !strings.Contains(err.Error(), "only available on macOS") {
t.Fatalf("expected macOS-only error, got: %v", err)
}
if ctx.spotifyClient != nil {
t.Fatalf("expected no cached client on error")
}
}
4 changes: 2 additions & 2 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/steipete/spogo/internal/output"
)

const Version = "0.1.0"
const Version = "0.1.1"

func New() *CLI {
return &CLI{}
Expand Down Expand Up @@ -50,7 +50,7 @@ type Globals struct {
Market string `help:"Market country code." env:"SPOGO_MARKET"`
Language string `help:"Language/locale." env:"SPOGO_LANGUAGE"`
Device string `help:"Device name or id." env:"SPOGO_DEVICE"`
Engine string `help:"Engine (auto|web|connect)." env:"SPOGO_ENGINE"`
Engine string `help:"Engine (auto|web|connect|applescript)." env:"SPOGO_ENGINE"`
JSON bool `help:"JSON output." env:"SPOGO_JSON"`
Plain bool `help:"Plain output." env:"SPOGO_PLAIN"`
NoColor bool `help:"Disable color output." env:"SPOGO_NO_COLOR"`
Expand Down
Loading