MPL – Music Playlist Format
A minimal, human‑readable playlist format designed for local music players.
MPL stores absolute file paths and partial file hashes, so tracks can be
found even after they've been moved or renamed.
Format
{
"format": "mpl/1.0",
"playlist_name": "My Mix",
"tracks": [
{
"path": "~/Music/Artist/Album/track1.flac",
"hash": "abcd123..."
},
{
"path": "~/Downloads/song2.mp3",
"hash": "abcd123..."
}
]
}
- path – absolute, UTF‑8 encoded file location
- hash –
sha256:<hexdigest>of the first 1 MB + last 1 MB + file size - format – always
mpl/1.0for this version
Installation
pip install mpl
Usage
Create a playlist
from mpl import create_playlist
tracks = [
"/home/user/Music/song1.flac",
"/home/user/Music/song2.mp3",
]
path = create_playlist(
output_path="my_playlist.mpl",
file_list=tracks,
playlist_name="My Mix",
)
print(f"Playlist saved to {path}")
Load a playlist
from mpl import load_playlist
files = load_playlist("my_playlist.mpl")
for f in files:
print(f)
Repair broken paths
If you've moved your music collection, repair_playlist scans one or more
directories, matches files by their hash, and updates the .mpl file.
from mpl import repair_playlist
fixed = repair_playlist(
"my_playlist.mpl",
search_dirs=["~/Music", "/media/external"],
)
print(f"Fixed {fixed} missing tracks.")
Advanced: message callbacks
All functions accept an optional msg_callback(level, message) (info and warning levels).
This lets you integrate with your own logging or UI without relying on stderr.
def my_logger(level, msg):
if level == "warning":
print(f"Warning: {msg}")
load_playlist("playlist.mpl", msg_callback=my_logger)
File structure
mpl/
├── __init__.py # public API
├── core.py # create_playlist, load_playlist, repair_playlist
└── helpers.py # supported audio formats, hash generation, path validation
Metadata
Release files for music-playlist-format 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| music_playlist_format-0.1.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| music_playlist_format-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / music_playlist_format-0.1.0.tar.gz
| Download URL | music_playlist_format-0.1.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ea0158b169de3175a81cdf68de063fbd02c0572bd55175f7f0e4f14b2833f1b
|
|
BLAKE2b-256 checksum How to use checksums |
629928861498e3cb8c3d984c5b52092b3cd7ff9452977fb5d0bf04f0c3530ba0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / music_playlist_format-0.1.0-py3-none-any.whl
| Download URL | music_playlist_format-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38641ca577e12dac26f9cab3a5fbcee10623a5f7892bbf7f77df90f332370668
|
|
BLAKE2b-256 checksum How to use checksums |
2b8fe96096810218a9aea072c5f5683c6f3f236720e6fbc82079108d7fb1573c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|