M3U
The M3U implementation of a LocalPlaylist
.
Classes:
|
Stores the results of a sync with a local M3U playlist |
|
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:
The total number of tracks in the playlist before the sync.
The number of tracks added to the playlist.
The number of tracks removed from the playlist.
The number of tracks that were in the playlist before and after the sync.
The difference between the total number tracks in the playlist from before and after the sync.
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.
-
start:
- 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 playlistpath
given does not exist, a new playlist will be created onsave()
path_mapper (
PathMapper
(default:PathMapper({})
)) – Optionally, provide aPathMapper
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 aRemoteDataWrangler
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, seeLocalTrack
.
Attributes:
Extensions of files that can be loaded by this class.
Description of this playlist
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
- property image_links
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 aSyncResultM3U
object.