Commit 7f683ab

benny-dou <60535774+benny-dou@users.noreply.github.com>
2026-01-23 23:59:56
chore(asr): fix audio downsampling condition
1 parent ded3a2c
Changed files (4)
src/asr/cloudflare.py
@@ -36,7 +36,7 @@ async def cloudflare_asr(
     path = Path(path).expanduser().resolve()
     if not path.is_file():
         return {"texts": "", "error": "File not found."}
-    audio_path = path if path.suffix.lower() != ".wav" else await downsampe_audio(path, ext="wav", codec="pcm_s16le")
+    audio_path = path if path.suffix.lower() == ".wav" else await downsampe_audio(path, ext="wav", codec="pcm_s16le")
     audio_path = await convert_single_channel(audio_path, ext="wav", codec="pcm_s16le")
     # max allowed file size is 25MB
     if duration < ASR.CLOUDFLARE_CHUNK_SECONDS:
src/asr/groq.py
@@ -26,7 +26,7 @@ async def groq_asr(path: str | Path, model: str = "", prompt: str = "", temperat
     path = Path(path).expanduser().resolve()
     if not path.is_file():
         return {"texts": "", "error": "File not found."}
-    audio_path = path if path.suffix.lower() != ".wav" else await downsampe_audio(path, ext="wav", codec="pcm_s16le")
+    audio_path = path if path.suffix.lower() == ".wav" else await downsampe_audio(path, ext="wav", codec="pcm_s16le")
     audio_path = await convert_single_channel(audio_path, ext="wav", codec="pcm_s16le")
     # max allowed file size is 25MB
     if audio_path.stat().st_size < ASR.GROQ_MAX_BYTES:
src/podcast/main.py
@@ -68,10 +68,10 @@ async def summary_pods(client: Client):
                 await send2tg(client, message, texts=f"Failed download podcast {feed_title} -- {entry['title']}", reply_msg_id=-1)
                 continue
             try:
-                transcripts = await get_transcripts(info["asr_path"], feed_title, feed_url, entry)  # TODO
+                transcripts = await get_transcripts(info["asr_path"], feed_title, feed_url, entry)
                 if not transcripts:
                     continue
-                duration = await get_duration(info["asr_path"], entry)  # TODO
+                duration = await get_duration(info["asr_path"], entry)
                 duration = seconds_to_hms(duration)
                 dt = get_pubdate(entry)
                 pubdate = f"{dt:%Y-%m-%d %H:%M:%S}"
src/config.py
@@ -344,7 +344,6 @@ class PODCAST:
     ASR_FORCE_UNCENSORED_DOMAINS = os.getenv("PODCAST_ASR_FORCE_UNCENSORED_DOMAINS", "anchor.fm,feeds.acast.com")
     GH_REPO = os.getenv("PODCAST_GH_REPO", "podcast")
     GH_TOKEN = os.getenv("PODCAST_GH_TOKEN", "")
-    SUMMARY_MODEL_ID = os.getenv("PODCAST_SUMMARY_MODEL_ALIAS", "default")
 
 
 class FAVORITE: