Add PeerGuardian Text (Gzip) reader
This commit is contained in:
parent
48f445d9a0
commit
c61a6eb34b
|
@ -38,7 +38,7 @@ import deluge.configmanager
|
|||
from deluge.core.rpcserver import export
|
||||
|
||||
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",
|
||||
|
@ -57,7 +57,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': ["PeerGuardian Text (GZip)", PGTextReaderGzip]
|
||||
}
|
||||
|
||||
class Core(CorePluginBase):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue