Objectο
Implements all Remote
object types for Spotify.
Classes:
|
Extracts key |
|
Generic class for storing a collection of Spotify objects that can be loaded from an API response. |
|
Extracts key |
|
Extracts key |
|
Extracts key |
- class musify.libraries.remote.spotify.object.SpotifyTrack(response, api=None, skip_checks=False)ο
Bases:
SpotifyItem
,RemoteTrack
Extracts key
track
data from a Spotify API JSON response.- Parameters:
response (
dict
[str
,Any
]) β The Spotify API JSON response.
Attributes:
A name for this object
This track's title
Joined string representation of all artists featured on this track
List of all artists featured on this track.
The album this track is featured on
The artist of the album this track is featured on
The position this track has on the album it is featured on
The track number of tracks on the album this track is featured on
List of genres for the album this track is featured on.
The year this track was released
The month this track was released
The day this track was released
The tempo of this track
The key of this track in alphabetical musical notation format
The number of the disc from the album this track is featured on
The total number the discs from the album this track is featured on
Is the album this track is featured on a compilation
Comments associated with this track set by the user
The images associated with the album this track is featured on in the form
{<image name/type>: <image link>}
Total duration of this track in seconds
The rating for this track
Methods:
refresh
([skip_checks])Refresh this object by updating from the stored API response.
load
(value,Β api[,Β features,Β analysis,Β ...])Generate a new object of this class, calling all required endpoints to get a complete set of data for this item type.
reload
([features,Β analysis,Β extend_album,Β ...])Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- property nameο
A name for this object
- property title: strο
This trackβs title
- property artistο
Joined string representation of all artists featured on this track
- property artists: list[SpotifyArtist]ο
List of all artists featured on this track.
- property albumο
The album this track is featured on
- property album_artistο
The artist of the album this track is featured on
- property track_number: intο
The position this track has on the album it is featured on
- property track_totalο
The track number of tracks on the album this track is featured on
- property genresο
List of genres for the album this track is featured on. If not found, genres from the main artist are given.
- property yearο
The year this track was released
- property monthο
The month this track was released
- property dayο
The day this track was released
- property bpmο
The tempo of this track
- property keyο
The key of this track in alphabetical musical notation format
- property disc_number: intο
The number of the disc from the album this track is featured on
- property disc_totalο
The total number the discs from the album this track is featured on
- property compilation: boolο
Is the album this track is featured on a compilation
- property commentsο
Comments associated with this track set by the user
- property image_linksο
The images associated with the album this track is featured on in the form
{<image name/type>: <image link>}
- property lengthο
Total duration of this track in seconds
- property ratingο
The rating for this track
- refresh(skip_checks=False)ο
Refresh this object by updating from the stored API response. Useful for updating stored variables after making changes to the stored API response manually.
- Return type:
None
- async classmethod load(value, api, features=False, analysis=False, extend_album=False, extend_artists=False, *_, **__)ο
Generate a new object of this class, calling all required endpoints to get a complete set of data for this item type.
value
may be:A string representing a URL/URI/ID.
A remote API JSON response for a collection with a valid ID value under an
id
key.An object of the same type as this collection. The remote API JSON response will be used to load a new object.
- Parameters:
value (
GenericAlias
[Self
]) β The value representing some remote object. See description for allowed value types.api (
SpotifyAPI
) β An authorised API object to load the object from.
- Return type:
Self
- async reload(features=False, analysis=False, extend_album=False, extend_artists=False, *_, **__)ο
Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- Return type:
None
- class musify.libraries.remote.spotify.object.SpotifyCollectionLoader(response, api=None, skip_checks=False)ο
Bases:
RemoteCollectionLoader
,SpotifyObject
,Generic
Generic class for storing a collection of Spotify objects that can be loaded from an API response.
Methods:
load
(value,Β api[,Β items,Β leave_bar])Generate a new object, calling all required endpoints to get a complete set of data for this item type.
- async classmethod load(value, api, items=(), leave_bar=True, *args, **kwargs)ο
Generate a new object, calling all required endpoints to get a complete set of data for this item type.
value
may be:A string representing a URL/URI/ID.
A remote API JSON response for a collection with a valid ID value under an
id
key.An object of the same type as this collection. The remote API JSON response will be used to load a new object.
You may also provide a set of kwargs relating that will extend aspects of the response before using it to initialise a new object. See
reload()
for possible extensions.- Parameters:
value (APIInputValueSingle[Self]) β The value representing some remote collection. See description for allowed value types.
api (SpotifyAPI) β An authorised API object to load the object from.
items (Iterable[T] (default:
()
)) β Optionally, give a list of available items to build a response for this collection. In doing so, the method will first try to find the API responses for the items of this collection in the given list before calling the API for any items not found there. This helps reduce the number of API calls made on initialisation.
- Return type:
Self
- class musify.libraries.remote.spotify.object.SpotifyPlaylist(response, api=None, skip_checks=False)ο
Bases:
SpotifyCollectionLoader
[SpotifyTrack
],RemotePlaylist
[SpotifyTrack
]Extracts key
playlist
data from a Spotify API JSON response.- Parameters:
response (
dict
[str
,Any
]) β The Spotify API JSON response
Attributes:
A name for this object
Description of this playlist
Can other users access this playlist
Are other users allowed to modify this playlist
The number of followers this playlist has
The name of the owner of this playlist
The ID of the owner of this playlist
The tracks in this playlist
The total number of tracks in this playlist
The images associated with this playlist in the form
{<image name/type>: <image link>}
datetime
object representing when the first track was added to this playlistdatetime
object representing when a track was most recently added/removedA map of
{<URI>: <date>}
for each item for when that item was added to the playlistMethods:
refresh
([skip_checks])Refresh this object by updating from the stored API response.
reload
([extend_tracks,Β extend_features])Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- property nameο
A name for this object
- property descriptionο
Description of this playlist
- property publicο
Can other users access this playlist
- property collaborativeο
Are other users allowed to modify this playlist
- property followersο
The number of followers this playlist has
- property owner_nameο
The name of the owner of this playlist
- property owner_idο
The ID of the owner of this playlist
- property tracksο
The tracks in this playlist
- property track_totalο
The total number of tracks in this playlist
- property image_linksο
The images associated with this playlist in the form
{<image name/type>: <image link>}
- property date_createdο
datetime
object representing when the first track was added to this playlist
- property date_modifiedο
datetime
object representing when a track was most recently added/removed
- property date_addedο
A map of
{<URI>: <date>}
for each item for when that item was added to the playlist
- refresh(skip_checks=False)ο
Refresh this object by updating from the stored API response. Useful for updating stored variables after making changes to the stored API response manually.
- Return type:
None
- async reload(extend_tracks=False, extend_features=False, *_, **__)ο
Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- Return type:
None
- class musify.libraries.remote.spotify.object.SpotifyAlbum(response, api=None, skip_checks=False)ο
Bases:
RemoteAlbum
[SpotifyTrack
],SpotifyCollectionLoader
[SpotifyTrack
]Extracts key
album
data from a Spotify API JSON response.- Parameters:
response (
dict
[str
,Any
]) β The Spotify API JSON response
Attributes:
The album name
The tracks on this album
List of artists ordered by frequency of appearance on the tracks on this album
Joined string representation of all artists on this album ordered by frequency of appearance
The album artist for this album
The total number of tracks on this album
List of genres ordered by frequency of appearance on the tracks on this album
The year this album was released
The month this album was released
The day this album was released
Is this album a compilation
The images associated with this album in the form
{<image name/type>: <image link>}
Rating of this album
Methods:
refresh
([skip_checks])Refresh this object by updating from the stored API response.
reload
([extend_artists,Β extend_tracks,Β ...])Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- property nameο
The album name
- property tracks: list[SpotifyTrack]ο
The tracks on this album
- property artists: list[SpotifyArtist]ο
List of artists ordered by frequency of appearance on the tracks on this album
- property artistο
Joined string representation of all artists on this album ordered by frequency of appearance
- property album_artistο
The album artist for this album
- property track_totalο
The total number of tracks on this album
- property genresο
List of genres ordered by frequency of appearance on the tracks on this album
- property yearο
The year this album was released
- property monthο
The month this album was released
- property dayο
The day this album was released
- property compilationο
Is this album a compilation
- property image_linksο
The images associated with this album in the form
{<image name/type>: <image link>}
- property ratingο
Rating of this album
- refresh(skip_checks=False)ο
Refresh this object by updating from the stored API response. Useful for updating stored variables after making changes to the stored API response manually.
- Return type:
None
- async reload(extend_artists=False, extend_tracks=False, extend_features=False, *_, **__)ο
Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- Return type:
None
- class musify.libraries.remote.spotify.object.SpotifyArtist(response, api=None, skip_checks=False)ο
Bases:
RemoteArtist
[SpotifyAlbum
],SpotifyCollectionLoader
[SpotifyAlbum
]Extracts key
artist
data from a Spotify API JSON response.Attributes:
The artist name
The albums this artist is featured on
The artist name
List of albums ordered by frequency of appearance on the tracks by this artist
List of genres for this artist
The images associated with this artist in the form
{<image name/type>: <image link>}
The popularity of this artist
The total number of followers for this artist
Methods:
refresh
([skip_checks])Refresh this object by updating from the stored API response.
reload
([extend_albums,Β extend_tracks,Β ...])Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- property nameο
The artist name
- property items: list[SpotifyAlbum]ο
The albums this artist is featured on
- property artistο
The artist name
- property albums: list[SpotifyAlbum]ο
List of albums ordered by frequency of appearance on the tracks by this artist
- property genresο
List of genres for this artist
- property image_linksο
The images associated with this artist in the form
{<image name/type>: <image link>}
- property ratingο
The popularity of this artist
- property followers: int | Noneο
The total number of followers for this artist
- refresh(skip_checks=False)ο
Refresh this object by updating from the stored API response. Useful for updating stored variables after making changes to the stored API response manually.
- Return type:
None
- async reload(extend_albums=False, extend_tracks=False, extend_features=False, *_, **__)ο
Reload this object from the API, calling all required endpoints to get a complete set of data for this item type.
- Return type:
None