Skip to content

Commit

Permalink
Free space adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Feramance committed Jul 1, 2024
1 parent c04cfd7 commit 114c158
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -5133,13 +5133,21 @@ def _process_single_torrent(self, torrent):
free_space_test = self.current_free_space
free_space_test -= torrent["amount_left"]
self.logger.trace(
"Resulting free space: %s -> %s", self.current_free_space, free_space_test
"Result[%s]: Free space %s -> %s",
torrent.name,
self.current_free_space,
free_space_test,
)
if (
torrent.state_enum != TorrentStates.PAUSED_DOWNLOAD
and self.current_free_space < torrent["amount_left"]
):
self.logger.trace("Pause download: Free space %s", self.current_free_space)
self.logger.trace(
"Pause download[%s]: Free space %s -> %s",
torrent.name,
self.current_free_space,
free_space_test,
)
torrent.add_tags(tags=["qBitrr-free_space_paused"])
torrent.remove_tags(tags=["qBitrr-allowed_seeding"])
self._process_single_torrent_pause_disk_space(torrent)
Expand All @@ -5149,14 +5157,25 @@ def _process_single_torrent(self, torrent):
):
self.current_free_space = free_space_test
self.logger.trace(
"Can download: Free space %s -> %s", self.current_free_space, free_space_test
"Can download[%s]: Free space %s -> %s",
torrent.name,
self.current_free_space,
free_space_test,
)
torrent.remove_tags(tags=["qBitrr-free_space_paused"])
else:
self.current_free_space = free_space_test
self.logger.trace(
"Downloading[%s]: Free space %s -> %s",
torrent.name,
self.current_free_space,
free_space_test,
)
elif not self.is_downloading_state(torrent) and "qBitrr-free_space_paused" in torrent.tags:
self.logger.trace(
"Removing tag[%s] for completed torrent[%s]: Free space %s",
"qBitrr-free_space_paused",
torrent,
torrent.name,
self.current_free_space,
)
torrent.remove_tags(tags=["qBitrr-free_space_paused"])
Expand Down

0 comments on commit 114c158

Please sign in to comment.