Architecture Overview - theweebcoders/CommercialBreaker GitHub Wiki
Architecture Overview
This document provides a technical overview of the CommercialBreaker & Toonami Tools system architecture, component relationships, and data flow.
System Overview
CommercialBreaker & Toonami Tools is a modular Python application designed to automate the creation of Toonami-style anime marathon channels. The system processes anime episodes, detects commercial break points, and integrates authentic Toonami bumps to create seamless viewing experiences.
Core Philosophy
- Modular Design: Each tool handles a specific aspect of the pipeline
- Database-Driven: SQLite manages metadata and processing state
- Interface Flexibility: Multiple UIs for different use cases
- Platform Agnostic: Works with various media servers and channel platforms
Application Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Entry Point (main.py) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
βInterface Selection: --tom | --webui | --clydes | --combreak β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββ
β GUI Layer β Web Layer β CLI Layer β
β β β β
β βββββββββββββββ β βββββββββββββββ β βββββββββββββββ β
β β TOM.py β β βAbsolution.pyβ β β clydes.py β β
β β (Tkinter) β β β (REMI/Web) β β β (Console) β β
β βββββββββββββββ β βββββββββββββββ β βββββββββββββββ β
βββββββββββ¬ββββββββ΄ββββββββββ¬ββββββββ΄ββββββββββ¬ββββββββ
β β β
βββββββββββββββββββΌββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FrontEndLogic.py (Orchestrator API) β β Supporting API Modules β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€===========ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ€
β β’ LogicController class - Central API for all UIs β β FlagManager.py β messagebroker.py β
β β’ State management via SQLite database β β β’ Platform compatibility β β’ Real-time communication β
β β’ Threading for background operations β β β’ Global Flags β β’ In-memory pub/sub β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Core Processing Layer β
βββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββββββ€
β ComBreak/ β ToonamiTools/ β ExtraTools/ β
β β β β
β β’ Commercial β β’ Show Detectionβ β’ Manual Tools β
β Detection β β’ Lineup β β’ Utilities β
β β’ File Cutting β Generation β β’ Debugging β
β β’ Cutless Mode β β’ Bump Encoding β β
βββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Data & Integration Layer β
βββββββββββββββββββ¬ββββββββββββββββββ¬ββββββββββββββββββββββββββ€
β Database β Plex API β Platform APIs β
β (SQLite) β β β
β β β’ Authenticationβ β’ DizqueTV REST β
β β’ Show Metadata β β’ Library Scan β β’ Tunarr Integration β
β β’ Bump Catalog β β’ Timestamps β β
β β’ Lineup State β β’ File Paths β β
βββββββββββββββββββ΄ββββββββββββββββββ΄ββββββββββββββββββββββββββ
In-Memory Message Broker
A unified in-memory message broker is responsible for all real-time communication between the LogicController and the various user interfaces (GUI, Web, CLI).
- Channel-Based Communication: All UIs subscribe to relevant channels for updates and publish user actions/events.
- Decoupled Integration: Interfaces interact with the LogicController exclusively through the message broker, ensuring modularity and testability.
Data Flow
1. Initialization Phase
User Input β Interface Selection β Configuration Loading β Plex Authentication
2. Content Discovery Phase
Plex Library Scan β Show Detection (IMDB/Wikipedia) β Bump Analysis β Database Population
3. Processing Phase
Episode Selection β Commercial Detection β File Processing β Metadata Generation
4. Integration Phase
Lineup Generation β Platform Channel Creation β Playback Optimization
This architecture supports the system's goals of modularity, reliability, and extensibility while maintaining the performance necessary for processing large media libraries efficiently.