From d2558e546ed3abbf2bebc5acc3a99f05152d5d37 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Tue, 16 Jun 2026 19:12:09 +0200 Subject: [PATCH] feat(podcasts): add audio_exists storage helper --- surfsense_backend/app/podcasts/storage.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/surfsense_backend/app/podcasts/storage.py b/surfsense_backend/app/podcasts/storage.py index f02429dff..c3326460d 100644 --- a/surfsense_backend/app/podcasts/storage.py +++ b/surfsense_backend/app/podcasts/storage.py @@ -42,6 +42,13 @@ def open_audio_stream(podcast: Podcast) -> AsyncIterator[bytes]: return get_storage_backend().open_stream(podcast.storage_key) +async def audio_exists(podcast: Podcast) -> bool: + """Whether the podcast's stored audio object is actually present.""" + return bool(podcast.storage_key) and await get_storage_backend().exists( + podcast.storage_key + ) + + async def purge_audio(podcast: Podcast) -> None: """Delete a podcast's stored audio if present; a missing object is fine.""" await purge_audio_object(podcast.storage_key)