gp.py¶
Google Play Music integration via gmusicapi.
-
class
clay.gp.
Artist
(artist_id, name)[source]¶ Model that represents an artist.
-
__weakref__
¶ list of weak references to the object (if defined)
-
classmethod
from_data
(data, many=False)[source]¶ Construct and return one or many
Artist
instances from Google Play Music API response.
-
id
¶ Artist ID.
-
-
class
clay.gp.
LikedSongs
[source]¶ A local model that represents the songs that a user liked and displays them as a faux playlist.
This mirrors the “liked songs” generated playlist feature of the Google Play Music apps.
-
__weakref__
¶ list of weak references to the object (if defined)
-
tracks
¶ Get a sorted list of liked tracks.
-
-
class
clay.gp.
Playlist
(playlist_id, name, tracks)[source]¶ Model that represents remotely stored (Google Play Music) playlist.
-
__init__
(playlist_id, name, tracks)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__weakref__
¶ list of weak references to the object (if defined)
-
classmethod
from_data
(data, many=False)[source]¶ Construct and return one or many
Playlist
instances from Google Play Music API response.
-
id
¶ Playlist ID.
-
-
class
clay.gp.
SearchResults
(tracks, artists)[source]¶ Model that represents search results including artists & tracks.
-
__weakref__
¶ list of weak references to the object (if defined)
-
classmethod
from_data
(data)[source]¶ Construct and return
SearchResults
instance from raw data.
-
-
class
clay.gp.
Station
(station_id, name)[source]¶ Model that represents specific station on Google Play Music.
-
__weakref__
¶ list of weak references to the object (if defined)
-
classmethod
from_data
(data, many=False)[source]¶ Construct and return one or many
Station
instances from Google Play Music API response.
-
id
¶ Station ID.
-
load_tracks_async
(**kwargs)¶ Inner function.
-
-
class
clay.gp.
Track
(source, data)[source]¶ Model that represents single track from Google Play Music.
-
__repr__
()¶ x.__str__() <==> str(x)
-
__weakref__
¶ list of weak references to the object (if defined)
-
add_to_my_library_async
(**kwargs)¶ Inner function.
-
create_station_async
(**kwargs)¶ Inner function.
-
filename
¶ Return a filename for this track.
-
classmethod
from_data
(data, source, many=False)[source]¶ Construct and return one or many
Track
instances from Google Play Music API response.
-
get_url
(callback)[source]¶ Gets playable stream URL for this track.
“callback” is called with “(url, error)” args after URL is fetched.
Keep in mind this URL is valid for a limited time.
-
id
¶ Return ID for this track.
-
remove_from_my_library_async
(**kwargs)¶ Inner function.
-
-
class
clay.gp.
_GP
[source]¶ Interface to
gmusicapi.Mobileclient
. Implements asynchronous API calls, caching and some other perks.Singleton.
-
__weakref__
¶ list of weak references to the object (if defined)
-
get_all_tracks_async
(**kwargs)¶ Inner function.
-
get_all_user_playlist_contents_async
(**kwargs)¶ Inner function.
-
get_all_user_station_contents_async
(**kwargs)¶ Inner function.
-
get_cached_tracks_map
()[source]¶ Return a dictionary of tracks where keys are strings with track IDs and values are
Track
instances.
-
get_stream_url_async
(**kwargs)¶ Inner function.
-
is_authenticated
¶ Return True if user is authenticated on Google Play Music, false otherwise.
-
is_subscribed
¶ Return True if user is subscribed on Google Play Music, false otherwise.
-
login_async
(**kwargs)¶ Inner function.
-
search
(query)[source]¶ Find tracks and return an instance of
SearchResults
.
-
search_async
(**kwargs)¶ Inner function.
-
use_authtoken_async
(**kwargs)¶ Inner function.
-
-
clay.gp.
asynchronous
(func)[source]¶ Decorates a function to become asynchronous.
Once called, runs original function in a new Thread.
Must be called with a ‘callback’ argument that will be called once thread with original function finishes. Receives two args: result and error.
- “result” contains function return value or None if there was an exception.
- “error” contains None or Exception if there was one.