mirror of
https://github.com/Viren070/MediaFusion.git
synced 2025-12-01 23:21:11 +01:00
Seedr: Prevent deletion in-progress torrent to fix stuck download
Add a check to raise an exception if a torrent is still downloading when attempting to delete folder contents. Included a placeholder video file for exception handling use. This ensures ongoing downloads are not interrupted inadvertently.
This commit is contained in:
Binary file not shown.
@@ -100,8 +100,11 @@ async def ensure_space_available(seedr: Seedr, required_space: int | float) -> N
|
||||
|
||||
# Delete folder contents first
|
||||
sub_content = await seedr.list_contents(folder["id"])
|
||||
for torrent in sub_content["torrents"]:
|
||||
await seedr.delete_item(torrent["id"], "torrent")
|
||||
if sub_content["torrents"]:
|
||||
# Raise exception if torrent is still downloading.
|
||||
raise ProviderException(
|
||||
"An existing torrent is being downloaded", "torrent_downloading.mp4"
|
||||
)
|
||||
for subfolder in sub_content["folders"]:
|
||||
await seedr.delete_item(subfolder["id"], "folder")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user