
Spotify
- 13 installs
- Updated January 22, 2026
- rbouschery/marketplace
Helps with ai & agent building tasks.
About
spotify is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- spotify
- AI & Agent Building
- AI-coding skill
Spotify by the numbers
- 13 all-time installs (skills.sh)
- Ranked #11,389 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/rbouschery/marketplace --skill spotifyAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 13 |
|---|---|
| Last updated | January 22, 2026 |
| Repository | rbouschery/marketplace ↗ |
What it does
Helps with ai & agent building tasks.
Files
Spotify Mac Skill
This skill provides commands to control Spotify on macOS via AppleScript.
Available Scripts
All scripts are in the ./scripts/ directory (relative to this file). Execute them via bash from the plugin root.
Playback Control
| Script | Purpose | Arguments |
|---|---|---|
play.sh | Resume playback | none |
pause.sh | Pause playback | none |
toggle-playback.sh | Toggle play/pause | none |
next-track.sh | Skip to next track | none |
previous-track.sh | Go to previous track | none |
play-uri.sh | Play specific URI | <spotify_uri> [context_uri] |
Search
| Script | Purpose | Arguments |
|---|---|---|
search.sh | Open Spotify search visually | <query> |
Agent-Assisted Search (Recommended): To search and play automatically, use web search to find Spotify URLs: 1. Search: site:open.spotify.com [query] (e.g., "site:open.spotify.com bohemian rhapsody") 2. Get the URL from results (e.g., https://open.spotify.com/track/6l8GvAyoUZwWDgF1e4822w) 3. Play it: play-uri.sh "https://open.spotify.com/track/..."
This works for tracks, albums, playlists, and artists.
Track Information
| Script | Purpose | Arguments |
|---|---|---|
get-current-track.sh | Get current track info | none |
get-player-state.sh | Get player state | none |
Volume Control
| Script | Purpose | Arguments |
|---|---|---|
get-volume.sh | Get current volume | none |
set-volume.sh | Set volume level | <volume 0-100> |
volume-up.sh | Increase volume by 10 | none |
volume-down.sh | Decrease volume by 10 | none |
Position Control
| Script | Purpose | Arguments |
|---|---|---|
get-position.sh | Get current position | none |
set-position.sh | Seek to position | <seconds> |
fast-forward.sh | Forward 10 seconds | none |
rewind.sh | Rewind 10 seconds | none |
Mode Control
| Script | Purpose | Arguments |
|---|---|---|
toggle-shuffle.sh | Toggle shuffle mode | none |
toggle-repeat.sh | Toggle repeat mode | none |
get-modes.sh | Get shuffle/repeat status | none |
Utility
| Script | Purpose | Arguments |
|---|---|---|
is-running.sh | Check if Spotify is running | none |
launch.sh | Launch Spotify app | none |
quit.sh | Quit Spotify | none |
Output Format
Scripts use delimiters for structured output:
<<>>separates fields within a recordERROR:prefix indicates an error message
Track Record Format
name<<>>artist<<>>album<<>>albumArtist<<>>duration<<>>position<<>>trackNumber<<>>discNumber<<>>id<<>>spotifyUrl<<>>artworkUrl<<>>popularityPlayer State Format
state<<>>position<<>>volume<<>>shuffling<<>>repeatingModes Format
shuffling<<>>repeatingUsage Examples
Basic Playback
# Play/pause
./scripts/play.sh
./scripts/pause.sh
./scripts/toggle-playback.sh
# Navigation
./scripts/next-track.sh
./scripts/previous-track.shSearch and Play (Agent-Assisted)
# Agent searches web for: site:open.spotify.com bohemian rhapsody
# Gets URL from results, then plays:
./scripts/play-uri.sh "https://open.spotify.com/track/6l8GvAyoUZwWDgF1e4822w"
# Works for any content type:
./scripts/play-uri.sh "https://open.spotify.com/playlist/37i9dQZF1DXaXB8fQg7xif"
./scripts/play-uri.sh "https://open.spotify.com/album/3BHe7LbW5yRjyqXNJ3A6mW"Visual Search (Opens Spotify App)
./scripts/search.sh "bohemian rhapsody"
./scripts/search.sh "artist:queen"
./scripts/search.sh "playlist:hot country"Play Specific Content
# Play a track
./scripts/play-uri.sh "spotify:track:4uLU6hMCjMI75M1A2tKUQC"
# Play an album
./scripts/play-uri.sh "spotify:album:7ppypgQppMf3mkRbZxYIFM"
# Play a playlist
./scripts/play-uri.sh "spotify:playlist:37i9dQZF1DXcBWIGoYBM5M"
# Play track in album context (enables album queue)
./scripts/play-uri.sh "spotify:track:xxx" "spotify:album:yyy"Get Track Information
# Get current track details
./scripts/get-current-track.sh
# Output: Song Name<<>>Artist<<>>Album<<>>Album Artist<<>>180<<>>45<<>>1<<>>1<<>>spotify:track:xxx<<>>https://open.spotify.com/track/xxx<<>>https://i.scdn.co/image/xxx<<>>75
# Get player state
./scripts/get-player-state.sh
# Output: playing<<>>45.5<<>>75<<>>false<<>>trueVolume Control
# Get current volume
./scripts/get-volume.sh
# Set specific volume
./scripts/set-volume.sh 50
# Adjust volume
./scripts/volume-up.sh
./scripts/volume-down.shSeeking
# Get current position
./scripts/get-position.sh
# Jump to 30 seconds
./scripts/set-position.sh 30
# Skip forward/backward 10 seconds
./scripts/fast-forward.sh
./scripts/rewind.shShuffle and Repeat
# Toggle modes
./scripts/toggle-shuffle.sh
./scripts/toggle-repeat.sh
# Check current modes
./scripts/get-modes.sh
# Output: true<<>>falseApp Control
# Check if running
./scripts/is-running.sh
# Launch/quit
./scripts/launch.sh
./scripts/quit.shParsing Output
When receiving track info, parse like this:
1. Split by <<>> to get fields 2. Fields are: name, artist, album, albumArtist, duration, position, trackNumber, discNumber, id, spotifyUrl, artworkUrl, popularity
Example parsing in bash:
IFS='<<>>' read -ra fields <<< "$output"
name="${fields[0]}"
artist="${fields[1]}"
album="${fields[2]}"
# ... etcSpotify URI Format
Spotify uses URIs to identify content:
- Tracks:
spotify:track:<track_id> - Albums:
spotify:album:<album_id> - Playlists:
spotify:playlist:<playlist_id> - Artists:
spotify:artist:<artist_id>
You can get URIs from:
- Spotify desktop: Right-click > Share > Copy Spotify URI
- Spotify web: Copy from URL (e.g.,
https://open.spotify.com/track/xxx->spotify:track:xxx)
Notes
- Scripts require macOS with Spotify Desktop app installed
- Works with free or premium Spotify accounts
- No authentication or API keys required
- First run may trigger macOS permission prompts for automation
- Duration is returned in seconds (converted from milliseconds)
- Position is in seconds
Limitations
AppleScript API does NOT support:
- Adding to playlists
- Viewing or managing queue
- Liking/saving tracks
- Browsing library
- Searching private/personal playlists (use play-uri.sh with the playlist URI instead)
For these features, use the Spotify Web API (requires Premium + OAuth).
Reference
For advanced AppleScript patterns and customization, see ./reference/applescript-patterns.md.
AppleScript Patterns for Spotify
This document contains AppleScript patterns for Spotify automation. Use these patterns when the provided scripts don't cover your specific use case.
Execution
All AppleScript code should be executed via osascript:
osascript <<'EOF'
tell application "Spotify"
-- AppleScript code here
end tell
EOFOr with variable interpolation (use <<EOF without quotes):
osascript <<EOF
tell application "Spotify"
play track "$SPOTIFY_URI"
end tell
EOFOutput Delimiters
For structured output that's easy to parse:
<<>>separates fields within a recordERROR:prefix indicates errors
Core Patterns
Playback Control
tell application "Spotify"
-- Basic controls
play
pause
playpause -- toggle
-- Navigation
next track
previous track
end tellSearch
-- Open search in Spotify using URI scheme
open location "spotify:search:bohemian%20rhapsody"
-- Search with filters
open location "spotify:search:artist:queen"
open location "spotify:search:album:a%20night%20at%20the%20opera"
open location "spotify:search:genre:jazz"Play Specific Content
tell application "Spotify"
-- Play a track
play track "spotify:track:4uLU6hMCjMI75M1A2tKUQC"
-- Play an album
play track "spotify:album:7ppypgQppMf3mkRbZxYIFM"
-- Play a playlist
play track "spotify:playlist:37i9dQZF1DXcBWIGoYBM5M"
-- Play track in context (e.g., within an album)
play track "spotify:track:xxx" in context "spotify:album:yyy"
end tellCurrent Track Properties
tell application "Spotify"
if player state is not stopped then
-- Basic info
set trackName to name of current track
set trackArtist to artist of current track
set trackAlbum to album of current track
set trackAlbumArtist to album artist of current track
-- Identifiers
set trackId to id of current track -- Spotify URI
set trackUrl to spotify url of current track -- Web URL
set artworkUrl to artwork url of current track
-- Metadata
set trackDuration to (duration of current track) / 1000 -- milliseconds to seconds
set trackNumber to track number of current track
set discNumber to disc number of current track
set trackPopularity to popularity of current track -- 0-100
end if
end tellPlayer State
tell application "Spotify"
-- Check state: stopped, playing, or paused
set currentState to player state
if player state is playing then
-- do something
else if player state is paused then
-- do something else
else if player state is stopped then
-- nothing playing
end if
end tellPosition Control
tell application "Spotify"
-- Get current position (in seconds)
set currentPos to player position
-- Seek to specific position
set player position to 30 -- jump to 30 seconds
-- Seek relative
set player position to (player position + 10) -- forward 10s
set player position to (player position - 10) -- back 10s
end tellVolume Control
tell application "Spotify"
-- Get volume (0-100)
set vol to sound volume
-- Set volume
set sound volume to 50
-- Adjust relative
set sound volume to (sound volume + 10) -- up 10
set sound volume to (sound volume - 10) -- down 10
end tellShuffle and Repeat
tell application "Spotify"
-- Check states
set isShuffling to shuffling
set isRepeating to repeating
-- Toggle
set shuffling to not shuffling
set repeating to not repeating
-- Set explicitly
set shuffling to true
set repeating to false
end tellCheck if Running
tell application "System Events"
if (name of processes) contains "Spotify" then
-- Spotify is running
else
-- Spotify is not running
end if
end tellLaunch and Quit
-- Launch (brings to front)
tell application "Spotify" to activate
-- Quit
tell application "Spotify" to quitError Handling
tell application "Spotify"
try
-- Your code here
next track
on error errMsg
return "ERROR:" & errMsg
end try
end tellBuilding Output Strings
tell application "Spotify"
set trackName to name of current track
set trackArtist to artist of current track
set trackAlbum to album of current track
-- Concatenate with delimiter
return trackName & "<<>>" & trackArtist & "<<>>" & trackAlbum
end tellProperty Reference
Track Properties (Read-Only)
| Property | Type | Description |
|---|---|---|
name | string | Track title |
artist | string | Artist name |
album | string | Album name |
album artist | string | Album artist |
id | string | Spotify URI |
spotify url | string | Spotify web URL |
artwork url | string | Album artwork URL |
duration | integer | Length in milliseconds |
track number | integer | Track position on album |
disc number | integer | Disc number |
popularity | integer | Popularity score (0-100) |
played count | integer | Times played |
Player Properties
| Property | Type | Read/Write | Description |
|---|---|---|---|
player state | enum | Read | stopped, playing, paused |
player position | real | Read/Write | Position in seconds |
sound volume | integer | Read/Write | Volume (0-100) |
shuffling | boolean | Read/Write | Shuffle mode |
repeating | boolean | Read/Write | Repeat mode |
shuffling enabled | boolean | Read | Shuffle available |
repeating enabled | boolean | Read | Repeat available |
current track | track | Read | Current track object |
Commands
| Command | Description |
|---|---|
play | Resume playback |
pause | Pause playback |
playpause | Toggle play/pause |
next track | Skip to next |
previous track | Go to previous |
play track | Play specific URI |
Common Issues
Spotify Not Running
Always check if Spotify is running before sending commands:
tell application "System Events"
if (name of processes) does not contain "Spotify" then
return "ERROR:Spotify is not running"
end if
end tellNo Track Playing
Check player state before accessing current track:
tell application "Spotify"
if player state is stopped then
return "ERROR:No track playing"
end if
-- Now safe to access current track
end tellPermission Errors
First run will prompt for Automation permissions in: System Settings > Privacy & Security > Automation
Allow your terminal app to control Spotify.
Dictionary Location
Spotify's AppleScript dictionary is at: /Applications/Spotify.app/Contents/Resources/Spotify.sdef
View it in Script Editor: File > Open Dictionary > Spotify
Integration Tips
1. Always use error handling - AppleScript can fail for many reasons 2. Use heredocs for complex scripts - Easier to read and maintain 3. Escape user input - Especially quotes and backslashes 4. Check player state - Before accessing current track properties 5. Convert duration - Spotify returns milliseconds, divide by 1000 for seconds
#!/bin/bash
# Fast forward 10 seconds
# Usage: ./fast-forward.sh
# Output: New position or error
osascript <<'EOF'
tell application "Spotify"
try
if player state is stopped then
return "ERROR:No track playing"
end if
set currentPos to player position
set trackLen to (duration of current track) / 1000
set newPos to currentPos + 10
if newPos > trackLen then set newPos to trackLen
set player position to newPos
return "Position: " & player position & " seconds"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Get current track information
# Usage: ./get-current-track.sh
# Output: name<<>>artist<<>>album<<>>albumArtist<<>>duration<<>>position<<>>trackNumber<<>>discNumber<<>>id<<>>spotifyUrl<<>>artworkUrl<<>>popularity
osascript <<'EOF'
tell application "Spotify"
try
if player state is stopped then
return "ERROR:No track playing"
end if
set trackName to name of current track
set trackArtist to artist of current track
set trackAlbum to album of current track
set trackAlbumArtist to album artist of current track
set trackDuration to (duration of current track) / 1000
set trackPosition to player position
set trackNum to track number of current track
set discNum to disc number of current track
set trackId to id of current track
set trackUrl to spotify url of current track
set artUrl to artwork url of current track
set trackPopularity to popularity of current track
return trackName & "<<>>" & trackArtist & "<<>>" & trackAlbum & "<<>>" & trackAlbumArtist & "<<>>" & trackDuration & "<<>>" & trackPosition & "<<>>" & trackNum & "<<>>" & discNum & "<<>>" & trackId & "<<>>" & trackUrl & "<<>>" & artUrl & "<<>>" & trackPopularity
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Get shuffle and repeat status
# Usage: ./get-modes.sh
# Output: shuffling<<>>repeating
osascript <<'EOF'
tell application "Spotify"
try
set isShuffling to shuffling
set isRepeating to repeating
return isShuffling & "<<>>" & isRepeating
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Get player state (playing/paused/stopped), position, and volume
# Usage: ./get-player-state.sh
# Output: state<<>>position<<>>volume<<>>shuffling<<>>repeating
osascript <<'EOF'
tell application "Spotify"
try
set currentState to player state as string
set currentPosition to player position
set currentVolume to sound volume
set isShuffling to shuffling
set isRepeating to repeating
return currentState & "<<>>" & currentPosition & "<<>>" & currentVolume & "<<>>" & isShuffling & "<<>>" & isRepeating
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Get current playback position in seconds
# Usage: ./get-position.sh
# Output: Position in seconds or error
osascript <<'EOF'
tell application "Spotify"
try
if player state is stopped then
return "ERROR:No track playing"
end if
return player position
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Get current volume level
# Usage: ./get-volume.sh
# Output: Volume level (0-100) or error
osascript <<'EOF'
tell application "Spotify"
try
return sound volume
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Check if Spotify is running
# Usage: ./is-running.sh
# Output: true or false
osascript <<'EOF'
tell application "System Events"
if (name of processes) contains "Spotify" then
return "true"
else
return "false"
end if
end tell
EOF
#!/bin/bash
# Launch Spotify application
# Usage: ./launch.sh
# Output: Success message or error
osascript <<'EOF'
tell application "Spotify"
try
activate
return "Spotify launched"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Skip to next track
# Usage: ./next-track.sh
# Output: Success message or error
osascript <<'EOF'
tell application "Spotify"
try
next track
delay 0.5
return "Skipped to: " & name of current track & " by " & artist of current track
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Open your library in Spotify
# Usage: ./open-library.sh
# Output: Success message or error
osascript <<'EOF'
try
open location "spotify:collection"
return "Opened your library"
on error errMsg
return "ERROR:" & errMsg
end try
EOF
#!/bin/bash
# Open and play your liked songs
# Usage: ./open-liked-songs.sh
# Output: Success message or error
osascript <<'EOF'
try
open location "spotify:internal:collection:tracks"
delay 1
tell application "Spotify"
play
end tell
delay 0.5
tell application "Spotify"
return "Playing liked songs: " & name of current track & " by " & artist of current track
end tell
on error errMsg
return "ERROR:" & errMsg
end try
EOF
#!/bin/bash
# Open your playlists in Spotify
# Usage: ./open-playlists.sh
# Output: Success message or error
osascript <<'EOF'
try
open location "spotify:playlists"
return "Opened your playlists"
on error errMsg
return "ERROR:" & errMsg
end try
EOF
#!/bin/bash
# Pause playback
# Usage: ./pause.sh
# Output: Success message or error
osascript <<'EOF'
tell application "Spotify"
try
pause
return "Playback paused"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Play specific Spotify URI or URL (track, album, or playlist)
# Usage: ./play-uri.sh <spotify_uri_or_url> [context_uri]
# Examples:
# ./play-uri.sh "spotify:track:4uLU6hMCjMI75M1A2tKUQC"
# ./play-uri.sh "https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC"
# ./play-uri.sh "spotify:album:7ppypgQppMf3mkRbZxYIFM"
# ./play-uri.sh "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
# ./play-uri.sh "spotify:track:xxx" "spotify:album:yyy" # Play track in album context
# Output: Success message or error
INPUT="${1:-}"
CONTEXT="${2:-}"
if [ -z "$INPUT" ]; then
echo "ERROR:Spotify URI or URL is required"
exit 1
fi
# Convert URL to URI if needed
if [[ "$INPUT" == https://open.spotify.com/* ]]; then
# Extract type and ID from URL
# URL format: https://open.spotify.com/TYPE/ID?si=xxx
TYPE=$(echo "$INPUT" | sed -E 's|https://open.spotify.com/([^/]+)/.*|\1|')
ID=$(echo "$INPUT" | sed -E 's|https://open.spotify.com/[^/]+/([^?]+).*|\1|')
URI="spotify:${TYPE}:${ID}"
else
URI="$INPUT"
fi
if [ -n "$CONTEXT" ]; then
osascript <<EOF
tell application "Spotify"
try
play track "$URI" in context "$CONTEXT"
-- Wait for playback to start with retries
repeat 10 times
delay 0.3
if player state is playing then exit repeat
end repeat
-- Try to get track info, but don't fail if unavailable
try
return "Playing: " & name of current track & " by " & artist of current track
on error
return "Playing: (track info loading)"
end try
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
else
osascript <<EOF
tell application "Spotify"
try
play track "$URI"
-- Wait for playback to start with retries
repeat 10 times
delay 0.3
if player state is playing then exit repeat
end repeat
-- Try to get track info, but don't fail if unavailable
try
return "Playing: " & name of current track & " by " & artist of current track
on error
return "Playing: (track info loading)"
end try
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
fi
#!/bin/bash
# Resume playback
# Usage: ./play.sh
# Output: Success message or error
osascript <<'EOF'
tell application "Spotify"
try
play
return "Playback resumed"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Go to previous track
# Usage: ./previous-track.sh
# Output: Success message or error
# Note: If more than 3 seconds into track, goes to beginning of current track
osascript <<'EOF'
tell application "Spotify"
try
previous track
delay 0.5
return "Now playing: " & name of current track & " by " & artist of current track
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Quit Spotify application
# Usage: ./quit.sh
# Output: Success message or error
osascript <<'EOF'
tell application "Spotify"
try
quit
return "Spotify quit"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Rewind 10 seconds
# Usage: ./rewind.sh
# Output: New position or error
osascript <<'EOF'
tell application "Spotify"
try
if player state is stopped then
return "ERROR:No track playing"
end if
set currentPos to player position
set newPos to currentPos - 10
if newPos < 0 then set newPos to 0
set player position to newPos
return "Position: " & player position & " seconds"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Open Spotify search for a query
# Usage: ./search.sh <query>
# Examples:
# ./search.sh "bohemian rhapsody"
# ./search.sh "artist:queen"
# ./search.sh "album:a night at the opera"
# ./search.sh "genre:jazz"
# Output: Success message or error
QUERY="${1:-}"
if [ -z "$QUERY" ]; then
echo "ERROR:Search query is required"
exit 1
fi
# URL encode the query
ENCODED_QUERY=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$QUERY'))")
osascript <<EOF
try
open location "spotify:search:$ENCODED_QUERY"
return "Searching for: $QUERY"
on error errMsg
return "ERROR:" & errMsg
end try
EOF
#!/bin/bash
# Seek to specific position in track
# Usage: ./set-position.sh <seconds>
# Output: New position or error
POSITION="${1:-}"
if [ -z "$POSITION" ]; then
echo "ERROR:Position in seconds is required"
exit 1
fi
# Validate position is a number
if ! [[ "$POSITION" =~ ^[0-9]+\.?[0-9]*$ ]]; then
echo "ERROR:Position must be a number (seconds)"
exit 1
fi
osascript <<EOF
tell application "Spotify"
try
if player state is stopped then
return "ERROR:No track playing"
end if
set player position to $POSITION
return "Position: " & player position & " seconds"
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Set volume level
# Usage: ./set-volume.sh <volume 0-100>
# Output: New volume level or error
VOLUME="${1:-}"
if [ -z "$VOLUME" ]; then
echo "ERROR:Volume level is required (0-100)"
exit 1
fi
# Validate volume is a number between 0 and 100
if ! [[ "$VOLUME" =~ ^[0-9]+$ ]] || [ "$VOLUME" -lt 0 ] || [ "$VOLUME" -gt 100 ]; then
echo "ERROR:Volume must be a number between 0 and 100"
exit 1
fi
osascript <<EOF
tell application "Spotify"
try
set sound volume to $VOLUME
return "Volume set to " & sound volume
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Toggle play/pause
# Usage: ./toggle-playback.sh
# Output: New state or error
osascript <<'EOF'
tell application "Spotify"
try
playpause
if player state is playing then
return "Now playing"
else
return "Now paused"
end if
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Toggle repeat mode
# Usage: ./toggle-repeat.sh
# Output: New repeat state or error
osascript <<'EOF'
tell application "Spotify"
try
set repeating to not repeating
if repeating then
return "Repeat: ON"
else
return "Repeat: OFF"
end if
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Toggle shuffle mode
# Usage: ./toggle-shuffle.sh
# Output: New shuffle state or error
osascript <<'EOF'
tell application "Spotify"
try
set shuffling to not shuffling
if shuffling then
return "Shuffle: ON"
else
return "Shuffle: OFF"
end if
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Decrease volume by 10
# Usage: ./volume-down.sh
# Output: New volume level or error
osascript <<'EOF'
tell application "Spotify"
try
set currentVol to sound volume
set newVol to currentVol - 10
if newVol < 0 then set newVol to 0
set sound volume to newVol
return "Volume: " & sound volume
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF
#!/bin/bash
# Increase volume by 10
# Usage: ./volume-up.sh
# Output: New volume level or error
osascript <<'EOF'
tell application "Spotify"
try
set currentVol to sound volume
set newVol to currentVol + 10
if newVol > 100 then set newVol to 100
set sound volume to newVol
return "Volume: " & sound volume
on error errMsg
return "ERROR:" & errMsg
end try
end tell
EOF