import os
import tempfile
from pathlib import Path
OUTPUT_DIR = Path(os.environ.get('BOOK_SKILL_WORKDIR', str(Path(tempfile.gettempdir()) / 'book_skill_work')))
OUTPUT_TEXT = OUTPUT_DIR / 'full_text.txt'
OUTPUT_META = OUTPUT_DIR / 'metadata.json'
WORDS_PER_TOKEN = 0.75
CJK_CHARS_PER_TOKEN = 1.5
TEXT_EXTENSIONS = {'.txt', '.text', '.md', '.markdown', '.rst', '.adoc', '.asciidoc'}
HTML_EXTENSIONS = {'.html', '.htm', '.xhtml'}
CALIBRE_EBOOK_EXTENSIONS = {'.mobi', '.azw', '.azw3'}
SUPPORTED_EXTENSIONS = {'.pdf', '.epub', '.docx', '.rtf', *TEXT_EXTENSIONS, *HTML_EXTENSIONS, *CALIBRE_EBOOK_EXTENSIONS}
PYTHON_DEPENDENCIES = {'docling': 'docling', 'pypdf': 'pypdf', 'pdfminer': 'pdfminer.six', 'ebooklib': 'ebooklib', 'bs4': 'beautifulsoup4', 'docx': 'python-docx', 'striprtf': 'striprtf'}

def supported_formats_message() -> str:
    return ', '.join(sorted(SUPPORTED_EXTENSIONS))
