mirror of
https://github.com/denizsafak/abogen.git
synced 2026-09-20 11:40:57 +02:00
fix: sanitize_output_stem signature + audio_sink import
Two pre-existing bugs found during test coverage analysis: 1. sanitize_output_stem() only accepted 1 arg but resolve_project_layout passed 2 args (name, index) via sanitize_fn parameter. Fix: added optional index parameter to sanitize_output_stem. 2. audio_sink.py imported get_internal_cache_path from abogen.infrastructure.cache which doesn't exist. Fix: import from abogen.utils where the function lives.
This commit is contained in:
@@ -54,7 +54,7 @@ def _ensure_ffmpeg() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def _get_ffmpeg_cache_root() -> str:
|
def _get_ffmpeg_cache_root() -> str:
|
||||||
from abogen.infrastructure.cache import get_internal_cache_path
|
from abogen.utils import get_internal_cache_path
|
||||||
|
|
||||||
return get_internal_cache_path("ffmpeg")
|
return get_internal_cache_path("ffmpeg")
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def sanitize_filename_for_chapter(title: str, index: int, max_len: int = 80) ->
|
|||||||
return f"{index:02d}_{sanitized}"
|
return f"{index:02d}_{sanitized}"
|
||||||
|
|
||||||
|
|
||||||
def sanitize_output_stem(name: str) -> str:
|
def sanitize_output_stem(name: str, index: int = 0) -> str:
|
||||||
base = Path(name or "").stem
|
base = Path(name or "").stem
|
||||||
sanitized = _OUTPUT_SANITIZE_RE.sub("_", base).strip("_")
|
sanitized = _OUTPUT_SANITIZE_RE.sub("_", base).strip("_")
|
||||||
return sanitized or "output"
|
return sanitized or "output"
|
||||||
|
|||||||
Reference in New Issue
Block a user