mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 07:58:38 +00:00
When loading state, add torrents with .fastresume files first to avoid
waiting for torrents to be checked.
This commit is contained in:
parent
7d5bd22855
commit
bcd5b2c458
1 changed files with 12 additions and 1 deletions
|
@ -450,8 +450,19 @@ class TorrentManager(component.Component):
|
||||||
# First lets clear the queue and make it the correct length.. This will
|
# First lets clear the queue and make it the correct length.. This will
|
||||||
# help with inserting values at the right position.
|
# help with inserting values at the right position.
|
||||||
self.queue.set_size(len(state.torrents))
|
self.queue.set_size(len(state.torrents))
|
||||||
|
|
||||||
|
# Reorder the state.torrents list to add torrents with .fastresume files
|
||||||
|
# first.
|
||||||
|
fr_first = []
|
||||||
for torrent_state in state.torrents:
|
for torrent_state in state.torrents:
|
||||||
|
if os.path.exists(os.path.join(
|
||||||
|
self.config["torrentfiles_location"],
|
||||||
|
torrent_state.filename, ".fastresume")):
|
||||||
|
fr_first.insert(0, torrent_state)
|
||||||
|
else:
|
||||||
|
fr_first.append(torrent_state)
|
||||||
|
|
||||||
|
for torrent_state in fr_first:
|
||||||
try:
|
try:
|
||||||
options = {
|
options = {
|
||||||
"compact_allocation": torrent_state.compact,
|
"compact_allocation": torrent_state.compact,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue