Playlist
Playlist(subsonic, id, name=None, songCount=None, duration=None, created=None, changed=None, comment=None, owner=None, public=None, coverArt=None, allowedUser=None, entry=None)
Bases: Model
Object that holds all the info about a playlist.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The ID of the playlist. |
name |
str | None
|
The name of the playlist. |
song_count |
int | None
|
The number of songs in the playlist. |
duration |
int | None
|
The total durations of all the songs in the playlist. |
created |
datetime | None
|
The timestamp when the playlist was created. |
changed |
datetime | None
|
The timestamp when the playlist was last edited. |
comment |
str | None
|
A comment attach with the playlist. |
owner |
User | None
|
All the info related with the user creator of the playlist. |
public |
bool | None
|
If the playlist is public or not. |
cover_art |
CoverArt | None
|
All the info related with the cover art of the playlist. |
allowed_users |
list[User] | None
|
List that holds all the info related with all the users allowed to see the playlist. |
songs |
list[Song] | None
|
List that holds all the info about all the songs in the playlist. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_playlist.py
add_songs(song_ids)
Add songs to the playlist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
song_ids |
list[str]
|
The ID of songs to add. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_playlist.py
create()
Create a playlist with the same info of the object.
Returns:
Type | Description |
---|---|
Playlist
|
The new created playlist. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_playlist.py
delete()
Delete the playlist from the server.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
generate()
Return a new playlist 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 |
---|---|
Playlist
|
A new object with all the updated info. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_playlist.py
remove_songs(songs_indexes)
Remove songs from the playlist.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
songs_indexes |
list[int]
|
The indexes of the songs to remove. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_playlist.py
update()
Updates changed info between the model and the server.
Warning
It doesn't change the list of songs in the playlist. For do
it use the add_songs
and remove_songs
methods.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |