plistsync.core.trackΒΆ

Abstract representation of a music track.

OverviewΒΆ

ClassesΒΆ

TrackInfo

A serialized track.

Track

An abstract class representing a track.

OfflineTrack

A offline (in memory) track with attached service.

Module ContentsΒΆ

class plistsync.core.track.TrackInfoΒΆ

Bases: TypedDict

A serialized track.

This is the dictionary representation of a track.

Corresponds to collections-protocol InfoLookup.

class plistsync.core.track.TrackΒΆ

Bases: abc.ABC

An abstract class representing a track.

A track is a piece of music. It has a title, artists, albums and identifiers. It can be used in a number of places where the generic information about a track is needed.

property info: TrackInfoΒΆ
Abstractmethod:

Get this tracks information.

property ids: frozenset[plistsync.core.ids.TrackID]ΒΆ
Abstractmethod:

The identifiers of this track.

property title: str | NoneΒΆ

The title of the track.

property artists: list[str]ΒΆ

The name of the artists.

The first artist is the main artist. If the track has no artist, return an empty list.

property albums: list[str]ΒΆ

The name of the albums the track is in.

If the track is not in any album, return empty list.

property path: pathlib.PurePath | NoneΒΆ

The path to the file of the track.

property isrc: str | NoneΒΆ

International Standard Recording Code.

property primary_artist: str | NoneΒΆ

The main artist of the track.

If the track has no artist, return an empty string.

diff(track2: Track) dictΒΆ

Return a dict of differences between this and another track.

class plistsync.core.track.OfflineTrack(info: TrackInfo, ids: collections.abc.Iterable[plistsync.core.ids.TrackID] | None = None)ΒΆ

Bases: Track

A offline (in memory) track with attached service.

This class provides a concrete implementation of Track for managing tracks in memory without any connection to online music services. It is useful as an intermediate representation during matching or syncing.

property info: TrackInfoΒΆ

Get this tracks information.

property ids: frozenset[plistsync.core.ids.TrackID]ΒΆ

The identifiers of this track.

merge(track: Track) OfflineTrackΒΆ

Merge another track into this one.

This operation returns a new offline track with the merged data.

classmethod from_track(track: Track) OfflineTrackΒΆ

Create a offline track from arbitrary other track.