Files
bookish/config.py
T

39 lines
1.7 KiB
Python

import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = os.environ.get("BOOKISH_SECRET", "cambiami-in-produzione")
DEBUG = os.environ.get("BOOKISH_DEBUG", "true").lower() == "true"
UPLOAD_FOLDER = os.path.join(BASE_DIR, "uploads")
CONVERTED_FOLDER = os.path.join(BASE_DIR, "converted")
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50 MB
CLEANUP_HOURS = 1 # ore prima di cancellare file temporanei
# Formati supportati
SUPPORTED_FORMATS = {
"epub": {"label": "EPUB", "mime": "application/epub+zip"},
"md": {"label": "Markdown", "mime": "text/markdown"},
"docx": {"label": "DOCX", "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
"pdf": {"label": "PDF", "mime": "application/pdf"},
"txt": {"label": "Testo", "mime": "text/plain"},
"html": {"label": "HTML", "mime": "text/html"},
"fb2": {"label": "FB2", "mime": "application/x-fictionbook+xml"},
"latex": {"label": "LaTeX", "mime": "text/x-tex"},
"mobi": {"label": "MOBI", "mime": "application/x-mobipocket-ebook"},
}
# Conversion matrix: quali formati possono convertire in cosa
# Pandoc gestisce tutto; qui segnaliamo limitazioni note
OUTPUT_FORMATS_BY_INPUT = {
"epub": ["epub", "md", "docx", "pdf", "txt", "html", "fb2", "latex"],
"pdf": ["epub", "md", "docx", "txt", "html", "latex"],
"docx": ["epub", "md", "pdf", "txt", "html", "latex"],
"md": ["epub", "docx", "pdf", "txt", "html", "latex"],
"txt": ["epub", "md", "docx", "pdf", "html", "latex"],
"html": ["epub", "md", "docx", "pdf", "txt", "latex"],
"fb2": ["epub", "md", "docx", "pdf", "txt", "html", "latex"],
"mobi": ["epub", "md", "docx", "pdf", "txt", "html"],
"latex": ["epub", "md", "docx", "pdf", "txt", "html"],
}