# lovefirst02/tix_bot architecture

> Architecture diagram of the GitHub repository lovefirst02/tix_bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lovefirst02/tix_bot
- Repository: https://github.com/lovefirst02/tix_bot

## Overview

##### Project type and purpose
- This is an open-source Python automation tool (“MaxBot”) for automatically purchasing tickets from multiple ticketing platforms (tixcraft, kktix, cityline, urbtix, ibon, etc.).
- It uses Selenium WebDriver (ChromeDriver or GeckoDriver) to drive a browser, plus optional non-browser fallback scraping logic (NonBrowser.py), and notifies the user via sound effects.

##### File structure
- Top-level scripts:
- settings.py: GUI for editing user preferences (keywords, URLs, drivers).
- chrome_tixcraft.py: Core bot engine that launches ChromeDriver, navigates pages, matches keywords and prices.
- NonBrowser.py: Alternative “headless” or HTTP-based scraping module.
- Configuration:
- settings.json: Persists user settings from the GUI.
- pip-reg.txt: Lists Python dependencies (e.g., selenium).
- Resources:
- ding.wav, ding-dong.wav: Notification sounds for captcha or ticket-found.
- maxbot_logo2_single.ppm: Logo displayed in the GUI.
- Support files:
- LICENSE, README.md: Documentation and license.

##### README for additional insights
- Describes supported platforms, setup steps, how to download drivers, and manual captcha input.
- Emphasizes use of Selenium, Python3, and external driver binaries (ChromeDriver/GeckoDriver).

a. Main components
1. User Interface (settings.py + GUI)
2. Configuration Store (settings.json)
3. Bot Engine
– Browser Mode (chrome_tixcraft.py + selenium)
– Non-Browser Mode (NonBrowser.py)
4. WebDriver Binary (chromedriver or geckodriver in /webdriver)
5. External Ticketing Services (tixcraft, kktix, etc.)
6. Notification Subsystem (ding.wav, ding-dong.wav)
b. Relationships and interactions
– User launches settings.py → edits preferences → writes settings.json.
– User launches bot (chrome_tixcraft.py or NonBrowser.py) → reads settings.json.
– Bot Engine initializes Selenium WebDriver (pointing to chromedriver path).
– Bot Engine drives browser to External Ticketing Services, performs login/search, applies keyword and price filters.
– On events (captcha prompt, success), Bot Engine triggers Notification Subsystem to play sounds.
c. Architectural patterns / design principles
– Separation of concerns (GUI vs. core engine vs. notifications).
– Pluggable backends (Browser vs. Non-Browser).
– Configuration-driven behavior (all parameters in JSON).
d. Key technologies / libraries
– Python 3
– Selenium WebDriver
– tkinter or PySimpleGUI (for settings.py GUI)
– JSON for config persistence

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User and GUI
    User["User"]:::external
    User --> SettingsGUI
    SettingsGUI["Settings GUI\n(settings.py)"]:::internal
    SettingsGUI --> SettingsJSON
    settingsJSON(("Configuration Store\n(settings.json)")):::data

    %% Bot Engine
    subgraph "Bot Engine"
        direction TB
        BrowserMode["Browser Mode\n(chrome_tixcraft.py)"]:::internal
        NonBrowserMode["Non-Browser Mode\n(NonBrowser.py)"]:::internal
    end
    settingsJSON --> BrowserMode
    settingsJSON --> NonBrowserMode

    %% WebDriver and External Services
    WebDriver["WebDriver Binaries\n(/webdriver)"]:::external
    TicketingSites["External Ticketing Services\n(tixcraft, kktix, etc.)"]:::external
    BrowserMode --> WebDriver
    BrowserMode --> TicketingSites
    NonBrowserMode --> TicketingSites

    %% Manual captcha flow
    ManualCaptcha["Manual Captcha Input"]:::external
    BrowserMode --> ManualCaptcha

    %% Notification Subsystem
    subgraph "Notification Subsystem"
        direction TB
        TicketSound["Ticket Found Sound\n(ding.wav)"]:::resource
        CaptchaSound["Captcha Prompt Sound\n(ding-dong.wav)"]:::resource
        Logo["Logo Resource\n(maxbot_logo2_single.ppm)"]:::resource
    end
    BrowserMode --> TicketSound
    BrowserMode --> CaptchaSound
    SettingsGUI --> Logo

    %% Documentation and Support Files
    subgraph "Documentation & Support"
        direction TB
        README["Project README\n(README.md)"]:::resource
        PipReg["Dependencies List\n(pip-reg.txt)"]:::resource
        License["License\n(LICENSE)"]:::resource
    end

    %% Click Events
    click SettingsGUI "https://github.com/lovefirst02/tix_bot/blob/master/settings.py"
    click SettingsJSON "https://github.com/lovefirst02/tix_bot/blob/master/settings.json"
    click BrowserMode "https://github.com/lovefirst02/tix_bot/blob/master/chrome_tixcraft.py"
    click NonBrowserMode "https://github.com/lovefirst02/tix_bot/blob/master/NonBrowser.py"
    click TicketSound "https://github.com/lovefirst02/tix_bot/blob/master/ding.wav"
    click CaptchaSound "https://github.com/lovefirst02/tix_bot/blob/master/ding-dong.wav"
    click Logo "https://github.com/lovefirst02/tix_bot/blob/master/maxbot_logo2_single.ppm"
    click README "https://github.com/lovefirst02/tix_bot/blob/master/README.md"
    click PipReg "https://github.com/lovefirst02/tix_bot/blob/master/pip-reg.txt"
    click License "https://github.com/lovefirst02/tix_bot/tree/master/LICENSE"

    %% Styles
    classDef internal fill:#D6EAF8,stroke:#1B4F72,color:#1B2631;
    classDef external fill:#D5F5E3,stroke:#145A32,color:#186A3B;
    classDef resource fill:#FAD7A0,stroke:#B9770E,color:#7E5109;
    classDef data fill:#F5B7B1,stroke:#943126,color:#641E16;
```
