Jukebox
Jukebox(subsonic, currentIndex, playing, gain, position, entry=None)
Bases: Model
Object that holds all the info about a jukebox.
Attributes:
Name | Type | Description |
---|---|---|
current_index |
int
|
The index in the playlist of the current playing song in the jukebox. |
playing |
bool
|
If the jukebox is playing a song or not. |
gain |
float
|
The gain of the playback of the jukebox. |
position |
int
|
How many seconds the song has been already player. |
playlist |
list[Song] | None
|
A list that holds all the info about all the songs that are in the playlist of the jukebox. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
add(songs_ids)
Add songs to the playlist of the jukebox.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
songs_ids |
list[str]
|
The IDs of the songs to add. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
clear()
Calls the "jukeboxControl" endpoint of the API with the action "clear".
:return: The object itself to allow method chaining. :rtype: Self
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
generate()
Return a new jukebox object with all the data updated from the API, using the endpoint that return the most information possible.
Useful for making copies with updated data or updating the object
itself with immutability, e.g., foo = foo.generate()
.
Returns:
Type | Description |
---|---|
Jukebox
|
A new object with all the updated info. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
remove(index)
Remove a song from the playlist of the jukebox.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the song in the playlist to remove. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
set(songs_ids)
Set the songs of the playlist of the jukebox.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
songs_ids |
list[str]
|
The IDs of the songs to be set the playlist to. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
set_gain(gain)
Set the gain of the jukebox.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gain |
float
|
The new gain of the jukebox. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
shuffle()
Shuffle the playlist of the jukebox.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
skip(index, offset=0)
Skips the current playing song of the jukebox to another one.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the song to skip to. |
required |
offset |
float
|
An offset in seconds where the playback of the song should start at. |
0
|
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_jukebox.py
start()
Start the playback of the next song in the playlist.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
stop()
Stop the playback of the jukebox.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |