summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-22 21:27:47 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-22 21:27:47 +0200
commit674b2a24f90b3cbf50630ddfdfb6c2b356a7bf7b (patch)
tree24a575f4c7319a3f9048718a08094bb510f72603
parentSpare code cosmetics (10) (diff)
parentlittle fix (diff)
downloadpyload-674b2a24f90b3cbf50630ddfdfb6c2b356a7bf7b.tar.xz
Merge pull request #11 from ardi69/0.4.10
some fixes
-rw-r--r--pyload/config/Setup.py11
-rw-r--r--pyload/database/Backend.py4
-rw-r--r--pyload/database/User.py2
-rw-r--r--pyload/plugin/Extractor.py6
-rw-r--r--pyload/plugin/addon/ExtractArchive.py2
-rw-r--r--pyload/plugin/extractor/SevenZip.py5
-rw-r--r--pyload/plugin/extractor/UnRar.py21
-rw-r--r--pyload/plugin/extractor/UnZip.py3
-rw-r--r--pyload/utils/printer.py4
9 files changed, 31 insertions, 27 deletions
diff --git a/pyload/config/Setup.py b/pyload/config/Setup.py
index f078d54d0..e2f96c802 100644
--- a/pyload/config/Setup.py
+++ b/pyload/config/Setup.py
@@ -24,6 +24,11 @@ class SetupAssistant(object):
self.lang = "en"
self.stdin_encoding = get_console_encoding(sys.stdin.encoding)
+ # Input shorthand for yes
+ self.yes = "y"
+ # Input shorthand for no
+ self.no = "n"
+
def start(self):
print
@@ -383,7 +388,7 @@ class SetupAssistant(object):
print _("2 - List users")
print _("3 - Remove user")
print _("4 - Quit")
- action = raw_input("[1]/2/3/4: ")
+ action = raw_input("1/2/3/4: ")
if not action in ("1", "2", "3", "4"):
continue
elif action == "1":
@@ -463,8 +468,8 @@ class SetupAssistant(object):
info = ""
print "%(dep)-12s %(bool)s (%(info)s)" % {'dep': name + ':',
- 'bool': _(true if value else false).upper(),
- 'info': info}
+ 'bool': _(true if value else false).upper(),
+ 'info': info}
def check_module(self, module):
diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py
index e851885c0..1fa7a654c 100644
--- a/pyload/database/Backend.py
+++ b/pyload/database/Backend.py
@@ -186,11 +186,11 @@ class DatabaseBackend(Thread):
print "Filedatabase was deleted due to incompatible version."
remove("files.version")
move("files.db", "files.backup.db")
-
+
with open("files.version", "wb") as f:
f.write(str(DB_VERSION))
- return v
+ return v
def _convertDB(self, v):
diff --git a/pyload/database/User.py b/pyload/database/User.py
index 2aedc3bba..b5b44c50a 100644
--- a/pyload/database/User.py
+++ b/pyload/database/User.py
@@ -82,7 +82,7 @@ class UserMethods(object):
@style.queue
def getAllUserData(db):
db.c.execute("SELECT name, permission, role, template, email FROM users")
- return {{"permission": r[1], "role": r[2], "template": r[3], "email": r[4]} for r in db.c}
+ return {r[0]: {"permission": r[1], "role": r[2], "template": r[3], "email": r[4]} for r in db.c}
@style.queue
diff --git a/pyload/plugin/Extractor.py b/pyload/plugin/Extractor.py
index e50ab8818..539ab624d 100644
--- a/pyload/plugin/Extractor.py
+++ b/pyload/plugin/Extractor.py
@@ -31,16 +31,12 @@ class Extractor:
EXTENSIONS = []
+ NAME = __name__
VERSION = ""
REPAIR = False
@classmethod
- def NAME(self):
- return getattr(self, "_" + self.__name__ + "__name")
-
-
- @classmethod
def isArchive(cls, filename):
name = os.path.basename(filename).lower()
return any(name.endswith(ext) for ext in cls.EXTENSIONS)
diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py
index b0a24446a..616334af2 100644
--- a/pyload/plugin/addon/ExtractArchive.py
+++ b/pyload/plugin/addon/ExtractArchive.py
@@ -186,7 +186,7 @@ class ExtractArchive(Addon):
traceback.print_exc()
if self.extractors:
- self.logDebug(*["Found %s %s" % (Extractor.NAME(), Extractor.VERSION) for Extractor in self.extractors])
+ self.logDebug(*["Found %s %s" % (Extractor.NAME, Extractor.VERSION) for Extractor in self.extractors])
self.extractQueued() #: Resume unfinished extractions
else:
self.logInfo(_("No Extract plugins activated"))
diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py
index 3c5e86602..cf5f7bfb8 100644
--- a/pyload/plugin/extractor/SevenZip.py
+++ b/pyload/plugin/extractor/SevenZip.py
@@ -15,11 +15,12 @@ class SevenZip(UnRar):
__description = """7-Zip extractor plugin"""
__license = "GPLv3"
- __authors = [("Michael Nowak" , "" ),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ __authors = [("Michael Nowak" , ""),
+ ("Walter Purcaro", "vuolter@gmail.com")]
CMD = "7z"
+ NAME = __name__.rsplit('.', 1)[1]
VERSION = ""
EXTENSIONS = [".7z", ".xz", ".zip", ".gz", ".gzip", ".tgz", ".bz2", ".bzip2",
diff --git a/pyload/plugin/extractor/UnRar.py b/pyload/plugin/extractor/UnRar.py
index 38ae4e8f2..83821cdc1 100644
--- a/pyload/plugin/extractor/UnRar.py
+++ b/pyload/plugin/extractor/UnRar.py
@@ -27,20 +27,21 @@ class UnRar(Extractor):
__description = """Rar extractor plugin"""
__license = "GPLv3"
- __authors = [("RaNaN" , "RaNaN@pyload.org" ),
- ("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz" , "immenz@gmx.net" )]
+ __authors = [("RaNaN", "RaNaN@pyload.org"),
+ ("Walter Purcaro", "vuolter@gmail.com"),
+ ("Immenz", "immenz@gmx.net")]
- CMD = "unrar"
- VERSION = ""
+ CMD = "unrar"
+ NAME = __name__.rsplit('.', 1)[1]
+ VERSION = ""
EXTENSIONS = [".rar"]
- re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?',re.I)
+ re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I)
re_filefixed = re.compile(r'Building (.+)')
- re_filelist = re.compile(r'^(.)(\s*[\w\.\-]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.M|re.I)
+ re_filelist = re.compile(r'^(.)(\s*[\w\.\-]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.M | re.I)
re_wrongpwd = re.compile(r'password', re.I)
re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I)
@@ -55,7 +56,7 @@ class UnRar(Extractor):
cls.CMD = os.path.join(pypath, "RAR.exe")
p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
- cls.__name = "RAR"
+ cls.NAME = "RAR"
cls.REPAIR = True
except OSError:
@@ -66,7 +67,7 @@ class UnRar(Extractor):
try:
p = subprocess.Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
- cls.__name = "RAR"
+ cls.NAME = "RAR"
cls.REPAIR = True
except OSError: #: fallback to unrar
@@ -177,7 +178,7 @@ class UnRar(Extractor):
# eventually Multipart Files
files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir))
- if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file))
+ if re.sub(self.re_multipart, ".rar", name) == re.sub(self.re_multipart, ".rar", file))
return files
diff --git a/pyload/plugin/extractor/UnZip.py b/pyload/plugin/extractor/UnZip.py
index b4fa637f0..8bfd63480 100644
--- a/pyload/plugin/extractor/UnZip.py
+++ b/pyload/plugin/extractor/UnZip.py
@@ -21,7 +21,8 @@ class UnZip(Extractor):
EXTENSIONS = [".zip", ".zip64"]
- VERSION ="(python %s.%s.%s)" % (sys.version_info[0], sys.version_info[1], sys.version_info[2])
+ NAME = __name__.rsplit('.', 1)[1]
+ VERSION = "(python %s.%s.%s)" % (sys.version_info[0], sys.version_info[1], sys.version_info[2])
@classmethod
diff --git a/pyload/utils/printer.py b/pyload/utils/printer.py
index 1122c7f4c..e4f6a360a 100644
--- a/pyload/utils/printer.py
+++ b/pyload/utils/printer.py
@@ -7,10 +7,10 @@ colorama.init(autoreset=True)
def color(color, text):
- return colorama.Fore.(c.upper())(text)
+ return colorama.Fore[c.upper()](text)
for c in colorama.Fore:
- eval("%(color) = lambda msg: color(%(color), msg)" % {'color': c.lower()}
+ eval("%(color)s = lambda msg: color(%(color)s, msg)" % {'color': c.lower()})
def overline(line, msg):