← ClaudeAtlas

aio-epub-uploadlisted

Upload an EPUB file and prepare it for chapter translation — extracts TOC, counts words, queues for analysis. Use when the user wants to add a new book, start translating an EPUB, tải sách lên, import a `.epub` file, or onboard a new title into the translation workspace.
aiocean/claude-plugins · ★ 3 · AI & Automation · score 65
Install: claude install-skill aiocean/claude-plugins
# EPUB Upload & Prepare Upload an EPUB file to the translation server and prepare it for translation. > **Prerequisite**: Cần có API key. Chưa có? Dùng `aio-epub-setup` trước. ## API Setup ```python import json, urllib.request, os BASE = "https://read-api.aiocean.dev/ListBooks.v1.BookService" KEY = os.environ.get("AIO_EPUB_API_KEY", "duocnv") def api(method, body): data = json.dumps(body).encode('utf-8') req = urllib.request.Request(f"{BASE}/{method}", data=data, headers={ "Content-Type": "application/json", "X-License-Key": KEY }) with urllib.request.urlopen(req) as resp: return json.loads(resp.read()) ``` ## Workflow ### 1. Upload EPUB Read the EPUB file as bytes and upload: ```python import base64 with open("path/to/book.epub", "rb") as f: epub_bytes = f.read() # UploadEpub is streaming — use raw HTTP data = json.dumps({ "epubData": base64.b64encode(epub_bytes).decode(), "filename": "book.epub" }).encode('utf-8') req = urllib.request.Request(f"{BASE}/UploadEpub", data=data, headers={ "Content-Type": "application/json", "X-License-Key": KEY }) with urllib.request.urlopen(req) as resp: result = json.loads(resp.read()) book_id = result["bookId"] print(f"Uploaded: {book_id}") ``` ### 2. Prepare Book (if not auto-prepared) ```python # PrepareBook cleans HTML, marks translatable content, generates guidelines result = api("PrepareBook", {"bookId": book_id}) print(result["message"]) ``` ### 3.