mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 13:05:37 +00:00
Save torrent state every 5 minutes.
This commit is contained in:
parent
a17328fff7
commit
170c3810b3
2
TODO
2
TODO
@ -14,6 +14,4 @@
|
||||
to add menuitems to the torrentmenu in an easy way.
|
||||
* Restart daemon function
|
||||
* Sync the details pane to current trunk
|
||||
* Automatically save torrent state every ~5 minutes, much like how
|
||||
configmanager does it.
|
||||
* Docstrings!
|
||||
|
@ -37,6 +37,8 @@ import pickle
|
||||
import os.path
|
||||
import os
|
||||
|
||||
import gobject
|
||||
|
||||
import deluge.libtorrent as lt
|
||||
|
||||
import deluge.common
|
||||
@ -76,6 +78,9 @@ class TorrentManager:
|
||||
# Try to load the state from file
|
||||
self.load_state()
|
||||
|
||||
# Save the state every 5 minutes
|
||||
self.save_state_timer = gobject.timeout_add(300000, self.save_state)
|
||||
|
||||
# Register set functions
|
||||
self.config.register_set_function("max_connections_per_torrent",
|
||||
self.on_set_max_connections_per_torrent)
|
||||
@ -318,6 +323,9 @@ class TorrentManager:
|
||||
except IOError:
|
||||
log.warning("Unable to save state file.")
|
||||
|
||||
# We return True so that the timer thread will continue
|
||||
return True
|
||||
|
||||
def delete_fastresume(self, torrent_id):
|
||||
"""Deletes the .fastresume file"""
|
||||
torrent = self.torrents[torrent_id]
|
||||
|
Loading…
x
Reference in New Issue
Block a user