This script keeps your VOD library organized and current by syncing an IPTV playlist (VOD.m3u) with your local media and .strm files.
-
Scan Local Media
- Searches your existing movie and TV folders.
- Builds a cache of everything you already have locally.
-
Read the VOD Playlist
- Parses your IPTV
.m3ufile. - Lists all available titles and their stream URLs.
- Parses your IPTV
-
Filter by Region
- Uses the TMDb API to confirm each title is from an allowed country (e.g., US, GB, CA).
- Excluded titles are logged to
excluded_entries.txtfor review.
-
Compare and Sync
- If a title already exists locally, it's skipped.
- If missing, the script creates a
.strmfile pointing to the IPTV stream. - Maintains a SQLite cache to track what's new, changed, or skipped.
-
Clean Up
- Removes
.strmfiles that are no longer valid or missing from the playlist. - Cleans up empty folders or NFO-only directories.
- Removes
-
Optional: Refresh Emby
- After updates, the script can automatically trigger an Emby library refresh.
- Only new or missing titles are added as
.strmlinks. - Out-of-region content is excluded.
- Local media remains untouched.
- Emby (if configured) updates automatically.
| File | Purpose |
|---|---|
main.py |
Orchestrates the full process |
core.py |
Scans local media, normalizes titles, manages cache |
m3u_utils.py |
Parses .m3u, applies TMDb filters |
strm_utils.py |
Writes and cleans .strm files |
config.py / config.json |
Settings, paths, API keys, and filters |
/media/m3u2strm/ │ ├── Movies/ │ ├── Heat (1995)/Heat (1995).strm │ └── Inception (2010)/Inception (2010).strm │ └── TV Shows/ ├── Breaking Bad (2008)/Season 01/Breaking Bad (2008) S01E01.strm └── The Office (2005)/Season 02/The Office (2005) S02E03.strm