spotifywebapipython.models.playerlastplayedinfo

@export
class PlayerLastPlayedInfo:

Player Last Played Information object.

Contains information about the content that was last playing on the Spotify Player, including context, item (track / episode), progress, and active device.

This is a helper object, and is not part of the Spotify Web API specification.

Initializes a new instance of the class.

Arguments:
  • root (PlayerPlayState): Spotify Web API PlayerPlayState object, used to load object attributes; otherwise, None to not load attributes.

A Context Object; can be null.

The device that was active when the item was last playing.

DeviceMusicSource: str

The device music source. This value is device manufacturer specific. For example, a Sonos source will contain values like "UNKNOWN", "SPOTIFY_CONNECT", etc.

This is a helper property, and is not part of the Spotify Web API specification.

IsAdvertisement: bool

True if the item type is an advertisement; otherwise, false.

IsDeviceState: bool

True if playstate was built from a device playstate; otherwise, false if playstate was built from a Spotify Web API playstate.

IsEmpty: bool

True if Spotify playstate returned an empty response; otherwise, false.

Note that for Sonos devices, the Spotify Web API reports an empty playstate since the SoCo API is actually controlling player.

This is a helper property, and is not part of the Spotify Web API specification.

IsMuted: bool

True if the player device volume is zero (muted) OR there is no device; otherwise, false.

IsRepeatEnabled: bool

True if repeat play (one or all) is enabled; otherwise, False.

The RepeatState property contains the actual repeat setting.

IsShuffleEnabled: bool

True if shuffle play is enabled; otherwise, False.

Item: object

The playing track or episode; can be null.

Will be of type Track, Episode, or null.

ItemType: str

The type of the item playing; can be null.
This value will be null if the Item property value is null.

If not null, it can be one of: audiobook, podcast, track.

Note that this is not a Spotify Web API property; it is loaded from our API so that the type of episode can be determined programatically (e.g. audiobook or podcast).

ProgressMS: int

Progress into the currently playing track or episode; can be null.

RepeatState: str

The repeat state of the playing track: off, track, or context.

ShuffleState: bool

If shuffle is enabled, True or False.

Summary: str

Returns a summary of what is playing.

Timestamp: int

Unix Millisecond Timestamp when data was fetched.

@classmethod
def FromDictionary( cls, data: dict) -> PlayerLastPlayedInfo:

Creates a PlayerLastPlayedInfo instance from a dictionary.

def ToDictionary(self) -> dict:

Returns a dictionary representation of the class.

def ToString(self) -> str:

Returns a displayable string representation of the class.