Scrape tracker if we do not receive any peer information on announce.

Minor UI tweaks.
This commit is contained in:
Andrew Resch 2007-11-29 07:09:18 +00:00
parent a7e6ec4b06
commit aa019231ba
3 changed files with 655 additions and 642 deletions

View File

@ -367,6 +367,16 @@ class TorrentManager:
return True return True
def scrape_tracker(self, torrent_id):
"""Scrape the tracker"""
try:
self.torrents[torrent_id].handle.scrape_tracker()
except Exception, e:
log.debug("Unable to scrape tracker: %s", e)
return False
return True
def force_recheck(self, torrent_id): def force_recheck(self, torrent_id):
"""Forces a re-check of the torrent's data""" """Forces a re-check of the torrent's data"""
log.debug("Doing a forced recheck on %s", torrent_id) log.debug("Doing a forced recheck on %s", torrent_id)
@ -525,6 +535,12 @@ class TorrentManager:
except KeyError: except KeyError:
log.debug("torrent_id doesn't exist.") log.debug("torrent_id doesn't exist.")
# Check to see if we got any peer information from the tracker
if alert.handle.status().num_complete == -1 or \
alert.handle.status().num_incomplete == -1:
# We didn't get peer information, so lets send a scrape request
self.scrape_tracker(torrent_id)
def on_alert_tracker_announce(self, alert): def on_alert_tracker_announce(self, alert):
log.debug("on_alert_tracker_announce") log.debug("on_alert_tracker_announce")
# Get the torrent_id # Get the torrent_id

View File

@ -408,6 +408,7 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow_sidebar"> <widget class="GtkScrolledWindow" id="scrolledwindow_sidebar">
<property name="width_request">110</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -459,11 +460,6 @@
<property name="shrink">False</property> <property name="shrink">False</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="resize_mode">GTK_RESIZE_QUEUE</property>
<child> <child>
<widget class="GtkNotebook" id="torrent_info"> <widget class="GtkNotebook" id="torrent_info">
<property name="visible">True</property> <property name="visible">True</property>
@ -1165,8 +1161,6 @@
</packing> </packing>
</child> </child>
</widget> </widget>
</child>
</widget>
<packing> <packing>
<property name="resize">False</property> <property name="resize">False</property>
<property name="shrink">False</property> <property name="shrink">False</property>

View File

@ -57,6 +57,9 @@ class SideBar(component.Component):
self.liststore.append([_("Seeding"), self.liststore.append([_("Seeding"),
gtk.gdk.pixbuf_new_from_file( gtk.gdk.pixbuf_new_from_file(
deluge.common.get_pixmap("seeding16.png"))]) deluge.common.get_pixmap("seeding16.png"))])
self.liststore.append([_("Paused"),
gtk.gdk.pixbuf_new_from_file(
deluge.common.get_pixmap("inactive16.png"))])
# Create the column # Create the column
column = gtk.TreeViewColumn(_("Labels")) column = gtk.TreeViewColumn(_("Labels"))
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)