MusicShare Local Music Sharing
Shares a local music library over the LAN so a phone can stream and download it, with an always-on signaling service and an on-demand file server.
A large local music library, a phone on the other side of the room, and no desire to leave a server running on the PC all day.
Core design: a two-layer service
This is the key trade-off in the project.
| Layer | Port | State | Responsibility |
|---|---|---|---|
| Signaling service | 19999 | Always on | Takes phone heartbeats and download requests, publishes whether the main server is online |
| Main file server | 8000 | Started on demand | Serves song files, auth and version downloads; shuts down after 30 minutes idle |
One layer alone does not work: always-on wastes CPU and memory, and switching it off means nobody receives the phone’s download request. Split in two, the PC mostly runs a single lightweight signaling process.
A full download goes: phone plugin sends a heartbeat and a download request → the PC console shows a notification → the user approves → the main server starts → the phone sees the online state and downloads → 30 minutes idle and it shuts down again.
What I built
- Auth: SQLite + bcrypt + JWT, with registration, login, password recovery and session validation on one scheme.
- Music scanning: walks the directories, parses metadata with mutagen, caches it in SQLite in WAL mode.
- LAN discovery: mDNS broadcast, so the phone never types an IP.
- Version distribution: built-in APK service with version comparison, rollback and sha256 verification.
- Desktop console: four Tkinter tabs (server / clients / download requests / updates), plus a QR code and a system tray. Background threads push events to the UI thread through a
queue.Queue, which keeps multi-threaded Tkinter from crashing. - Phone side: no new app. It reuses MusicFree’s existing player and downloader through a single music-source plugin.
Stack
Python + FastAPI + Uvicorn + SQLite + Tkinter on the desktop, and a MusicFree plugin in JavaScript on the phone.
What it left behind
Seven project tutorials covering architecture, setup, core modules and troubleshooting, preserving both the two-layer trade-off and every pitfall along the way.