Music Playlist (MPL) format handler
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file music_playlist_format-0.1.0.tar.gz.
File metadata
- Download URL: music_playlist_format-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ea0158b169de3175a81cdf68de063fbd02c0572bd55175f7f0e4f14b2833f1b
|
|
| MD5 |
825366d038fc3822143c14d4510d4490
|
|
| BLAKE2b-256 |
629928861498e3cb8c3d984c5b52092b3cd7ff9452977fb5d0bf04f0c3530ba0
|
File details
Details for the file music_playlist_format-0.1.0-py3-none-any.whl.
File metadata
- Download URL: music_playlist_format-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38641ca577e12dac26f9cab3a5fbcee10623a5f7892bbf7f77df90f332370668
|
|
| MD5 |
73710a9922470eba4e0b4e4079d68374
|
|
| BLAKE2b-256 |
2b8fe96096810218a9aea072c5f5683c6f3f236720e6fbc82079108d7fb1573c
|