How yeokim5/smart-recording works
Main Components
• Main Application: Represented by main.py, which contains the primary logic and the scheduler. It configures parameters like the search URL, start time, and recording duration.
• Browser Automation: Utilizes Selenium and webdriver-manager to open Google Chrome, navigate to the sports stream URL, search for the desired game, extract the embed source, and update the local HTML file. This component interacts directly with Chrome.
• HTML Test Page: The test.html file acts as a display and trigger for the stream by embedding the updated source URL. This page is used for fullscreen playback.
• Recording Integration: Windows Game Bar is used to capture the screen once the stream is playing. The process is automated via keyboard shortcuts (Win+Alt+R) likely triggered by modules such as pyautogui and pygetwindow.
• External Services/Tools: Google Chrome for browsing; the Chrome WebDriver (automatically managed via webdriver-manager); and the external libraries required for automation (selenium, pyautogui, etc.).
Relationships and Interactions
• The Main Application (main.py) is the central orchestrator. It schedules the recording by setting parameters (search URL, start time, duration) and initiates the workflow.
• Once the schedule is met, main.py invokes the Browser Automation module which:
• Opens Chrome
• Navigates to the search URL to locate the stream
• Scrapes or extracts the embed URL from the stream page
• The extracted embed URL is then used to update test.html (dynamically replacing a placeholder in the HTML).
• The HTML Test Page is then launched in fullscreen mode.
• Concurrently, automation scripts (powered by pyautogui and pygetwindow) trigger Windows Game Bar commands (e.g., Win+Alt+R) to start and stop the recording.
Architectural Patterns and Design Principles
• Modular Design: Each functionality—web automation, HTML manipulation, scheduling, and recording—is separated into distinct components or modules.
• Sequential Workflow: The process follows clear sequential steps from configuring the recording, navigating the browser, updating the HTML, initiating playback, and finally recording via Windows Game Bar.
• Integration of External Tools: Relies on third-party tools (Chrome, Windows Game Bar) and libraries to accomplish specific tasks, highlighting the importance of well-defined integration points.
Relevant Technologies and Libraries
• Python, serving as the primary language.
• Selenium and webdriver-manager for browser automation.
• PyAutoGUI and PyGetWindow for automating keypresses and handling window interactions.
• Windows Game Bar as the recording utility.
• Google Chrome as the browser.
Details
• Don’t overcomplicate: Clearly separate the project’s core functionalities into well-defined sections.
• Showing the dependencies (e.g., required installations and external tools) that play a significant role in the system’s overall behavior.