Fix typos in blocklist core.
Remove reset_ip_filter and block_ip_range from deluge core.
This commit is contained in:
parent
75338d8a9e
commit
e9f62ea08c
|
@ -625,24 +625,6 @@ class Core(component.Component):
|
|||
"""Sets the path for the torrent to be moved when completed"""
|
||||
return self.torrentmanager[torrent_id].set_move_completed_path(value)
|
||||
|
||||
@export
|
||||
def block_ip_range(self, range):
|
||||
"""Block an ip range"""
|
||||
self.ip_filter.add_rule(range[0], range[1], 1)
|
||||
|
||||
# Start a 2 second timer (and remove the previous one if it exists)
|
||||
if self.__set_ip_filter_timer:
|
||||
self.__set_ip_filter_timer.stop()
|
||||
|
||||
self.__set_ip_filter_timer = LoopingCall(self.session.set_ip_filter, self.ip_filter)
|
||||
self.__set_ip_filter_timer.start(2, False)
|
||||
|
||||
@export
|
||||
def reset_ip_filter(self):
|
||||
"""Clears the ip filter"""
|
||||
self.ip_filter = lt.ip_filter()
|
||||
self.session.set_ip_filter(self.ip_filter)
|
||||
|
||||
@export
|
||||
def get_health(self):
|
||||
"""Returns True if we have established incoming connections"""
|
||||
|
|
|
@ -190,7 +190,8 @@ class Core(CorePluginBase):
|
|||
if self.config["last_update"] and not self.force_download:
|
||||
headers['If-Modified-Since'] = self.config["last_update"]
|
||||
|
||||
log.debug("Attempting to download blocklist %s", url)
|
||||
log.debug("Attempting to download blocklist %s" % url)
|
||||
log.debug("Sending headers: %s" % headers)
|
||||
self.is_downloading = True
|
||||
return download_file(url, deluge.configmanager.get_config_dir("blocklist.download"), headers)
|
||||
|
||||
|
@ -199,7 +200,7 @@ class Core(CorePluginBase):
|
|||
log.debug("Blocklist download complete!")
|
||||
self.is_downloading = False
|
||||
return threads.deferToThread(self.update_info,
|
||||
deluge.configmanager.ConfigManager("blocklist.download"))
|
||||
deluge.configmanager.get_config_dir("blocklist.download"))
|
||||
|
||||
def on_download_error(self, f):
|
||||
"""Recovers from download error"""
|
||||
|
@ -219,7 +220,7 @@ class Core(CorePluginBase):
|
|||
if "Not Modified" in error_msg:
|
||||
log.debug("Blocklist is up-to-date!")
|
||||
d = threads.deferToThread(update_info,
|
||||
deluge.configmanager.ConfigManager("blocklist.cache"))
|
||||
deluge.configmanager.get_config_dir("blocklist.cache"))
|
||||
self.use_cache = True
|
||||
f.trap(f.type)
|
||||
elif self.failed_attempts < self.config["try_times"]:
|
||||
|
@ -248,8 +249,8 @@ class Core(CorePluginBase):
|
|||
# Move downloaded blocklist to cache
|
||||
if not self.use_cache:
|
||||
d = threads.deferToThread(shutil.move,
|
||||
deluge.configmanager.ConfigManager("blocklist.download"),
|
||||
deluge.configmanager.ConfigManager("blocklist.cache"))
|
||||
deluge.configmanager.get_config_dir("blocklist.download"),
|
||||
deluge.configmanager.get_config_dir("blocklist.cache"))
|
||||
return d
|
||||
|
||||
def on_import_error(self, f):
|
||||
|
|
Loading…
Reference in New Issue