diff --git a/deluge/plugins/blocklist/blocklist/core.py b/deluge/plugins/blocklist/blocklist/core.py index 0e795166f..21531e6c6 100644 --- a/deluge/plugins/blocklist/blocklist/core.py +++ b/deluge/plugins/blocklist/blocklist/core.py @@ -37,7 +37,7 @@ import deluge.component as component import deluge.configmanager from peerguardian import PGReader, PGException -from text import TextReader, GZMuleReader, PGZip +from text import TextReader, GZMuleReader, PGZip, PGTextReaderGzip DEFAULT_PREFS = { "url": "http://deluge-torrent.org/blocklist/nipfilter.dat.gz", @@ -56,7 +56,8 @@ FORMATS = { 'gzmule': ["Emule IP list (GZip)", GZMuleReader], 'spzip': ["SafePeer Text (Zipped)", PGZip], 'pgtext': ["PeerGuardian Text (Uncompressed)", TextReader], - 'p2bgz': ["PeerGuardian P2B (GZip)", PGReader] + 'p2bgz': ["PeerGuardian P2B (GZip)", PGReader], + 'pgtextgz': ["PeerGuaedian Text (GZip)", PGTextReaderGzip] } class Core(CorePluginBase): diff --git a/deluge/plugins/blocklist/blocklist/text.py b/deluge/plugins/blocklist/blocklist/text.py index d607effa1..2c29fefc5 100644 --- a/deluge/plugins/blocklist/blocklist/text.py +++ b/deluge/plugins/blocklist/blocklist/text.py @@ -59,6 +59,13 @@ class PGTextReader(TextBase): regexp = ':(\d+)\.(\d+)\.(\d+)\.(\d+)-(\d+)\.(\d+)\.(\d+)\.(\d+)\s*$' TextBase.__init__(self, fd, regexp) +class PGTextReaderGzip(PGTextReader): + def __init__(self, filename): + log.debug("PGTextReaderGzip loading") + try: + PGTextReader.__init__(self, gzip.open(filename, "r")) + except: + log.debug("Wrong file type or corrupted blocklist file.") # This reads uncompressed PG text list class TextReader(PGTextReader):