Song
Song(subsonic, id, title=None, parent=None, isDir=None, isVideo=None, album=None, artist=None, track=None, year=None, genre=None, coverArt=None, size=None, contentType=None, suffix=None, transcodedContentType=None, transcodedSuffix=None, duration=None, bitRate=None, path=None, userRating=None, averageRating=None, playCount=None, discNumber=None, created=None, starred=None, albumId=None, artistId=None, type=None, bookmarkPosition=None, originalWidth=None, originalHeight=None, played=None, bpm=None, comment=None, sortName=None, musicBrainzId=None, genres=None, artists=None, displayArtist=None, albumArtists=None, displayAlbumArtist=None, contributors=None, displayComposer=None, moods=None, replayGain=None, mediaType=None, **kwargs)
Bases: Model
Object that holds all the info about a song.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The ID of the song. |
title |
str | None
|
The title of the song. |
parent |
str | None
|
The ID of the parent of the song. |
track |
int | None
|
The track |
year |
int | None
|
The year when the song was released. |
genre |
Genre | None
|
All the info related with the genre of the song. |
size |
int | None
|
The size of the file of the song. |
content_type |
str | None
|
The HTTP ContentType of the file of the song. |
suffix |
str | None
|
The suffix of the filename of the file of the song. |
transcoded_content_type |
str | None
|
The HTTP ContentType of the transcoded file of the song. |
transcoded_suffix |
str | None
|
The suffix of the filename of the transcoded file of the song. |
duration |
int | None
|
The duration in seconds of the song. |
bit_rate |
int | None
|
The bit rate of the song. |
path |
str | None
|
The path of the song. |
user_rating |
int | None
|
The rating given to the song by the user. |
average_rating |
float | None
|
The average rating of all the user for the song. |
play_count |
int | None
|
The number of the times the song has been played. |
disc_number |
int | None
|
The disc number of the song. |
type |
str | None
|
The type of media. |
bookmark_position |
int | None
|
The position in seconds where the song is bookmarked for the authenticated user. |
album |
Album | None
|
All the info related with the album of the song. |
artist |
Artist | None
|
All the info related with the main artist of the song. |
cover_art |
CoverArt | None
|
All the info related with the cover art of the song. |
created |
datetime | None
|
The timestamp when the song was created. |
starred |
datetime | None
|
The timestamp when the song was starred by the authenticated user if they have. |
played |
datetime | None
|
The timestamp when the song was last played. |
bpm |
int | None
|
The bpm of the song. |
comment |
str | None
|
The comment of the song. |
sort_name |
str | None
|
The sort name of the song. |
music_brainz_id |
str | None
|
The ID of the MusicBrainz entry of the song. |
genres |
list[ItemGenre | None
|
List that holds all the info about all the genres of the song. |
artists |
list[Artist] | None
|
List that holds all the info about all the artists that made the song. |
display_artist |
str | None
|
The display name of the artist of the song. |
album_artists |
list[Artist] | None
|
List that holds all the info about all the artists that made the album where the song is from. |
display_album_artist |
str | None
|
THe display name of the artist of the album of the song. |
contributors |
list[Contributor] | None
|
List that holds all the info about all the contributors of the song. |
display_composer |
str | None
|
The display name of the composer of the song. |
moods |
list[str] | None
|
List off all the moods of the song. |
replay_gain |
ReplayGain | None
|
All the info about the replay gain of the song. |
media_type |
str | None
|
The type of media of the song. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_song.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
generate()
Return a new song 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 |
---|---|
Song
|
A new object with all the updated info. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_song.py
remove_rating()
Remove the rating for the song.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
scrobble(time, submission=True)
Scrobble the song.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time |
datetime
|
The timestamp when the song was scrobble: |
required |
submission |
bool
|
If the scrobble is a request to a submission or it is a now playing entry. |
True
|
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_song.py
set_rating(rating)
Set the rating of the song.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rating |
int
|
The new rating for the song. |
required |
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
Source code in .venv/lib/python3.11/site-packages/knuckles/models/_song.py
star()
Star the song for the authenticated user.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |
unstar()
Unstar the song for the authenticated user.
Returns:
Type | Description |
---|---|
Self
|
The object itself. |