|
|
|
|
@ -1,6 +1,110 @@
|
|
|
|
|
# ChatGPT Project Context – Bookscraper / Celery Branch ## 1. Scraper Status (STABIEL – NIET aanpassen zonder toestemming) De Python-based bookscraper werkt volledig end-to-end. De volgende onderdelen zijn getest, stabiel en mogen niet worden herschreven of opgeschoond zonder expliciete toestemming: ### prepare_scripts() Genereert 3 shell-scripts in de output map: - say.txt — alleen TTS (Sinji voice, timestamps) - makebook.txt — alleen m4b merge + move - allinone.txt — TTS + merge + move ### Volume structuur output/<book>/<site>/v1, v2, v3, … ### Chapter-output - Chapter 1 bevat een header - Overige chapters bevatten alleen tekst ### Werkende functionaliteit - Rate limiter - Chapter parsing - Description parsing - Cover download - Skip-logica - prepare_scripts() ## 2. Ontwikkelregels voor ChatGPT - Geen stille rewrites - Geen opschonen van werkende code - Geen herstructurering zonder toestemming - Wijzigingen minimalistisch en doelgericht - Diff/patch-stijl - Exact aangeven welke bestanden worden geraakt - Directorystructuur behouden ## 3. Focusgebied (celery_branch) - Celery worker architectuur verbeteren - Queueing & retry policies - Stabiliteit & observability - Integratie met scraping tasks - Download functionaliteit eerst; audio later ## 4. Omgeving - VS Code Dev Containers - Docker Compose aanwezig - Celery + Redis in gebruik - Redis via hostmachine: redis://host.docker.internal:6379 ## 5. Download Worker (NIEUW – Werkend) - download_worker.py volledig operationeel - Tasks worden correct geregistreerd: - tasks.scraping.download_chapter_task - tasks.scraping.download_chapter - tasks.scraping.scrape_book - Redis broker/backend correct geladen via .env - Worker pakt taken op en voert ze uit - Download pipeline werkt end-to-end ## 6. Logbus Status (NIEUW) - Logbus gebruikt nu REDIS_BACKEND of REDIS_BROKER - Geen crashes meer - Logging is non-blocking ## 7. Nog te bouwen (Download-Only fase) - DownloadController voor bulk-downloads - Flask API endpoint voor download - scrape_worker / audio_worker later ## 8. Project Tree (samengevat) scraper/ tasks/ worker/ logbus/ app.py docker-compose.yml OUTPUT structure blijft behouden.
|
|
|
|
|
|
|
|
|
|
find . \
|
|
|
|
|
-path "./output" -prune -o \
|
|
|
|
|
-path "*/__pycache__" -prune -o \
|
|
|
|
|
-print | sed -e 's;[^/]*/; |;g;s;|;|--;'
|
|
|
|
|
-path "./output" -prune -o \
|
|
|
|
|
-path "_/**pycache**" -prune -o \
|
|
|
|
|
-print | sed -e 's;[^/]_/; |;g;s;|;|--;'
|
|
|
|
|
|
|
|
|
|
# CHATGPT_CONTEXT.md
|
|
|
|
|
|
|
|
|
|
## 📘 Project Context — BookScraper (Celery Pipeline)
|
|
|
|
|
|
|
|
|
|
**Status: 1 december 2025**
|
|
|
|
|
|
|
|
|
|
Dit document brengt ChatGPT instant up-to-speed bij een nieuwe sessie.
|
|
|
|
|
Het beschrijft de actuele architectuur, flow, directorylayout en pending features.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## ✅ Systeemarchitectuur (huidige implementatie)
|
|
|
|
|
|
|
|
|
|
Het project is een **gedistribueerde Chinese webnovel-scraper** met:
|
|
|
|
|
|
|
|
|
|
- **Flask Web GUI** (`web`)
|
|
|
|
|
- **Celery workers** per taaktype:
|
|
|
|
|
- `scraping` → boek metadata & chapterlist
|
|
|
|
|
- `controller` → pipelines dispatchen
|
|
|
|
|
- `download` → HTML binnenhalen
|
|
|
|
|
- `parse` → content extraheren + cleanen + hoofdstukheader maken
|
|
|
|
|
- `save` → tekst wegschrijven naar disk + volume-indeling
|
|
|
|
|
- `audio` → (later) m4b generation
|
|
|
|
|
- **Redis** als broker en backend
|
|
|
|
|
|
|
|
|
|
Alle workers hebben dezelfde codebase gemount via:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
volumes:
|
|
|
|
|
- .:/app
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 📂 Directorystructuur (relevant deel)
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
bookscraper/
|
|
|
|
|
│
|
|
|
|
|
├── scraper/
|
|
|
|
|
│ ├── tasks/
|
|
|
|
|
│ │ ├── scraping.py
|
|
|
|
|
│ │ ├── controller_tasks.py
|
|
|
|
|
│ │ ├── download_tasks.py
|
|
|
|
|
│ │ ├── parse_tasks.py
|
|
|
|
|
│ │ ├── save_tasks.py
|
|
|
|
|
│ │ └── pipeline.py
|
|
|
|
|
│ ├── download_controller.py
|
|
|
|
|
│ ├── utils.py
|
|
|
|
|
│ ├── sites.py
|
|
|
|
|
│ ├── book_scraper.py
|
|
|
|
|
│
|
|
|
|
|
├── docker/
|
|
|
|
|
│ ├── Dockerfile.scraper
|
|
|
|
|
│ ├── Dockerfile.web
|
|
|
|
|
│ └── Dockerfile.audio
|
|
|
|
|
│
|
|
|
|
|
├── docker-compose.yml
|
|
|
|
|
└── CHATGPT_CONTEXT.md
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 🔄 Book Pipeline (zoals nu werkt)
|
|
|
|
|
|
|
|
|
|
1. **start_scrape_book(url)**
|
|
|
|
|
2. **launch_downloads(scrape_result)**
|
|
|
|
|
3. **download_chapter(num, url)**
|
|
|
|
|
4. **parse_chapter(download_result)**
|
|
|
|
|
5. **save_chapter(parsed, volume_path)**
|
|
|
|
|
|
|
|
|
|
Volumes worden correct weggeschreven naar:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
BOOKSCRAPER_OUTPUT_DIR=/Users/peter/Desktop/books
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 🚀 Features op de planning
|
|
|
|
|
|
|
|
|
|
1. download retry + delay +429 pause
|
|
|
|
|
1. Cover downloaden
|
|
|
|
|
1. Make scripts
|
|
|
|
|
1. Audio pipeline integratie
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 🧵 Afspraak
|
|
|
|
|
|
|
|
|
|
**ChatGPT moet altijd eerst om bestaande code vragen voordat het wijzigingen voorstelt.**
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 🎯 Samenvatting
|
|
|
|
|
|
|
|
|
|
Je hebt nu:
|
|
|
|
|
|
|
|
|
|
✔ Een schaalbare, modulaire Celery pipeline
|
|
|
|
|
✔ Volume-splitting
|
|
|
|
|
✔ Headers voor hoofdstuk 1
|
|
|
|
|
✔ Correcte I/O paths met host mount
|
|
|
|
|
✔ Stabiele end-to-end scraping flow
|
|
|
|
|
|