Contrôle Spotify

VérifiéSûr

Contrôle la lecture de Spotify sur macOS via AppleScript. Permet de lire/mettre en pause, passer au morceau suivant/précédent, et obtenir les infos de la piste en cours. Utile pour interagir avec Spotify depuis une interface en ligne de commande.

Spar Skills Guide Bot
ProductiviteDébutant
6002/06/2026
Claude Code
#spotify#music-control#apple-script#macos#playback

Recommandé pour

Notre avis

Contrôle la lecture Spotify sur macOS à l'aide de commandes AppleScript via osascript.

Points forts

  • Permet de connaître le morceau en cours de lecture avec titre, artiste et album.
  • Commandes simples pour play, pause, morceau suivant et précédent.
  • Utilisation légère sans dépendances externes.
  • Réponse conversationnelle adaptée à l'utilisateur.

Limites

  • Fonctionne uniquement sur macOS avec l'application Spotify installée.
  • Nécessite que Spotify soit ouvert et en cours d'exécution.
  • Ne gère pas les playlists, la recherche ou le contrôle du volume.
Quand l'utiliser

Lorsque l'utilisateur souhaite interagir avec Spotify depuis le terminal ou un agent IA sur macOS.

Quand l'éviter

Sur des systèmes non macOS, ou si l'utilisateur n'utilise pas l'application Spotify (par exemple Spotify Web).

Analyse de sécurité

Sûr
Score qualité90/100

The skill only executes predefined AppleScript commands to control Spotify, with no file system modifications, network calls, or user input injection. It poses no execution risk.

Aucun point d'attention détecté

Exemples

Check current track
What song is currently playing on Spotify?
Pause playback
Pause the music on Spotify.
Skip to next track
Skip to the next track on Spotify.

name: spotify description: Control Spotify playback and check what's currently playing. Use when the user asks what music or song is playing, wants to play/pause/stop music, skip tracks, or interact with Spotify in any way. allowed-tools: Bash(osascript -e *)

Spotify Control Skill

Use AppleScript via osascript to interact with the Spotify desktop app on macOS.

When the user asks what music is playing

Run this command to get the current track info:

osascript -e '
tell application "Spotify"
  if player state is playing then
    set trackName to name of current track
    set artistName to artist of current track
    set albumName to album of current track
    set trackDuration to duration of current track
    set trackPosition to player position
    set durationSec to trackDuration / 1000
    set mins to (durationSec div 60) as integer
    set secs to (durationSec mod 60) as integer
    set posMins to (trackPosition div 60) as integer
    set posSecs to (trackPosition mod 60 div 1) as integer
    return "Now playing: " & trackName & " by " & artistName & " from the album " & albumName & " (" & posMins & ":" & (text -2 thru -1 of ("0" & posSecs)) & " / " & mins & ":" & (text -2 thru -1 of ("0" & secs)) & ")"
  else
    return "Spotify is not currently playing anything."
  end if
end tell'

Present the result conversationally to the user.

When the user asks to play music

Run: osascript -e 'tell application "Spotify" to play'

When the user asks to pause or stop music

Run: osascript -e 'tell application "Spotify" to pause'

When the user asks to skip or play the next track

Run: osascript -e 'tell application "Spotify" to next track'

When the user asks to go back or play the previous track

Run: osascript -e 'tell application "Spotify" to previous track'

Important notes

  • If Spotify is not running, tell the user to open Spotify first.
  • Keep responses short and conversational.
  • Do not use the Skill tool recursively.
Skills similaires