Welcome to tinyplaylists’s documentation!¶
TinyPlaylists¶
- class tinyplaylists.main.TinyPlaylists(root: pathlib.Path)¶
The entry point for the library.
- create_playlist(name: str) tinyplaylists.playlist.Playlist¶
- find_playlist_with_track(track_id: str) tinyplaylists.playlist.Playlist¶
Find the playlist that contains the track with the given id. Raises ValueError if no playlist contains the track.
- get_playlist(name: str) tinyplaylists.playlist.Playlist¶
- get_track(id: str) tinyplaylists.track.Track¶
Find the track with the given id. Returns None if no playlist contains the track.
- import_track(file: pathlib.Path, playlist_name: str, metadata: dict) tinyplaylists.track.Track¶
- load_playlists()¶
- playlist_tracks(playlist_name: str) Dict[str, tinyplaylists.track.Track]¶
Return a dictionary of the tracks in the given playlist. The keys are the track ids.
- playlists: Dict[str, tinyplaylists.playlist.Playlist]¶
- remove_track(id: str)¶
Remove the track with the given id from the playlist.
- root: pathlib.Path¶
Playlist¶
- class tinyplaylists.playlist.Playlist(dir: pathlib.Path)¶
- dir: pathlib.Path¶
- import_track(file: pathlib.Path, metadata: dict) tinyplaylists.track.Track¶
Copy the file to the playlist directory and add a Track to the playlist.
- load_tracks()¶
- name: str¶
- remove_track(id: str)¶
Remove the track with the given id from the playlist.
- tracks: Dict[str, tinyplaylists.track.Track]¶
Track¶
- class tinyplaylists.track.Track(id: str, path: pathlib.Path, title: Union[str, NoneType], artist: Union[str, NoneType])¶
- static add_uuid_to_file(file: pathlib.Path) pathlib.Path¶
Renames the file to include a UUID. Returns the new file path.
- artist: Optional[str]¶
- static file_uuid(file_name: str) Optional[str]¶
Check if filename is formatted as .*-<uuid>.<ext> uuid is a 32-character hexadecimal string
- classmethod from_file(file: pathlib.Path)¶
Initialize a Track from a file. Adds a UUID to the file name if it doesn’t already have one.
- id: str¶
- path: pathlib.Path¶
- title: Optional[str]¶
- update_metadata(metadata: dict)¶
Adds the track metadata with the given dictionary.