plistsync.core.trackΒΆ
Abstract representation of a music track.
OverviewΒΆ
Global Unique identifiers for a track. |
|
Locally scoped identifiers for a track. |
|
A serialized track. |
|
An abstract class representing a track. |
|
A offline (in memory) track with attached service. |
Module ContentsΒΆ
- class plistsync.core.track.GlobalTrackIDsΒΆ
Bases:
TypedDictGlobal Unique identifiers for a track.
Each identifier in this collection should uniquely identify a track across all systems and collections. Unlike local identifiers, these are intended to allow unambiguous track matching across devices, libraries, or services.
Corresponds to collections-protocol GlobalLookup.
- class plistsync.core.track.LocalTrackIDsΒΆ
Bases:
TypedDictLocally scoped identifiers for a track.
These identifiers are unique only within a specific collection or context, such as a local library, playlist, database, or device. They are intended for identifying a track within that local scope and may not be unique globally.
Corresponds to collections-protocol LocalLookup.
- file_path: pathlib.PurePathΒΆ
Local (pure) filesystem path to the track file.
This is not globally unique because file paths may differ across devices or mount points, even if the underlying track is the same. (This is also why we use PurePath, which is OS-agnostic, instead of Path.)
- class plistsync.core.track.TrackInfoΒΆ
Bases:
TypedDictA serialized track.
This is the dictionary representation of a track.
Corresponds to collections-protocol InfoLookup.
- class plistsync.core.track.TrackΒΆ
Bases:
abc.ABCAn 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 global_ids: GlobalTrackIDsΒΆ
- Abstractmethod:
The globally unique identifiers of this track.
- property local_ids: LocalTrackIDsΒΆ
- Abstractmethod:
The locally unique identifiers of this 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.
- class plistsync.core.track.OfflineTrack(info: TrackInfo, local_ids: LocalTrackIDs | None = None, global_ids: GlobalTrackIDs | None = None)ΒΆ
Bases:
TrackA 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 global_ids: GlobalTrackIDsΒΆ
The globally unique identifiers of this track.
- property local_ids: LocalTrackIDsΒΆ
The locally unique 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.