arcade-mcp/toolkits/spotify/arcade_spotify/tools/models.py
Eric Gustin c8e686c04e
Add tools to Spotify Toolkit (#132)
# PR Description
1. `adjust_playback_position` - Adjust the playback position within the
currently playing track
2. `skip_to_previous_track` - Skip to the previous track in the user's
queue, if any
3. `skip_to_next_track` - Skip to the next track in the user's queue, if
any
4. `pause_playback` - Pause the currently playing track, if any
5. `resume_playback` - Resume the currently playing track, if any
6. `start_tracks_playback_by_id` - Start playback of a list of tracks
(songs)
7. `get_playback_state` - Get information about the user's current
playback state, including track or episode, and active device
8. `get_currently_playing` - Get information about the user's currently
playing track
9. `get_track_from_id` - Get information about a track
10. `get_recommendations` - Get track (song) recommendations based on
seed artists, genres, and tracks, and multiple target audio stats
11. `get_tracks_audio_features` - Get audio features for a list of
tracks (songs)
----------------------

My favorite feature of this toolkit is
1. Start playing my favorite song
2. Get the song that I'm currently playing
3. Get audio features of that song
4. Ask for recommended songs that are similar to it
5. Jam out

------------
2024-10-30 18:26:39 -07:00

29 lines
1.1 KiB
Python

from dataclasses import asdict, dataclass, field
from typing import Optional
@dataclass
class PlaybackState:
is_playing: Optional[bool] = None
progress_ms: Optional[int] = (
None # Progress into the currently playing track or episode in milliseconds
)
device_name: Optional[str] = None
device_id: Optional[str] = None
currently_playing_type: Optional[str] = None
album_id: Optional[str] = None
album_name: Optional[str] = None
album_artists: list[str] = field(default_factory=list)
album_spotify_url: Optional[str] = None
track_id: Optional[str] = None
track_name: Optional[str] = None
track_artists: list[str] = field(default_factory=list)
show_id: Optional[str] = None
show_spotify_url: Optional[str] = None
episode_name: Optional[str] = None
episode_spotify_url: Optional[str] = None
message: Optional[str] = None
def to_dict(self) -> dict:
"""Convert the PlaybackState instance to a dictionary, excluding None values."""
return {k: v for k, v in asdict(self).items() if v is not None and v != []}