Object

Inheritance diagram of musify.libraries.core.object

The core abstract implementations of MusifyItem and MusifyCollection classes.

Classes:

Track()

Represents a track including its metadata/tags/properties.

Playlist()

A playlist of items and their derived properties/objects.

Library()

A library of items and playlists and other object types.

Folder()

A folder of items and their derived properties/objects

Album()

An album of items and their derived properties/objects.

Artist()

An artist of items and their derived properties/objects.

Genre()

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:

kind

name

This track's title

title

This track's title

artist

Joined string representation of all artists featured on this track

artists

List of all artists featured on this track.

album

The album this track is featured on

album_artist

The artist of the album this track is featured on

track_number

The position this track has on the album it is featured on

track_total

The track number of tracks on the album this track is featured on

genres

List of genres associated with this track

date

A date object representing the release date of this track

year

The year this track was released

month

The month this track was released

day

The day this track was released

bpm

The tempo of this track

key

The key of this track in alphabetical musical notation format

disc_number

The number of the disc from the album this track is featured on

disc_total

The total number the discs from the album this track is featured on

compilation

Is the album this track is featured on a compilation

comments

Comments associated with this track set by the user

image_links

The images associated with the album this track is featured on in the form {<image name/type>: <image link>}

has_image

Does the album this track is associated with have an image

length

Total duration of this track in seconds

rating

The rating for this track

class property kind: RemoteObjectType

The type of remote object associated with this class

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 artists: list[str | Artist]

List 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

property date: date | None

A date object representing the release date of 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

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:

kind

name

The name of this playlist

description

Description of this playlist

items

The tracks in this collection

tracks

The tracks in this playlist

track_total

The total number of tracks in this playlist

image_links

The images associated with this playlist in the form {<image name/type>: <image link>}

has_image

Does this playlist have an image

length

Total duration of all tracks in this playlist in seconds

date_created

datetime.datetime object representing when the playlist was created

date_modified

datetime.datetime object representing when the playlist was last modified

Methods:

merge(other[,Β reference])

Merge tracks in this playlist with another collection, synchronising tracks between the two.

class property kind: RemoteObjectType

The type of remote object associated with this class

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

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 the other 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:

name

The library name

source

items

The tracks in this collection

length

Total duration of all tracks in this library in seconds

tracks

The tracks in this library

track_total

The total number of tracks in this library

tracks_in_playlists

All unique tracks from all playlists in this library

playlists

The playlists in this library

Methods:

load()

Implementations of this function should load all data for this library and log results.

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.

log_tracks()

Log stats on currently loaded tracks

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.

log_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

class property source: str

The type of library loaded

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 property playlists: dict[str, Playlist[T]]

The 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 the other 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:

name

The folder name

folder

The folder name

items

The tracks in this collection

tracks

The tracks in this folder

artists

List of artists ordered by frequency of appearance on the tracks in this folder

albums

List of albums ordered by frequency of appearance on the tracks in this folder

track_total

The total number of tracks in this folder

genres

List of genres ordered by frequency of appearance on the tracks in this folder

compilation

Is this folder a compilation

length

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:

kind

name

The album name

items

The tracks in this collection

album

The album name

tracks

The tracks on this album

artist

Joined string representation of all artists on this album ordered by frequency of appearance

artists

List of artists ordered by frequency of appearance on the tracks on this album

album_artist

The album artist for this album

track_total

The total number of tracks on this album

genres

List of genres ordered by frequency of appearance on the tracks on this album

date

A date object representing the release date of this album

year

The year this album was released

month

The month this album was released

day

The day this album was released

disc_total

The highest value of disc number on this album

compilation

Is this album a compilation

image_links

The images associated with this album in the form {<image name/type>: <image link>}

has_image

Does this album have an image

length

Total duration of all tracks on this album in seconds

rating

Rating of this album

class property kind: RemoteObjectType

The type of remote object associated with this class

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

property date: date | None

A date object representing the release date of 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

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:

kind

name

The artist name

items

The tracks in this collection

artist

The artist name

tracks

The tracks by this artist

artists

List of other artists ordered by frequency of appearance on the albums by this artist

albums

List of albums ordered by frequency of appearance on the tracks by this artist

track_total

The total number of tracks by this artist

genres

List of genres for this artist

length

Total duration of all tracks by this artist in seconds

rating

The popularity of this artist

class property kind: RemoteObjectType

The type of remote object associated with this class

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:

name

The genre

items

The tracks in this collection

genre

The genre

tracks

The tracks for this genre

artists

List of artists ordered by frequency of appearance on the tracks for this genre

albums

List of albums ordered by frequency of appearance on the tracks for this genre

related_genres

List of related genres ordered by frequency of appearance on the tracks for this genre

length

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

abstract property related_genres: list[str]

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