mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
Added check to see if blocklist should be downloaded when load on start is enabled.
Updated function names in gtkui.
This commit is contained in:
parent
5b4d138baf
commit
191d83c4be
@ -84,7 +84,14 @@ class Core(CorePluginBase):
|
||||
|
||||
self.config = deluge.configmanager.ConfigManager("blocklist.conf", DEFAULT_PREFS)
|
||||
if self.config["load_on_start"]:
|
||||
# TODO: Check if been more than check_after_days
|
||||
if self.config["last_update"]:
|
||||
now = datetime.datetime.now()
|
||||
last_update = datetime.datetime.strptime(self.config["last_update"],
|
||||
"%a, %d %b %Y %H:%M:%S GMT")
|
||||
check_period = datetime.timedelta(days=self.config["check_after_days"])
|
||||
if not self.config["last_update"] or last_update + check_period >= now:
|
||||
d = self.check_import()
|
||||
else:
|
||||
self.use_cache = True
|
||||
d = self.import_list()
|
||||
d.addCallbacks(self.on_import_complete, self.on_import_error)
|
||||
@ -175,10 +182,10 @@ class Core(CorePluginBase):
|
||||
import socket
|
||||
socket.setdefaulttimeout(self.config["timeout"])
|
||||
|
||||
headers = {}
|
||||
if not url:
|
||||
url = self.config["url"]
|
||||
|
||||
headers = {}
|
||||
if self.config["last_update"] and not self.force_download:
|
||||
headers['If-Modified-Since'] = self.config["last_update"]
|
||||
|
||||
|
@ -158,11 +158,11 @@ class GtkUI(GtkPluginBase):
|
||||
|
||||
def _on_button_check_download_clicked(self, widget):
|
||||
self._on_apply_prefs()
|
||||
client.blocklist.import_list(False)
|
||||
client.blocklist.check_import()
|
||||
|
||||
def _on_button_force_download_clicked(self, widget):
|
||||
self._on_apply_prefs()
|
||||
client.blocklist.import_list(True)
|
||||
client.blocklist.check_import(force=True)
|
||||
|
||||
def _on_status_item_clicked(self, widget, event):
|
||||
component.get("Preferences").show("Blocklist")
|
||||
|
Loading…
x
Reference in New Issue
Block a user