Commit 292dd70
Changed files (1)
src
podcast
src/podcast/main.py
@@ -33,6 +33,7 @@ from pyrogram.types import Chat, Message
from pyrogram.types.messages_and_media.message import Str
from config import GPT, PODCAST, READING_SPEED, cache
+from database.github import gh_clean_assets
from database.r2 import get_cf_r2, set_cf_r2
from llm.gpt import gpt_response
from llm.utils import convert_html, convert_md, remove_consecutive_newlines
@@ -122,12 +123,16 @@ async def summary_pods(client: Client):
processed_xml = await update_xml_desc(feed_url, processed_xml, entry, summary=gpt_res.get("texts", ""), audio_path=info["asr_path"])
await set_cf_r2(entry["db_key"], data={"title": entry["title"], "url": entry["link"]})
has_update = True
+ Path(info["path"]).unlink(missing_ok=True)
+ Path(info["asr_path"]).unlink(missing_ok=True)
+ Path(info["thumb"]).unlink(missing_ok=True) if info["thumb"] else None
except Exception as e:
logger.error(f"Failed podcast {feed_title} -- {entry['title']}: {e}")
await send2tg(client, message, texts=f"Failed podcast {feed_title} -- {entry['title']}: {e}", reply_msg_id=-1)
continue
if has_update:
await save_xml(processed_xml, feed_saved_target(feed_url))
+ await gh_clean_assets(release_name=feed_title, gh_repo=PODCAST.GH_REPO, gh_token=PODCAST.GH_TOKEN, keep_latest=50)
# save opml
opml = {"opml": {"@version": "1.0", "head": {"title": "Podcast"}, "body": {"outline": []}}}