Welcome to Clay’s documentation!¶
app.py¶
appsettings.py¶
Application settings manager.
-
class
clay.settings.
_Settings
[source]¶ Settings management class.
-
__weakref__
¶ list of weak references to the object (if defined)
-
_commit_edits
(config)[source]¶ Write config to file.
This method is supposed to be called only from
__exit__()
.
-
edit
()[source]¶ Return
_SettingsEditor
context manager to edit config.Settings are saved to file once the returned context manager exists.
Example usage:
from clay.settings import settings with settings.edit() as config: config['foo']['bar'] = 'baz'
-
get
(key, *sections)[source]¶ Return their configuration key in a specified section By default it looks in play_settings.
-
get_default_config_section
(*sections)[source]¶ Always get a section from the default/system configuration. You would use this whenever you need to loop through all the values in a section. In the user config they might be incomplete.
-
-
class
clay.settings.
_SettingsEditor
(original_config, commit_callback)[source]¶ Thread-safe settings editor context manager.
For example see
edit()
.-
__init__
(original_config, commit_callback)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__weakref__
¶ list of weak references to the object (if defined)
-
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.
player.py¶
songlist.py¶
playbar.py¶
mylibrary.py¶
myplaylists.py¶
playerqueue.py¶
settings.py¶
settings.py¶
page¶
Generic page classes.
notifications.py¶
Notification widgets.
-
class
clay.notifications.
_Notification
(area, notification_id, message)[source]¶ Single notification widget. Can be updated or closed.
-
__init__
(area, notification_id, message)[source]¶ Parameters: - widget_list – iterable of flow or box widgets
- dividechars – number of blank characters between columns
- focus_column – index into widget_list of column in focus,
if
None
the first selectable widget will be chosen. - min_width – minimum width for each column which is not calling widget.pack() in widget_list.
- box_columns – a list of column indexes containing box widgets whose height is set to the maximum of the rows required by columns not listed in box_columns.
widget_list may also contain tuples such as:
- (given_width, widget)
- make this column given_width screen columns wide, where given_width is an int
- (
'pack'
, widget) - call
pack()
to calculate the width of this column - (
'weight'
, weight, widget) - give this column a relative weight (number) to calculate its width from the screen columns remaining
Widgets not in a tuple are the same as (
'weight'
,1
, widget)If the Columns widget is treated as a box widget then all children are treated as box widgets, and box_columns is ignored.
If the Columns widget is treated as a flow widget then the rows are calculated as the largest rows() returned from all columns except the ones listed in box_columns. The box widgets in box_columns will be displayed with this calculated number of rows, filling the full height.
-
id
¶ Notification ID.
-
is_alive
¶ Return True if notification is currently visible.
-
-
class
clay.notifications.
_NotificationArea
[source]¶ Notification area widget.
-
__init__
()[source]¶ Parameters: - widget_list (iterable) – child widgets
- focus_item (Widget or int) – child widget that gets the focus initially. Chooses the first selectable widget if unset.
widget_list may also contain tuples such as:
- (given_height, widget)
- always treat widget as a box widget and give it given_height rows, where given_height is an int
- (
'pack'
, widget) - allow widget to calculate its own height by calling its
rows()
method, ie. treat it as a flow widget. - (
'weight'
, weight, widget) - if the pile is treated as a box widget then treat widget as a box
widget with a height based on its relative weight value, otherwise
treat the same as (
'pack'
, widget).
Widgets not in a tuple are the same as (
'weight'
,1
, widget)`Note
If the Pile is treated as a box widget there must be at least one
'weight'
tuple inwidget_list
.
-
hotkeys.py¶
Hotkeys management. Requires “gi” package and “Gtk” & “Keybinder” modules.
eventhook.py¶
Events implemetation for signal handling.
meta.py¶
Predefined values.