Playlist
A class to store playlist information. [⛓️💥 Source code]
Class definition
Initialize a Playlist object
Run output (with ID only)
[<Playlist ID: Y001>] <Playlist Name: None>: <Number of tracks in the Playlist: 0> track(s).
| Parameter | Type | Description |
|---|---|---|
p_id |
str |
Playlist ID. Must not be used before. |
Enriching a Playlist object
Redefine name and n_tracks attributes to output something else than None while calling print function on a playlist:
import libpybee
my_playlist_2 = libpybee.Playlist(p_id='Y002')
my_playlist_2.name = "My Playlist"
my_playlist_2.n_tracks = 2
print(my_playlist_2)
- The same kind of manipulation can be performed to enrich the attributes listed afterward.
- That said,
Playlistclass has been designed to be used as part of a system working withLibraryandTrackclasses.
Class variable
| Attributes | Type | Description |
|---|---|---|
all_playlists |
set |
Set containing all playlists' ID |
Class attributes
| Attributes | Type | Description | Default value | Value by calling Library |
|---|---|---|---|---|
id |
str |
Playlist Identifier | - | XML tag Playlist ID with leading (optional) zeros |
name |
str |
Playlist Name | None |
XML tag Name |
all_items |
bool |
[Unsure] Indicates whether all the music in the playlist really exists. | None |
XML tag All Items |
folder_id |
str |
Folder ID if the playlist is included in one | None |
XML tag Parent Persistent ID |
persistent_id |
str |
Playlist Persistent Identifier (randomly generated string) | None |
XML tag Persistent ID |
tracks |
list |
List of tracks included in the Playlist | Empty list | List of Track object based on information in Playlist Items XML tag |
- Attributes that can be deleted due to a lack of coherent information:
all_items: Perhaps inherited fromlibpytunes? And seems to be alwaysTrue.
Methods
to_dict
Return all attributes (name and value) for a Playlist object as Python dictionary.