Objectο
The core abstract implementations of MusifyItem
and MusifyCollection
classes.
Classes:
|
Represents a track including its metadata/tags/properties. |
|
A playlist of items and their derived properties/objects. |
|
A library of items and playlists and other object types. |
|
A folder of items and their derived properties/objects |
|
An album of items and their derived properties/objects. |
|
An artist of items and their derived properties/objects. |
|
A genre of items and their derived properties/objects. |
- class musify.libraries.core.object.Trackο
Bases:
MusifyItem
,HasLength
Represents a track including its metadata/tags/properties.
Attributes:
This track's title
This track's title
Joined string representation of all artists featured on this track
List of all artists featured on this track.
The album this track is featured on
The artist of the album this track is featured on
The position this track has on the album it is featured on
The track number of tracks on the album this track is featured on
List of genres associated with this track
A
date
object representing the release date of this trackThe year this track was released
The month this track was released
The day this track was released
The tempo of this track
The key of this track in alphabetical musical notation format
The number of the disc from the album this track is featured on
The total number the discs from the album this track is featured on
Is the album this track is featured on a compilation
Comments associated with this track set by the user
The images associated with the album this track is featured on in the form
{<image name/type>: <image link>}
Does the album this track is associated with have an image
Total duration of this track in seconds
The rating for this track
- kind = 2ο
- property name: strο
This trackβs title
- abstract property title: str | Noneο
This trackβs title
- abstract property artist: str | Noneο
Joined string representation of all artists featured on this track
- abstract property album: str | Noneο
The album this track is featured on
- abstract property album_artist: str | Noneο
The artist of the album this track is featured on
- abstract property track_number: int | Noneο
The position this track has on the album it is featured on
- abstract property track_total: int | Noneο
The track number of tracks on the album this track is featured on
- abstract property genres: list[str] | Noneο
List of genres associated with this track
- abstract property year: int | Noneο
The year this track was released
- abstract property month: int | Noneο
The month this track was released
- abstract property day: int | Noneο
The day this track was released
- abstract property bpm: float | Noneο
The tempo of this track
- abstract property key: str | Noneο
The key of this track in alphabetical musical notation format
- abstract property disc_number: int | Noneο
The number of the disc from the album this track is featured on
- abstract property disc_total: int | Noneο
The total number the discs from the album this track is featured on
- abstract property compilation: bool | Noneο
Is the album this track is featured on a compilation
- abstract property comments: list[str] | Noneο
Comments associated with this track set by the user
- abstract property image_links: dict[str, str | Path | URL]ο
The images associated with the album this track is featured on in the form
{<image name/type>: <image link>}
- property has_image: boolο
Does the album this track is associated with have an image
- abstract property length: float | Noneο
Total duration of this track in seconds
- abstract property rating: float | Noneο
The rating for this track
- class musify.libraries.core.object.Playlistο
Bases:
MusifyCollection
,Generic
A playlist of items and their derived properties/objects.
Attributes:
The name of this playlist
Description of this playlist
The tracks in this collection
The tracks in this playlist
The total number of tracks in this playlist
The images associated with this playlist in the form
{<image name/type>: <image link>}
Does this playlist have an image
Total duration of all tracks in this playlist in seconds
datetime.datetime
object representing when the playlist was createddatetime.datetime
object representing when the playlist was last modifiedMethods:
merge
(other[,Β reference])Merge tracks in this playlist with another collection, synchronising tracks between the two.
- kind = 1ο
- abstract property nameο
The name of this playlist
- abstract property description: str | Noneο
Description of this playlist
- property itemsο
The tracks in this collection
- abstract property tracks: list[T]ο
The tracks in this playlist
- property track_total: intο
The total number of tracks in this playlist
- abstract property image_links: dict[str, str]ο
The images associated with this playlist in the form
{<image name/type>: <image link>}
- property has_image: boolο
Does this playlist have an image
- property lengthο
Total duration of all tracks in this playlist in seconds
- abstract property date_created: datetime | Noneο
datetime.datetime
object representing when the playlist was created
- abstract property date_modified: datetime | Noneο
datetime.datetime
object representing when the playlist was last modified
- merge(other, reference=None)ο
Merge tracks in this playlist with another collection, synchronising tracks between the two. Only modifies this playlist.
Sort order is not preserved when merging. Any items that need to be added to this playlist will be added at the end of the playlist. Duplicates that are present in the
other
collection are filtered out by default.- Parameters:
other (Iterable[T]) β The collection of items to merge onto this playlist.
reference (Self | None (default:
None
)) β Optionally, provide a reference playlist to compare both the current playlist and theother
items to. The function will determine tracks to remove from this playlist based on the reference. Useful for using this function as a synchronizer where the reference refers to the playlist at the previous sync.
- Return type:
None
- class musify.libraries.core.object.Libraryο
Bases:
MusifyCollection
,Generic
A library of items and playlists and other object types.
Attributes:
The library name
The tracks in this collection
Total duration of all tracks in this library in seconds
The tracks in this library
The total number of tracks in this library
All unique tracks from all playlists in this library
The playlists in this library
Methods:
load
()Implementations of this function should load all data for this library and log results.
Implementations of this function should load all tracks for this library and store them within the library object to be retrieved with property
tracks
.Log stats on currently loaded tracks
Implementations of this function should load all playlists for this library and store them within the library object to be retrieved with property
playlists
.Log stats on currently loaded playlists
merge_playlists
(playlists[,Β reference])Merge playlists from given list/map/library to this library.
- abstract property nameο
The library name
- source = ''ο
- property itemsο
The tracks in this collection
- property lengthο
Total duration of all tracks in this library in seconds
- abstract property tracks: list[T]ο
The tracks in this library
- property track_total: intο
The total number of tracks in this library
- property tracks_in_playlists: set[T]ο
All unique tracks from all playlists in this library
- abstract async load()ο
Implementations of this function should load all data for this library and log results.
- abstract async load_tracks()ο
Implementations of this function should load all tracks for this library and store them within the library object to be retrieved with property
tracks
.- Return type:
None
- abstract log_tracks()ο
Log stats on currently loaded tracks
- Return type:
None
- abstract async load_playlists()ο
Implementations of this function should load all playlists for this library and store them within the library object to be retrieved with property
playlists
.- Return type:
None
- abstract log_playlists()ο
Log stats on currently loaded playlists
- Return type:
None
- merge_playlists(playlists, reference=None)ο
Merge playlists from given list/map/library to this library.
See
Playlist.merge()
for more info.- Parameters:
playlists (LibraryMergeType[T]) β The playlists to merge onto this libraryβs playlists. If a given playlist is not found in this library, simply add the playlist to this library.
reference (LibraryMergeType[T] | None (default:
None
)) β Optionally, provide a reference playlist to compare both the current playlist and theother
items to. The function will determine tracks to remove from this playlist based on the reference. Useful for using this function as a synchronizer where the reference refers to the playlist at the previous sync.
- Return type:
None
- class musify.libraries.core.object.Folderο
Bases:
MusifyCollection
,Generic
A folder of items and their derived properties/objects
Attributes:
The folder name
The folder name
The tracks in this collection
The tracks in this folder
List of artists ordered by frequency of appearance on the tracks in this folder
List of albums ordered by frequency of appearance on the tracks in this folder
The total number of tracks in this folder
List of genres ordered by frequency of appearance on the tracks in this folder
Is this folder a compilation
Total duration of all tracks in this folder in seconds
- abstract property nameο
The folder name
- property folder: strο
The folder name
- property itemsο
The tracks in this collection
- abstract property tracksο
The tracks in this folder
- abstract property artists: list[str]ο
List of artists ordered by frequency of appearance on the tracks in this folder
- abstract property albums: list[str]ο
List of albums ordered by frequency of appearance on the tracks in this folder
- property track_total: intο
The total number of tracks in this folder
- abstract property genres: list[str]ο
List of genres ordered by frequency of appearance on the tracks in this folder
- abstract property compilation: boolο
Is this folder a compilation
- property lengthο
Total duration of all tracks in this folder in seconds
- class musify.libraries.core.object.Albumο
Bases:
MusifyCollection
,Generic
An album of items and their derived properties/objects.
Attributes:
The album name
The tracks in this collection
The album name
The tracks on this album
Joined string representation of all artists on this album ordered by frequency of appearance
List of artists ordered by frequency of appearance on the tracks on this album
The album artist for this album
The total number of tracks on this album
List of genres ordered by frequency of appearance on the tracks on this album
A
date
object representing the release date of this albumThe year this album was released
The month this album was released
The day this album was released
The highest value of disc number on this album
Is this album a compilation
The images associated with this album in the form
{<image name/type>: <image link>}
Does this album have an image
Total duration of all tracks on this album in seconds
Rating of this album
- kind = 3ο
- abstract property name: strο
The album name
- property itemsο
The tracks in this collection
- property album: strο
The album name
- abstract property tracks: list[T]ο
The tracks on this album
- property artist: strο
Joined string representation of all artists on this album ordered by frequency of appearance
- abstract property artists: list[str | Artist]ο
List of artists ordered by frequency of appearance on the tracks on this album
- abstract property album_artist: str | Noneο
The album artist for this album
- property track_total: intο
The total number of tracks on this album
- abstract property genres: list[str]ο
List of genres ordered by frequency of appearance on the tracks on this album
- abstract property year: int | Noneο
The year this album was released
- abstract property month: int | Noneο
The month this album was released
- abstract property day: int | Noneο
The day this album was released
- property disc_total: int | Noneο
The highest value of disc number on this album
- abstract property compilation: boolο
Is this album a compilation
- abstract property image_links: dict[str, str]ο
The images associated with this album in the form
{<image name/type>: <image link>}
- property has_image: boolο
Does this album have an image
- property lengthο
Total duration of all tracks on this album in seconds
- abstract property rating: float | Noneο
Rating of this album
- class musify.libraries.core.object.Artistο
Bases:
MusifyCollection
,Generic
An artist of items and their derived properties/objects.
Attributes:
The artist name
The tracks in this collection
The artist name
The tracks by this artist
List of other artists ordered by frequency of appearance on the albums by this artist
List of albums ordered by frequency of appearance on the tracks by this artist
The total number of tracks by this artist
List of genres for this artist
Total duration of all tracks by this artist in seconds
The popularity of this artist
- kind = 4ο
- abstract property nameο
The artist name
- property itemsο
The tracks in this collection
- property artist: strο
The artist name
- abstract property tracks: list[T]ο
The tracks by this artist
- abstract property artists: list[str]ο
List of other artists ordered by frequency of appearance on the albums by this artist
- abstract property albums: list[str | Album]ο
List of albums ordered by frequency of appearance on the tracks by this artist
- property track_total: intο
The total number of tracks by this artist
- abstract property genres: list[str]ο
List of genres for this artist
- property lengthο
Total duration of all tracks by this artist in seconds
- abstract property rating: int | Noneο
The popularity of this artist
- class musify.libraries.core.object.Genreο
Bases:
MusifyCollection
,Generic
A genre of items and their derived properties/objects.
Attributes:
The genre
The tracks in this collection
The genre
The tracks for this genre
List of artists ordered by frequency of appearance on the tracks for this genre
List of albums ordered by frequency of appearance on the tracks for this genre
List of related genres ordered by frequency of appearance on the tracks for this genre
Total duration of all tracks with this genre in seconds
- abstract property nameο
The genre
- property itemsο
The tracks in this collection
- property genre: strο
The genre
- abstract property tracks: list[T]ο
The tracks for this genre
- abstract property artists: list[str]ο
List of artists ordered by frequency of appearance on the tracks for this genre
- abstract property albums: list[str]ο
List of albums ordered by frequency of appearance on the tracks for this genre
List of related genres ordered by frequency of appearance on the tracks for this genre
- property lengthο
Total duration of all tracks with this genre in seconds