Updated Architecture Overview (markdown)

Gramps
2025-08-05 22:12:22 -07:00
parent 82c18ba298
commit 243119fb5b

@ -1,15 +1,212 @@
# Architecture Overview <html>
<body>
<!--StartFragment--><html><head></head><body><h2>🧱 Architecture Overview</h2>
<p>This page provides a high-level technical map of the LCS Pipeline — from input detection to final video upload. It outlines how the system is structured, modularized, and designed for hands-free content generation.</p>
<hr>
<h3>🎯 Primary Goal</h3>
<p>To automate livestream clip creation, formatting, titling, thumbnail generation, and publishing across multiple platforms with minimal user input.</p>
<hr>
<h3>🗂️ Core Workflow (Pipeline Phases)</h3>
<ol>
<li>
<p><strong>Session Discovery</strong><br>
Scans for new <code inline="">YYYY.MM.DD</code> folders on startup. Multiple sessions per day supported (<code inline="">.2</code>, <code inline="">.3</code>, etc.).</p>
</li>
<li>
<p><strong>Clip Classification</strong><br>
Reads each subfolder (<code inline="">hits/</code>, <code inline="">misses/</code>, <code inline="">montages/</code>, etc.) and classifies by:</p>
<ul>
<li>
<p>Folder name</p>
</li>
<li>
<p>Filename suffix (<code inline="">-vert</code> for vertical)</p>
</li>
</ul>
</li>
<li>
<p><strong>Metadata Injection</strong><br>
Loads <code inline="">notes.json</code> (if present) or prompts user for:</p>
<ul>
<li>
<p><code inline="">highlight</code> (required)</p>
</li>
<li>
<p><code inline="">tags</code>, <code inline="">gag_name</code> (optional)</p>
</li>
</ul>
</li>
<li>
<p><strong>Title + Description Generation</strong><br>
Uses OpenAI to create:</p>
<ul>
<li>
<p>Dynamic video titles (based on folder + metadata)</p>
</li>
<li>
<p>Social-ready video descriptions</p>
</li>
</ul>
</li>
<li>
<p><strong>Intro/Outro Assembly</strong></p>
<ul>
<li>
<p>Concatenates intro + title card + clip + outro</p>
</li>
<li>
<p>Uses branding assets in <code inline="">assets/</code></p>
</li>
</ul>
</li>
<li>
<p><strong>Thumbnail Generation</strong><br>
Creates stylized Fortnite-style thumbnails under 2MB</p>
</li>
<li>
<p><strong>Upload</strong></p>
<ul>
<li>
<p>Vertical → YouTube Shorts</p>
</li>
<li>
<p>Widescreen → YouTube Clips (and PeerTube, if enabled)</p>
</li>
</ul>
</li>
<li>
<p><strong>Archive &amp; Cleanup</strong></p>
<ul>
<li>
<p>Metadata written to <code inline="">metadata/history/&lt;date&gt;/&lt;slug&gt;.json</code></p>
</li>
<li>
<p>Original clip folder optionally deleted (unless <code inline="">DEBUG=True</code>)</p>
</li>
</ul>
</li>
</ol>
<hr>
<h3>📁 Key Components</h3>
This page provides an overview of the internal structure of the LCS Pipeline. Module | Role
-- | --
main.py | Pipeline launcher and orchestrator
render_engine.py | Handles stitching + export
title_utils.py | Generates title screens
yt_poster.py | YouTube upload logic
pt_poster.py | PeerTube upload logic (optional)
thumbnail_utils.py | Builds and validates thumbnails
metadata_utils.py | Normalizes and stores clip metadata
## Modules
- `main.py`: Central orchestration logic
- `modules/`: Reusable utilities for title cards, thumbnails, uploads
- `assets/`: Contains branding videos and fonts
## Flow <hr>
1. Detect new video sessions <h3>📦 Folder Independence</h3>
2. Generate metadata, titles, overlays <p>Each session folder is processed atomically — no cross-folder dependencies.</p>
3. Render videos with intro/title/outro <ul>
4. Upload to YouTube and optionally PeerTube <li>
5. Auto-publish wiki and social metadata <p>Safe to rerun on failed or partially processed sessions</p>
</li>
<li>
<p>Idempotent if <code inline="">rendered/</code> and history already exist</p>
</li>
</ul>
<hr>
<h3>🔧 Exception Paths</h3>
<ul>
<li>
<p><code inline="">timelapses/</code> are handled via custom renderer (future logic)</p>
</li>
<li>
<p><code inline="">outtakes/</code> require manual metadata and never auto-upload</p>
</li>
</ul>
<hr>
<p>See also: <a href="https://chatgpt.com/c/Clip-Handling-Logic"><code inline="">Clip Handling Logic</code></a>, <a href="https://chatgpt.com/c/File-Naming-&amp;-Directory-Conventions"><code inline="">File Naming</code></a>, <a href="https://chatgpt.com/c/Metadata-Extraction"><code inline="">Metadata Extraction</code></a></p></body></html><!--EndFragment-->
</body>
</html>## 🧱 Architecture Overview
This page provides a high-level technical map of the LCS Pipeline — from input detection to final video upload. It outlines how the system is structured, modularized, and designed for hands-free content generation.
---
### 🎯 Primary Goal
To automate livestream clip creation, formatting, titling, thumbnail generation, and publishing across multiple platforms with minimal user input.
---
### 🗂️ Core Workflow (Pipeline Phases)
1. **Session Discovery**
Scans for new `YYYY.MM.DD` folders on startup. Multiple sessions per day supported (`.2`, `.3`, etc.).
2. **Clip Classification**
Reads each subfolder (`hits/`, `misses/`, `montages/`, etc.) and classifies by:
* Folder name
* Filename suffix (`-vert` for vertical)
3. **Metadata Injection**
Loads `notes.json` (if present) or prompts user for:
* `highlight` (required)
* `tags`, `gag_name` (optional)
4. **Title + Description Generation**
Uses OpenAI to create:
* Dynamic video titles (based on folder + metadata)
* Social-ready video descriptions
5. **Intro/Outro Assembly**
* Concatenates intro + title card + clip + outro
* Uses branding assets in `assets/`
6. **Thumbnail Generation**
Creates stylized Fortnite-style thumbnails under 2MB
7. **Upload**
* Vertical → YouTube Shorts
* Widescreen → YouTube Clips (and PeerTube, if enabled)
8. **Archive & Cleanup**
* Metadata written to `metadata/history/<date>/<slug>.json`
* Original clip folder optionally deleted (unless `DEBUG=True`)
---
### 📁 Key Components
| Module | Role |
| -------------------- | ----------------------------------- |
| `main.py` | Pipeline launcher and orchestrator |
| `render_engine.py` | Handles stitching + export |
| `title_utils.py` | Generates title screens |
| `yt_poster.py` | YouTube upload logic |
| `pt_poster.py` | PeerTube upload logic (optional) |
| `thumbnail_utils.py` | Builds and validates thumbnails |
| `metadata_utils.py` | Normalizes and stores clip metadata |
---
### 📦 Folder Independence
Each session folder is processed atomically — no cross-folder dependencies.
* Safe to rerun on failed or partially processed sessions
* Idempotent if `rendered/` and history already exist
---
### 🔧 Exception Paths
* `timelapses/` are handled via custom renderer (future logic)
* `outtakes/` require manual metadata and never auto-upload
---
See also: [`[Clip Handling Logic](https://chatgpt.com/c/Clip-Handling-Logic)`](./Clip-Handling-Logic), [`[File Naming](https://chatgpt.com/c/File-Naming-&-Directory-Conventions)`](./File-Naming-&-Directory-Conventions), [`[Metadata Extraction](https://chatgpt.com/c/Metadata-Extraction)`](./Metadata-Extraction)