M3U

Inheritance diagram of musify.libraries.local.playlist.m3u

The M3U implementation of a LocalPlaylist.

Classes:

SyncResultM3U(start, added, removed, ...)

Stores the results of a sync with a local M3U playlist

M3U(path[, path_mapper, remote_wrangler])

For reading and writing data from M3U playlist format.

class musify.libraries.local.playlist.m3u.SyncResultM3U(start, added, removed, unchanged, difference, final)

Bases: Result

Stores the results of a sync with a local M3U playlist

Attributes:

start

The total number of tracks in the playlist before the sync.

added

The number of tracks added to the playlist.

removed

The number of tracks removed from the playlist.

unchanged

The number of tracks that were in the playlist before and after the sync.

difference

The difference between the total number tracks in the playlist from before and after the sync.

final

The total number of tracks in the playlist after the sync.

start: int

The total number of tracks in the playlist before the sync.

added: int

The number of tracks added to the playlist.

removed: int

The number of tracks removed from the playlist.

unchanged: int

The number of tracks that were in the playlist before and after the sync.

difference: int

The difference between the total number tracks in the playlist from before and after the sync.

final: int

The total number of tracks in the playlist after the sync.

class musify.libraries.local.playlist.m3u.M3U(path, path_mapper=PathMapper({}), remote_wrangler=None)

Bases: LocalPlaylist[FilterDefinedList[str | Path | File]]

For reading and writing data from M3U playlist format.

Parameters:
  • path (str | Path) – Absolute path of the playlist. If the playlist path given does not exist, a new playlist will be created on save()

  • path_mapper (PathMapper (default: PathMapper({}))) – Optionally, provide a PathMapper for paths stored in the playlist file. Useful if the playlist file contains relative paths and/or paths for other systems that need to be mapped to absolute, system-specific paths to be loaded and back again when saved.

  • remote_wrangler (RemoteDataWrangler (default: None)) – Optionally, provide a RemoteDataWrangler object for processing URIs on tracks. If given, the wrangler can be used when calling __get_item__ to get an item from the collection from its URI. The wrangler is also used when loading tracks to allow them to process URI tags. For more info on this, see LocalTrack.

Attributes:

valid_extensions

Extensions of files that can be loaded by this class.

description

Description of this playlist

image_links

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

Methods:

load([tracks])

Read the playlist file and update the tracks in this playlist instance.

save([dry_run])

Write the tracks in this Playlist and its settings (if applicable) to file.

valid_extensions: frozenset[str] = frozenset({'.m3u'})

Extensions of files that can be loaded by this class.

property description

Description of this playlist

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

async load(tracks=())

Read the playlist file and update the tracks in this playlist instance.

Parameters:

tracks (Collection[LocalTrack] (default: ())) – Available Tracks to search through for matches. If no tracks are given, the playlist instance will load all the tracks from scratch according to its settings.

Returns:

Self – Self

async save(dry_run=True, *_, **__)

Write the tracks in this Playlist and its settings (if applicable) to file.

Parameters:

dry_run (bool (default: True)) – Run function, but do not modify the file on the disk.

Returns:

SyncResultM3U – The results of the sync as a SyncResultM3U object.