refactor: move calculate_text_length to domain, add build_chapter_payload to app-layer

- Create domain/text_utils.py with canonical calculate_text_length
  (strips chapter markers, voice markers, metadata tags)
- Remove calculate_text_length from utils.py and subtitle_utils.py
- Update all imports to use domain.text_utils directly
- Create application/chapter_selection.py with build_chapter_payload()
  (orchestrates preselection + character count + safety net)
- Replace manual chapter logic in form.py with build_chapter_payload()
- 22 new tests for text_utils and chapter_selection (1550 total)
This commit is contained in:
Artem Akymenko
2026-07-30 14:57:10 +00:00
parent d334266238
commit 94e6b3f62e
13 changed files with 243 additions and 70 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ from pathlib import Path
from ebooklib import epub
from abogen.text_extractor import extract_from_path
from abogen.utils import calculate_text_length
from abogen.domain.text_utils import calculate_text_length
@pytest.fixture