Controls Library¶
This will document the underlying controls library.
Structures module¶
-
class
controls.structures.
FailureReturnTypeBase
(message=None)¶ Bases:
object
A structure for unifying failure return types from a variety of functions. The class has a success variable that will be False, and a message variable. Derived types can then build on this.
-
to_dict
()¶ Utility function to convert this structure into a dictionary
-
-
class
controls.structures.
SuccessfulReturnTypeBase
¶ Bases:
object
A structure for unifying successful return types from a variety of functions. The class has a success variable that will be True. Derived types can then build on this.
-
to_dict
()¶ Utility function to convert this structure into a dictionary
-
Volume module¶
-
class
controls.volume.
SuccessfulMuteReturnType
(muted)¶ Bases:
controls.structures.SuccessfulReturnTypeBase
A structure for unifying return types from the mute-related functions
-
to_dict
()¶ Utility function to convert this structure into a dictionary
-
-
class
controls.volume.
SuccessfulVolumeReturnType
(volume)¶ Bases:
controls.structures.SuccessfulReturnTypeBase
A structure for unifying return types from the volume-related functions
-
to_dict
()¶ Utility function to convert this structure into a dictionary
-
-
class
controls.volume.
VolumeController
¶ Bases:
object
This class provides query and control functions for managing the master volume level of the system. The constructor calls the default ALSA mixer constructor, which will look for the master mixer. If the mixer cannot be constructed, an exception in the alsaaudio library is allowed to raise directly.
-
Muted
= 1¶ In alsamixer, the muted state is captured by integer zero.
-
Unmuted
= 0¶ In alsamixer, the unmuted state is captured by integer zero.
-
down_increment
()¶ This function decrements the volume of the system.
Returns: On success, it returns a SuccessfulVolumeReturnType with the current volume; on failure it returns a FailureReturnTypeBase.
-
get_volume
()¶ This function retrieves the current volume for the system.
Returns: On success, it returns a SuccessfulVolumeReturnType; on failure it returns a FailureReturnTypeBase.
-
set_mute_status
(new_mute_status=-1)¶ This function sets or toggles the mute state of the system. If no argument is provided, mute state is toggled.
Parameters: new_mute_status – If this is provided, the mute state is coerced to this updated mute state. Returns: On success, it returns a SuccessfulMuteReturnType with the updated mute state; on failure it returns a FailureReturnTypeBase.
-
up_increment
()¶ This function increments the volume of the system. If the sound was muted, this will un-mute it.
Returns: On success, it returns a SuccessfulVolumeReturnType with the current volume; on failure it returns a FailureReturnTypeBase.
-
Media module¶
-
class
controls.media.
MediaController
¶ Bases:
object
This class provides control functions for simulating media keys on the system. There is no constructor, as there is no state to persist. The functions here require the xdotool command to be available on PATH: apt-get install xdotool
-
static
next_song
()¶ This function will attempt to simulate the next song media button, which will typically also unpause music.
Returns: On success, this function returns SuccessfulReturnTypeBase; a FailureReturnTypeBase on failure
-
static
play_pause
()¶ This function will attempt to simulate the play/pause media button, either restarting music or pausing it.
Returns: On success, this function returns SuccessfulReturnTypeBase; a FailureReturnTypeBase on failure
-
static