chore: move delete file out the func read_bvids_from_txt

This commit is contained in:
Ovler 2024-06-15 14:01:17 +00:00
parent e3757b1aa0
commit 469701a803
2 changed files with 1 additions and 1 deletions

View File

@ -26,5 +26,4 @@ def read_bvids(bvids: str) -> list[str]:
def read_bvids_from_txt(txt_path: Union[Path,str]) -> List[str]:
with open(txt_path, "r", encoding="utf-8") as f:
bvids = [line.strip() for line in f if line.strip().startswith("BV")]
txt_path.unlink(missing_ok=True)
return bvids

View File

@ -116,6 +116,7 @@ async def source_action(fun, source_id: str, TRUNCATE=20):
raise HTTPException(status_code=500, detail="Failed to get path")
bvids = read_bvids_from_txt(txt_path)
txt_path.unlink(missing_ok=True)
return {"success": True, "bvids": bvids}