diff options
Diffstat (limited to 'module/plugins/hoster/Xdcc.py')
-rw-r--r-- | module/plugins/hoster/Xdcc.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index cf512c7b4..4e29e2ea9 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- import re +import select import socket import struct import sys import time -from select import select - from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import fs_join +from module.plugins.internal.misc import fsjoin -class Xdcc(Hoster): - __name__ = "Xdcc" +class XDCC(Hoster): + __name__ = "XDCC" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.37" __status__ = "testing" __config__ = [("nick", "str", "Nickname", "pyload"), @@ -49,7 +48,7 @@ class Xdcc(Hoster): else: errno = e.args[0] - if errno == 10054: + if errno is 10054: self.log_debug("Server blocked our ip, retry in 5 min") self.wait(300) continue @@ -67,15 +66,15 @@ class Xdcc(Hoster): chan = m.group(2) bot = m.group(3) pack = m.group(4) - nick = self.get_config('nick') - ident = self.get_config('ident') - real = self.get_config('realname') + nick = self.config.get('nick') + ident = self.config.get('ident') + real = self.config.get('realname') temp = server.split(':') ln = len(temp) - if ln == 2: + if ln is 2: host, port = temp - elif ln == 1: + elif ln is 1: host, port = temp[0], 6667 else: self.fail(_("Invalid hostname for IRC Server: %s") % server) @@ -119,7 +118,7 @@ class Xdcc(Hoster): sock.close() self.fail(_("XDCC Bot did not answer")) - fdset = select([sock], [], [], 0) + fdset = select.select([sock], [], [], 0) if sock not in fdset[0]: continue @@ -140,7 +139,7 @@ class Xdcc(Hoster): self.fail(_("IRC-Error: %s") % line) msg = line.split(None, 3) - if len(msg) != 4: + if len(msg) is not 4: continue msg = { @@ -189,7 +188,7 @@ class Xdcc(Hoster): self.pyfile.name = packname dl_folder = self.pyload.config.get("general", "download_folder") - filename = fs_join(dl_folder, packname) + filename = fsjoin(dl_folder, packname) self.log_info(_("Downloading %s from %s:%d") % (packname, ip, port)) |