This commit is contained in:
Magzhan Zhumabayev
2026-05-02 01:43:04 +05:00
parent 0c1b746e08
commit 00d9b241f0
2 changed files with 9 additions and 3 deletions
+4 -2
View File
@@ -67,11 +67,13 @@ class FillerAudioLibrary:
{key: len(value) for key, value in self._clips.items()},
)
def pick(self, key: str | None = None) -> bytes | None:
def pick(self, key: str | None = None, *, allow_fallback: bool = True) -> bytes | None:
if not self._enabled:
return None
normalized_key = (key or "").strip().lower() or "generic"
candidates = self._clips.get(normalized_key) or self._clips.get("generic") or []
candidates = self._clips.get(normalized_key) or []
if not candidates and allow_fallback:
candidates = self._clips.get("generic") or []
if not candidates:
LOGGER.info("filler audio pick missed: key=%s available=%s", normalized_key, list(self._clips))
return None