How fairy-root/mac-to-m3u works
Project type and purpose
• This is a small CLI-based IPTV Mac-to-M3U converter consisting of three standalone Python scripts (maclist.py, macvod.py, macshow.py).
• Each script prompts for an IPTV server URL and a MAC address, invokes HTTP APIs on the IPTV server to retrieve subscription, channel, VOD, or series data, and then outputs an M3U playlist file.
File structure
• Top-level files:
• maclist.py, macvod.py, macshow.py: three entry-point scripts.
• README.md, LICENSE: documentation.
• No subdirectories—each script encapsulates its own workflow.
• Dependencies inferred from README: requests, aiohttp, tqdm.
README for additional insights
• Each script follows a similar sequence:
• Prompt → HTTP requests → Data parsing → M3U file generation.
• macvod.py and macshow.py may use aiohttp for concurrent fetching of VOD items or episodes.
• Progress bars (tqdm) are used to give feedback on long-running fetch loops.
Main components
a. User CLI (invoker)
b. Script module (one of three):
• Input Handler
• HTTP Client Layer (requests or aiohttp)
• Data Processor / Parser (JSON → internal objects)
• M3U Playlist Generator (writes .m3u file to local FS)
c. External IPTV Server (REST-style API endpoints for subscription, channel list, VOD, series)
d. Local File System (output folder for M3U playlists)
e. Third-party libraries (requests, aiohttp, tqdm)
Relationships and interactions
• User → (prompts) → Script Input Handler
• Input Handler → (build HTTP request) → HTTP Client
• HTTP Client → (GET/POST) → IPTV Server
• IPTV Server → (JSON/XML payload) → HTTP Client
• HTTP Client → Data Processor → M3U Generator → File System
• tqdm wraps loops in Data Processor to show progress
Architectural patterns and design principles
• Single-responsibility: each script handles one use case (live channels, VOD, series).
• Layered approach inside each script: Input → Transport → Processing → Output
• Asynchronous I/O used in VOD/series scripts to speed up multiple requests (aiohttp).
Detail and essential elements
• Break out HTTP Client into sync vs. async paths.
• Concurrency in macvod.py/macshow.py fetching loops.
• That tqdm wraps loop iterations in Data Processor.
• Specify output file naming conventions (e.g., channels.m3u).