🎨 manage comics via yaml files

This commit is contained in:
mi
2025-11-15 19:20:21 +10:00
parent 91b6d4efeb
commit 13176c68d2
10 changed files with 419 additions and 80 deletions

89
data/comics/README.md Normal file
View File

@@ -0,0 +1,89 @@
# Comic Data Directory
This directory contains YAML files for managing individual comics. Each comic gets its own `.yaml` file.
## Quick Start
### Adding a New Comic
1. **Copy the template:**
```bash
cp TEMPLATE.yaml 004.yaml
```
2. **Edit the file** with your comic's information:
- Update `number`, `filename`, `date`, and `alt_text` (required)
- Add optional fields like `title`, `author_note`, etc.
3. **Save the file** and restart your application
The comics will be automatically loaded and sorted by comic number.
## File Naming
You can name files anything you want (e.g., `001.yaml`, `first-comic.yaml`, `2025-01-01.yaml`), but using the comic number is recommended for easy organization.
## Required Fields
Every comic MUST have:
- `number` - Sequential comic number (integer)
- `filename` - Image filename (string) or list of filenames for multi-image comics
- `date` - Publication date in YYYY-MM-DD format (string)
- `alt_text` - Accessibility description (string or list for multi-image)
## Optional Fields
- `title` - Comic title (defaults to "#X" if not provided)
- `mobile_filename` - Mobile-optimized version
- `author_note` - Plain text note below the comic
- `author_note_md` - Markdown file for author note (overrides `author_note`)
- `full_width` - Override global width setting (boolean)
- `plain` - Override global plain mode (boolean)
- `section` - Start a new section/chapter (string, add only to first comic of section)
## Multi-Image Comics (Webtoon Style)
For vertical scrolling comics with multiple images:
```yaml
number: 42
filename:
- page1.png
- page2.png
- page3.png
alt_text:
- "First panel description"
- "Second panel description"
- "Third panel description"
date: "2025-01-01"
```
## Example
```yaml
number: 4
title: "The Adventure Begins"
filename: comic-004.jpg
date: "2025-01-22"
alt_text: "A hero stands at the edge of a cliff, looking at the horizon"
author_note: "This is where things get interesting!"
full_width: true
section: "Chapter 2: The Journey"
```
## Validation
The data loader will:
- Skip files with missing required fields (with warnings)
- Check for duplicate comic numbers
- Warn about gaps in numbering
- Sort comics by number automatically
## Testing Your Changes
Test the loader directly:
```bash
python data_loader.py
```
This will show you all loaded comics and any validation warnings.