Updated YouTube Upload Logic (markdown)

Gramps
2025-08-05 22:08:09 -07:00
parent 6ed0ae47a9
commit 4dd3ca9d91
2 changed files with 51 additions and 27 deletions

@ -1,30 +1,54 @@
# YouTube Upload Logic
## ⬆️ YouTube Upload Logic
This page describes how videos are uploaded to YouTube and how metadata, playlists, thumbnails, and recording dates are handled.
## Upload Function
Uploads are handled by:
```python
upload_video(file_path, is_vertical, stream_date, description=None, private=False)
```
## Workflow
1. Authenticate via OAuth
2. Generate title and description:
- Uses stream date and `notes.txt` (if present)
3. Upload video with privacy setting
4. **If widescreen**, generate and upload thumbnail
5. Add video to playlist:
- Shorts → `YT_PLAYLIST_ID_SHORTS`
- Clips → `YT_PLAYLIST_ID_CLIPS`
6. Set recording date using parsed `YYYY.MM.DD`
## Thumbnail Handling
- Thumbnail upload occurs **after** the video is successfully uploaded
- Thumbnail is skipped for vertical videos (Shorts)
- Notes file is used to guide prompt generation (for future AI images)
This page outlines how videos are uploaded to YouTube using the LCS Pipeline, including playlist targeting, category assignment, and format-specific handling.
---
### 🚀 Upload Method
Uploads are handled via the YouTube Data API v3 using OAuth credentials provided in your `.env` file.
Main upload logic lives in:
```
modules/yt_poster.py
```
---
### 📁 Playlist Rules
| Video Type | Playlist |
|------------------|------------------|
| Vertical Shorts | `LCS Shorts` |
| Widescreen Clips | `LCS Clips` |
Shorts are identified by filename suffixes like `-vert` or `-vertical`.
---
### 📋 Category & Metadata
- `categoryId`: Always set to `20` (Gaming)
- `tags`: Pulled from `notes.json`
- `description`: Generated dynamically using OpenAI + branding prompt
- `title`: Auto-generated from `notes.json` or montage info
---
### ✅ Success Criteria
- Upload response returns `videoId`
- Resulting link is stored in the metadata archive:
- `youtube_url` is appended to history JSON
- Folder is optionally removed if `DEBUG=False`
---
### 🧪 Stub Testing
- Set `UPLOAD_ENABLED=False` in `.env` to bypass real uploads
- Simulated responses are returned for dry-run mode
---
Next: [`PeerTube Upload Logic`](./PeerTube-Upload-Logic) *(planned)*