How chervaliery/tv_show_fetcher works
Project type and purpose
• This is a Django-based full-stack application named “tv_show_fetcher.”
• Purpose: automates fetching and downloading TV show data/episodes using Selenium and OCR (Tesseract), then provides a web “backoffice” interface to manage shows and episodes stored in MySQL.
File structure
• Top level:
• manage.py – Django CLI entry point
• tv_show_fetcher/ – Django project folder containing settings, URLs, WSGI
• backoffice/ – Django app for admin/views/commands
• tv_show_fetcher/settings.py – DB, middleware, installed apps
• tv_show_fetcher/urls.py – root URL dispatcher
• backoffice/management/commands/*.py – custom Django commands (downloadepisode, fetchshow, getshow)
• backoffice/models.py – ORM definitions for Show/Episode
• backoffice/views.py & admin.py – HTTP views and admin customizations
• backoffice/utils.py – helper functions (e.g., image→text via pytesseract)
• Configuration files: .gitignore, LICENSE, README.md
README for additional insights
• Dependencies: Python-pip, MySQL, python-mysqldb, xvfb, tesseract-ocr
• Python packages: django, selenium, pytesseract, Image, pyvirtualdisplay
• Implies headless browser automation + OCR pipeline for data extraction
a. Main components
1. Web Client (browser)
2. Django Web Server
• backoffice app (models, views, admin)
• custom management commands (CLI)
3. MySQL Database
4. External Headless Browser Service
• Selenium + Xvfb
5. OCR Engine
• Tesseract via pytesseract
6. File Store (temporary screenshots/images)
b. Relationships & data flow
• Web client ↔ Django views (HTTP/HTTPS)
• Django ORM ↔ MySQL (CRUD on Show/Episode models)
• Management commands triggered (cron or manual) → launch Selenium in Xvfb → fetch page → save screenshot → invoke pytesseract → parse text → create/update DB records
• backoffice views read from DB and render templates
c. Architectural patterns/design principles
• MVC (Django’s MTV) for web layer
• Command pattern for data‐fetch tasks
• Layered architecture: Presentation → Business (views/utils/commands) → Data (models/DB)
• Separation of concerns: OCR & browser automation isolated in utils & commands
d. Key technologies
• Django (web framework, ORM, command infrastructure)
• MySQL (relational store)
• Selenium + Xvfb (headless browser automation)
• Tesseract OCR (text extraction)
• Python imaging libraries (PIL/Image)