update tracker aka force reannounce

This commit is contained in:
Marcos Pinto 2007-09-22 19:44:11 +00:00
parent d91bcbe55c
commit 731c51815e
4 changed files with 24 additions and 0 deletions

View File

@ -212,6 +212,12 @@ class Core(dbus.service.Object):
# Emit the torrent_removed signal
self.torrent_removed(torrent_id)
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="s", out_signature="")
def force_reannounce(self, torrent_id):
log.debug("Forcing reannouncment to trackers of torrent %s", torrent_id)
self.torrents.force_reannounce(torrent_id)
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="s", out_signature="")
def pause_torrent(self, torrent_id):

View File

@ -197,6 +197,16 @@ class TorrentManager:
return True
def force_reannounce(self, torrent_id):
"""Resume a torrent"""
try:
self.torrents[torrent_id].handle.force_reannounce()
except:
return False
return True
def load_state(self):
"""Load the state of the TorrentManager from the torrents.state file"""
state = TorrentManagerState()

View File

@ -122,6 +122,12 @@ def resume_torrent(torrent_ids):
for torrent_id in torrent_ids:
core.resume_torrent(torrent_id)
def force_reannounce(torrent_ids):
"""Reannounce to trackers"""
core = get_core()
for torrent_id in torrent_ids:
core.force_reannounce(torrent_id)
def get_torrent_status(core, torrent_id, keys):
"""Builds the status dictionary and returns it"""
status = core.get_torrent_status(torrent_id, keys)

View File

@ -137,6 +137,8 @@ class MenuBar:
def on_menuitem_updatetracker_activate(self, data=None):
log.debug("on_menuitem_updatetracker_activate")
functions.force_reannounce(
self.window.torrentview.get_selected_torrents())
def on_menuitem_edittrackers_activate(self, data=None):
log.debug("on_menuitem_edittrackers_activate")