mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Save torrent state every 5 minutes.
This commit is contained in:
parent
a17328fff7
commit
170c3810b3
2 changed files with 8 additions and 2 deletions
2
TODO
2
TODO
|
@ -14,6 +14,4 @@
|
||||||
to add menuitems to the torrentmenu in an easy way.
|
to add menuitems to the torrentmenu in an easy way.
|
||||||
* Restart daemon function
|
* Restart daemon function
|
||||||
* Sync the details pane to current trunk
|
* Sync the details pane to current trunk
|
||||||
* Automatically save torrent state every ~5 minutes, much like how
|
|
||||||
configmanager does it.
|
|
||||||
* Docstrings!
|
* Docstrings!
|
||||||
|
|
|
@ -37,6 +37,8 @@ import pickle
|
||||||
import os.path
|
import os.path
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import gobject
|
||||||
|
|
||||||
import deluge.libtorrent as lt
|
import deluge.libtorrent as lt
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
@ -75,6 +77,9 @@ class TorrentManager:
|
||||||
self.torrents = {}
|
self.torrents = {}
|
||||||
# Try to load the state from file
|
# Try to load the state from file
|
||||||
self.load_state()
|
self.load_state()
|
||||||
|
|
||||||
|
# Save the state every 5 minutes
|
||||||
|
self.save_state_timer = gobject.timeout_add(300000, self.save_state)
|
||||||
|
|
||||||
# Register set functions
|
# Register set functions
|
||||||
self.config.register_set_function("max_connections_per_torrent",
|
self.config.register_set_function("max_connections_per_torrent",
|
||||||
|
@ -317,6 +322,9 @@ class TorrentManager:
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
log.warning("Unable to save state file.")
|
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):
|
def delete_fastresume(self, torrent_id):
|
||||||
"""Deletes the .fastresume file"""
|
"""Deletes the .fastresume file"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue