spotcast icon indicating copy to clipboard operation
spotcast copied to clipboard

Support for Smart Shuffle

Open systematicallyrandom opened this issue 1 year ago • 3 comments

Summary

Is it possible to add support for the newer smart shuffle feature that Spotify implemented to replace the radio station feature for playlists?

Use Case

Spotify no longer supports the radio station feature for individual songs or playlists.

Benefits

No response

Potential Solutions

No response

Additional Details

No response

systematicallyrandom avatar Nov 25 '24 12:11 systematicallyrandom

@systematicallyrandom haven't found a way yet to enable smart shuffle. The API Endpoint currently only allows for a boolean value being passed, enabling the shuffle to True or False.

Technically, smart-shuffle is not really a shuffle, its actually 2 functionalities:

  1. Enables Shuffle
  2. Start adding songs to the context using a semi fixed distance with a jitter.

We can see in the playback state actually that smart_shuffle is a completely separate functionality to shuffle

{
  "device": {
    "id": "foo",
    "is_active": true,
    "is_private_session": false,
    "is_restricted": false,
    "name": "bar",
    "type": "Computer",
    "volume_percent": 100,
    "supports_volume": true
  },
  "repeat_state": "context",
  "shuffle_state": true,
  "context": {
    "type": "album",
    "href": "https://api.spotify.com/v1/albums/6yWMN087PgSimbcVmHLEwG",
    "external_urls": {
      "spotify": "https://open.spotify.com/album/6yWMN087PgSimbcVmHLEwG"
    },
    "uri": "spotify:album:6yWMN087PgSimbcVmHLEwG"
  },
  "timestamp": 1732537078305,
  "progress_ms": 319750,
  "is_playing": true,
  "item": {
    "album": {
      "album_type": "album",
      "total_tracks": 15,
      "external_urls": {
        "spotify": "https://open.spotify.com/album/6yWMN087PgSimbcVmHLEwG"
      },
      "href": "https://api.spotify.com/v1/albums/6yWMN087PgSimbcVmHLEwG",
      "id": "6yWMN087PgSimbcVmHLEwG",
      "images": [
        {
          "url": "https://i.scdn.co/image/ab67616d0000b273dce45359981d62e087a29e6f",
          "height": 640,
          "width": 640
        },
        {
          "url": "https://i.scdn.co/image/ab67616d00001e02dce45359981d62e087a29e6f",
          "height": 300,
          "width": 300
        },
        {
          "url": "https://i.scdn.co/image/ab67616d00004851dce45359981d62e087a29e6f",
          "height": 64,
          "width": 64
        }
      ],
      "name": "Ænima",
      "release_date": "1996-09-17",
      "release_date_precision": "day",
      "type": "album",
      "uri": "spotify:album:6yWMN087PgSimbcVmHLEwG",
      "artists": [
        {
          "external_urls": {
            "spotify": "https://open.spotify.com/artist/2yEwvVSSSUkcLeSTNyHKh8"
          },
          "href": "https://api.spotify.com/v1/artists/2yEwvVSSSUkcLeSTNyHKh8",
          "id": "2yEwvVSSSUkcLeSTNyHKh8",
          "name": "TOOL",
          "type": "artist",
          "uri": "spotify:artist:2yEwvVSSSUkcLeSTNyHKh8"
        }
      ],
      "is_playable": true
    },
    "artists": [
      {
        "external_urls": {
          "spotify": "https://open.spotify.com/artist/2yEwvVSSSUkcLeSTNyHKh8"
        },
        "href": "https://api.spotify.com/v1/artists/2yEwvVSSSUkcLeSTNyHKh8",
        "id": "2yEwvVSSSUkcLeSTNyHKh8",
        "name": "TOOL",
        "type": "artist",
        "uri": "spotify:artist:2yEwvVSSSUkcLeSTNyHKh8"
      }
    ],
    "disc_number": 1,
    "duration_ms": 399266,
    "explicit": true,
    "external_ids": {
      "isrc": "USZE19600150"
    },
    "external_urls": {
      "spotify": "https://open.spotify.com/track/0nLOl4fSiBZKGFla5pLUtf"
    },
    "href": "https://api.spotify.com/v1/tracks/0nLOl4fSiBZKGFla5pLUtf",
    "id": "0nLOl4fSiBZKGFla5pLUtf",
    "is_playable": true,
    "name": "Ænema",
    "popularity": 60,
    "preview_url": "https://p.scdn.co/mp3-preview/cb0d70ad5cd62af8f0d6e00953ed0c8ea2d6f89b?cid=cfe923b2d660439caf2b557b21f31221",
    "track_number": 13,
    "type": "track",
    "uri": "spotify:track:0nLOl4fSiBZKGFla5pLUtf",
    "is_local": false
  },
  "currently_playing_type": "track",
  "actions": {
    "disallows": {
      "resuming": true
    }
  },
  "smart_shuffle": false
}

We can see there are a shuffle_state key currently set to true and a smart_shuffle key toward the end set to false in this example.

At the moment, I am only aware of a way of setting the shuffle_state using the API, the smart_shuffle doesn't seem to be possible. A post in the Spotify for Developper section of their Commmunity Forum dating from septeber 2024 seems to indicate this is in fact not possible for the moment.

fcusson avatar Nov 25 '24 12:11 fcusson

Thanks for looking into it! Hopefully Spotify updates their API soon.

systematicallyrandom avatar Nov 28 '24 14:11 systematicallyrandom

@systematicallyrandom, yeah they technically updated there API recently. They removed features instead of adding some

fcusson avatar Nov 28 '24 15:11 fcusson