From 4c63928557398891c30d3e2b7c962a07b3483315 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:18:41 +0100 Subject: Rename AbstractExtractor to Extractor --- module/plugins/internal/Extractor.py | 140 +++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 module/plugins/internal/Extractor.py (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py new file mode 100644 index 000000000..0b2462dac --- /dev/null +++ b/module/plugins/internal/Extractor.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- + +class ArchiveError(Exception): + pass + + +class CRCError(Exception): + pass + + +class PasswordError(Exception): + pass + + +class Extractor: + __name__ = "Extractor" + __version__ = "0.13" + + __description__ = """Base extractor plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + EXTENSIONS = [] + + + @classmethod + def checkDeps(cls): + """ Check if system statisfy dependencies + :return: boolean + """ + return True + + + @classmethod + def isArchive(cls, file): + raise NotImplementedError + + + @classmethod + def getTargets(cls, files_ids): + """ Filter suited targets from list of filename id tuple list + :param files_ids: List of filepathes + :return: List of targets, id tuple list + """ + targets = [] + + for file, id in files_ids: + if cls.isArchive(file): + targets.append((file, id)) + + return targets + + + def __init__(self, m, file, out, password, fullpath, overwrite, excludefiles, renice, delete, keepbroken): + """Initialize extractor for specific file + + :param m: ExtractArchive Hook plugin + :param file: Absolute filepath + :param out: Absolute path to destination directory + :param fullpath: extract to fullpath + :param overwrite: Overwrite existing archives + :param renice: Renice value + """ + self.m = m + self.file = file + self.out = out + self.password = password + self.fullpath = fullpath + self.overwrite = overwrite + self.excludefiles = excludefiles + self.renice = renice + self.delete = delete + self.keepbroken = keepbroken + self.files = [] #: Store extracted files here + + + def init(self): + """ Initialize additional data structures """ + pass + + + def verify(self): + """Check if password if needed. Raise ArchiveError if integrity is + questionable. + + :raises ArchiveError + """ + pass + + + def isPassword(self, password): + """ Check if the given password is/might be correct. + If it can not be decided at this point return true. + + :param password: + :return: boolean + """ + if isinstance(password, basestring): + return True + else: + return False + + + def setPassword(self, password): + if self.isPassword(password): + self.password = password + return True + else: + return False + + + def repair(self): + return False + + + def extract(self, progress=lambda x: None): + """Extract the archive. Raise specific errors in case of failure. + + :param progress: Progress function, call this to update status + :raises PasswordError + :raises CRCError + :raises ArchiveError + :return: + """ + raise NotImplementedError + + + def getDeleteFiles(self): + """Return list of files to delete, do *not* delete them here. + + :return: List with paths of files to delete + """ + raise NotImplementedError + + + def getExtractedFiles(self): + """Populate self.files at some point while extracting""" + return self.files -- cgit v1.2.3 From 7fc3362307737cd7c565b710ec83c5bdc4d3e8a9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 25 Jan 2015 03:05:00 +0100 Subject: Revert Extractor to the old one (temp) --- module/plugins/internal/Extractor.py | 79 +++++++++++------------------------- 1 file changed, 24 insertions(+), 55 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 0b2462dac..55d9b2e83 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -8,52 +8,37 @@ class CRCError(Exception): pass -class PasswordError(Exception): +class WrongPassword(Exception): pass class Extractor: __name__ = "Extractor" - __version__ = "0.13" + __version__ = "0.14" __description__ = """Base extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("pyLoad Team", "admin@pyload.org")] - EXTENSIONS = [] - - - @classmethod - def checkDeps(cls): + @staticmethod + def checkDeps(): """ Check if system statisfy dependencies :return: boolean """ return True - @classmethod - def isArchive(cls, file): - raise NotImplementedError - - - @classmethod - def getTargets(cls, files_ids): + @staticmethod + def getTargets(files_ids): """ Filter suited targets from list of filename id tuple list :param files_ids: List of filepathes :return: List of targets, id tuple list """ - targets = [] - - for file, id in files_ids: - if cls.isArchive(file): - targets.append((file, id)) - - return targets + raise NotImplementedError - def __init__(self, m, file, out, password, fullpath, overwrite, excludefiles, renice, delete, keepbroken): + def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice): """Initialize extractor for specific file :param m: ExtractArchive Hook plugin @@ -63,17 +48,14 @@ class Extractor: :param overwrite: Overwrite existing archives :param renice: Renice value """ - self.m = m - self.file = file - self.out = out - self.password = password - self.fullpath = fullpath - self.overwrite = overwrite + self.m = m + self.file = file + self.out = out + self.fullpath = fullpath + self.overwrite = overwrite self.excludefiles = excludefiles - self.renice = renice - self.delete = delete - self.keepbroken = keepbroken - self.files = [] #: Store extracted files here + self.renice = renice + self.files = [] #: Store extracted files here def init(self): @@ -81,45 +63,32 @@ class Extractor: pass - def verify(self): + def checkArchive(self): """Check if password if needed. Raise ArchiveError if integrity is questionable. + :return: boolean :raises ArchiveError """ - pass + return False - def isPassword(self, password): + def checkPassword(self, password): """ Check if the given password is/might be correct. If it can not be decided at this point return true. :param password: :return: boolean """ - if isinstance(password, basestring): - return True - else: - return False - - - def setPassword(self, password): - if self.isPassword(password): - self.password = password - return True - else: - return False - - - def repair(self): - return False + return True - def extract(self, progress=lambda x: None): + def extract(self, progress, password=None): """Extract the archive. Raise specific errors in case of failure. :param progress: Progress function, call this to update status - :raises PasswordError + :param password password to use + :raises WrongPassword :raises CRCError :raises ArchiveError :return: -- cgit v1.2.3 From 8848a359a43316fb346b728d1d79d7b72d27e5a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 27 Jan 2015 17:48:25 +0100 Subject: Update Extractor (again) --- module/plugins/internal/Extractor.py | 76 +++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 28 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 55d9b2e83..ddf0f8a85 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -1,5 +1,11 @@ # -*- coding: utf-8 -*- +import os + +from module.PyFile import PyFile +from module.utils import fs_encode + + class ArchiveError(Exception): pass @@ -8,29 +14,39 @@ class CRCError(Exception): pass -class WrongPassword(Exception): +class PasswordError(Exception): pass class Extractor: __name__ = "Extractor" - __version__ = "0.14" + __version__ = "0.15" __description__ = """Base extractor plugin""" __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + EXTENSIONS = [] - @staticmethod - def checkDeps(): + @classmethod + def isArchive(cls, filename): + name = os.path.basename(filename).lower() + return any(name.endswith(ext) for ext in cls.EXTENSIONS) + + + @classmethod + def checkDeps(cls): """ Check if system statisfy dependencies :return: boolean """ return True - @staticmethod - def getTargets(files_ids): + @classmethod + def getTargets(cls, files_ids): """ Filter suited targets from list of filename id tuple list :param files_ids: List of filepathes :return: List of targets, id tuple list @@ -38,24 +54,28 @@ class Extractor: raise NotImplementedError - def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice): - """Initialize extractor for specific file - - :param m: ExtractArchive Hook plugin - :param file: Absolute filepath - :param out: Absolute path to destination directory - :param fullpath: extract to fullpath - :param overwrite: Overwrite existing archives - :param renice: Renice value - """ - self.m = m - self.file = file - self.out = out - self.fullpath = fullpath - self.overwrite = overwrite - self.excludefiles = excludefiles - self.renice = renice - self.files = [] #: Store extracted files here + def __init__(self, manager, filename, out, + fullpath=True, + overwrite=False, + excludefiles=[], + renice=0, + delete=False, + keepbroken=False, + fid=None): + """ Initialize extractor for specific file """ + self.manager = manager + self.target = fs_encode(filename) + self.out = out + self.fullpath = fullpath + self.overwrite = overwrite + self.excludefiles = excludefiles + self.renice = renice + self.delete = delete + self.keepbroken = keepbroken + self.files = [] #: Store extracted files here + + pyfile = self.manager.core.files.getFile(fid) if fid else None + self.notifyProgress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None def init(self): @@ -83,12 +103,12 @@ class Extractor: return True - def extract(self, progress, password=None): + def extract(self, password=None): """Extract the archive. Raise specific errors in case of failure. :param progress: Progress function, call this to update status :param password password to use - :raises WrongPassword + :raises PasswordError :raises CRCError :raises ArchiveError :return: @@ -101,7 +121,7 @@ class Extractor: :return: List with paths of files to delete """ - raise NotImplementedError + return [self.target] def getExtractedFiles(self): -- cgit v1.2.3 From 788a06132882300a22f6db3aa7ac3a6009d4d762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 29 Jan 2015 23:13:54 +0100 Subject: Update Extractor (2) --- module/plugins/internal/Extractor.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index ddf0f8a85..3ea634ec8 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -3,7 +3,6 @@ import os from module.PyFile import PyFile -from module.utils import fs_encode class ArchiveError(Exception): @@ -20,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.15" + __version__ = "0.16" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -64,7 +63,7 @@ class Extractor: fid=None): """ Initialize extractor for specific file """ self.manager = manager - self.target = fs_encode(filename) + self.filename = filename self.out = out self.fullpath = fullpath self.overwrite = overwrite @@ -83,17 +82,17 @@ class Extractor: pass - def checkArchive(self): + def check(self): """Check if password if needed. Raise ArchiveError if integrity is questionable. :return: boolean :raises ArchiveError """ - return False + raise PasswordError - def checkPassword(self, password): + def isPassword(self, password): """ Check if the given password is/might be correct. If it can not be decided at this point return true. @@ -103,6 +102,10 @@ class Extractor: return True + def repair(self): + return False + + def extract(self, password=None): """Extract the archive. Raise specific errors in case of failure. @@ -121,7 +124,7 @@ class Extractor: :return: List with paths of files to delete """ - return [self.target] + return [self.filename] def getExtractedFiles(self): -- cgit v1.2.3 From b2904e3e704ece4e891f3d2bfbcc8af2d6d8c2e1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 31 Jan 2015 20:13:28 +0100 Subject: [SevenZip] Better check method + fix list method --- module/plugins/internal/Extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 3ea634ec8..4c38760f2 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -19,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.16" + __version__ = "0.17" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -37,7 +37,7 @@ class Extractor: @classmethod - def checkDeps(cls): + def isUsable(cls): """ Check if system statisfy dependencies :return: boolean """ -- cgit v1.2.3 From 7368881d2ba95cca3f47afbb0f4ef5861f2774df Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 31 Jan 2015 23:19:30 +0100 Subject: Extractor final fixup --- module/plugins/internal/Extractor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 4c38760f2..719dc613c 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -50,7 +50,7 @@ class Extractor: :param files_ids: List of filepathes :return: List of targets, id tuple list """ - raise NotImplementedError + return [(fname, id) for fname, id in files_ids if cls.isArchive(fname)] def __init__(self, manager, filename, out, -- cgit v1.2.3 From 8dfb7adc0fc3c858c0ddf9371c2f4580bb8be3c7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 3 Feb 2015 00:10:11 +0100 Subject: Update Extractor (3) --- module/plugins/internal/Extractor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 719dc613c..45c13c159 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -19,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.17" + __version__ = "0.18" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -41,7 +41,7 @@ class Extractor: """ Check if system statisfy dependencies :return: boolean """ - return True + return None @classmethod @@ -99,11 +99,11 @@ class Extractor: :param password: :return: boolean """ - return True + return None def repair(self): - return False + return None def extract(self, password=None): @@ -127,6 +127,6 @@ class Extractor: return [self.filename] - def getExtractedFiles(self): + def list(self, password=None): """Populate self.files at some point while extracting""" return self.files -- cgit v1.2.3 From 2a809297f288a585d96af0d8afd894c2a2f695fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Sun, 8 Feb 2015 13:47:59 +0100 Subject: [ExtractArchive] correct fullpath behavior, bugfix --- module/plugins/internal/Extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 45c13c159..a5a8756d8 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -19,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.18" + __version__ = "0.19" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -50,7 +50,7 @@ class Extractor: :param files_ids: List of filepathes :return: List of targets, id tuple list """ - return [(fname, id) for fname, id in files_ids if cls.isArchive(fname)] + return [(fname, id, fout) for fname, id, fout in files_ids if cls.isArchive(fname)] def __init__(self, manager, filename, out, -- cgit v1.2.3 From 2dc3536e36956eab99fa5f7945dcf60073b5fd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Mon, 9 Feb 2015 23:36:10 +0100 Subject: [ExtractArchive] better Multipart behavior, new version output --- module/plugins/internal/Extractor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index a5a8756d8..56860ad53 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -19,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.19" + __version__ = "0.20" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -28,12 +28,18 @@ class Extractor: EXTENSIONS = [] + VERSION = "" @classmethod def isArchive(cls, filename): name = os.path.basename(filename).lower() - return any(name.endswith(ext) for ext in cls.EXTENSIONS) + return any(name.endswith(ext) for ext in cls.EXTENSIONS) and not cls.isMultipart(filename) + + + @classmethod + def isMultipart(cls,filename): + return False @classmethod -- cgit v1.2.3 From f2ac32085922f739343bac3cf396e703833323f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Wed, 11 Feb 2015 16:32:55 +0100 Subject: [UnRar] bugfixes --- module/plugins/internal/Extractor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 56860ad53..b445f1497 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -24,7 +24,8 @@ class Extractor: __description__ = """Base extractor plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "ranan@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] + ("Walter Purcaro", "vuolter@gmail.com"), + ("Immenz", "immenz@gmx.net")] EXTENSIONS = [] -- cgit v1.2.3 From 56caf611ab8f733ac8a7ea09d2a3d492bd485762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Sun, 22 Feb 2015 03:09:40 +0100 Subject: Some more changes --- module/plugins/internal/Extractor.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index b445f1497..8bf1875cf 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -19,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.20" + __version__ = "0.21" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -30,6 +30,7 @@ class Extractor: EXTENSIONS = [] VERSION = "" + REPAIR = False @classmethod @@ -90,23 +91,24 @@ class Extractor: def check(self): - """Check if password if needed. Raise ArchiveError if integrity is - questionable. + """Quick Check by listing content of archive. + Raises error if password is needed, integrity is questionable or else. - :return: boolean + :raises PasswordError + :raises CRCError :raises ArchiveError """ - raise PasswordError - - - def isPassword(self, password): - """ Check if the given password is/might be correct. - If it can not be decided at this point return true. - - :param password: - :return: boolean + raise NotImplementedError + + def test(self): + """Testing with Extractors buildt-in method + Raises error if password is needed, integrity is questionable or else. + + :raises PasswordError + :raises CRCError + :raises ArchiveError """ - return None + raise NotImplementedError def repair(self): -- cgit v1.2.3 From 93eb54614d512396a5505cb9bdea4e201920b434 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 1 Mar 2015 00:33:21 +0100 Subject: Spare code cosmetics --- module/plugins/internal/Extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 8bf1875cf..ee62ebcb7 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -99,11 +99,11 @@ class Extractor: :raises ArchiveError """ raise NotImplementedError - + def test(self): """Testing with Extractors buildt-in method Raises error if password is needed, integrity is questionable or else. - + :raises PasswordError :raises CRCError :raises ArchiveError -- cgit v1.2.3 From 3a9c167ceca27d57dbef927626fe853a3d0e30b2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 1 Mar 2015 22:41:08 +0100 Subject: [Extractor] Use self.target --- module/plugins/internal/Extractor.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index ee62ebcb7..bc8e67c6d 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -3,6 +3,7 @@ import os from module.PyFile import PyFile +from module.utils import fs_encode class ArchiveError(Exception): @@ -71,6 +72,7 @@ class Extractor: fid=None): """ Initialize extractor for specific file """ self.manager = manager + self.target = "'%s'" % fs_encode(filename) self.filename = filename self.out = out self.fullpath = fullpath -- cgit v1.2.3 From 8b432eb80715f84800febb88620d943211e28051 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 4 Mar 2015 02:21:50 +0100 Subject: Revert 3a9c167ceca27d57dbef927626fe853a3d0e30b2 --- module/plugins/internal/Extractor.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index bc8e67c6d..4b21cc49c 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -3,7 +3,6 @@ import os from module.PyFile import PyFile -from module.utils import fs_encode class ArchiveError(Exception): @@ -71,17 +70,16 @@ class Extractor: keepbroken=False, fid=None): """ Initialize extractor for specific file """ - self.manager = manager - self.target = "'%s'" % fs_encode(filename) - self.filename = filename - self.out = out - self.fullpath = fullpath - self.overwrite = overwrite - self.excludefiles = excludefiles - self.renice = renice - self.delete = delete - self.keepbroken = keepbroken - self.files = [] #: Store extracted files here + self.manager = manager + self.filename = filename + self.out = out + self.fullpath = fullpath + self.overwrite = overwrite + self.excludefiles = excludefiles + self.renice = renice + self.delete = delete + self.keepbroken = keepbroken + self.files = [] #: Store extracted files here pyfile = self.manager.core.files.getFile(fid) if fid else None self.notifyProgress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None -- cgit v1.2.3 From 7beb65e991bc6d1913c3b5bb2ef69e659d5b8342 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 01:55:52 +0100 Subject: Spare code cosmetics --- module/plugins/internal/Extractor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 4b21cc49c..79864818e 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -23,9 +23,9 @@ class Extractor: __description__ = """Base extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), + __authors__ = [("RaNaN" , "ranan@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com"), - ("Immenz", "immenz@gmx.net")] + ("Immenz" , "immenz@gmx.net" )] EXTENSIONS = [] @@ -40,7 +40,7 @@ class Extractor: @classmethod - def isMultipart(cls,filename): + def isMultipart(cls, filename): return False -- cgit v1.2.3 From 2bc144adb6bc2759b635e09687b27bf96074827f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 13:39:07 +0100 Subject: Spare code cosmetics --- module/plugins/internal/Extractor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 79864818e..f32329e37 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -23,8 +23,7 @@ class Extractor: __description__ = """Base extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN" , "ranan@pyload.org" ), - ("Walter Purcaro", "vuolter@gmail.com"), + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), ("Immenz" , "immenz@gmx.net" )] -- cgit v1.2.3 From d0ef13775925f15811d2a6744d29190c313b3820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Mon, 23 Mar 2015 00:32:56 +0100 Subject: [ExtractArchive] extract archive even if first part is not in package --- module/plugins/internal/Extractor.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index f32329e37..dad57dc7f 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os +import re from module.PyFile import PyFile @@ -19,7 +20,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.21" + __version__ = "0.22" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -35,7 +36,7 @@ class Extractor: @classmethod def isArchive(cls, filename): name = os.path.basename(filename).lower() - return any(name.endswith(ext) for ext in cls.EXTENSIONS) and not cls.isMultipart(filename) + return any(name.endswith(ext) for ext in cls.EXTENSIONS) @classmethod @@ -57,7 +58,16 @@ class Extractor: :param files_ids: List of filepathes :return: List of targets, id tuple list """ - return [(fname, id, fout) for fname, id, fout in files_ids if cls.isArchive(fname)] + targets = [] + processed = [] + + for fname, id, fout in files_ids: + if cls.isArchive(fname): + pname = re.sub(cls.re_multipart, '', fname) if cls.isMultipart(fname) else os.path.splitext(fname)[0] + if pname not in processed: + processed.append(pname) + targets.append((fname, id, fout)) + return targets def __init__(self, manager, filename, out, -- cgit v1.2.3 From ffb46ab200df55303836cc49e61b971b02e67ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Wed, 25 Mar 2015 18:39:54 +0100 Subject: [ExtractArchive] Send2Trash Integration --- module/plugins/internal/Extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index dad57dc7f..ec6a4e175 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -20,7 +20,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -75,7 +75,7 @@ class Extractor: overwrite=False, excludefiles=[], renice=0, - delete=False, + delete='No', keepbroken=False, fid=None): """ Initialize extractor for specific file """ -- cgit v1.2.3 From 329293e0bb0cf4008688d8c73d4b98caa7082141 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 26 Mar 2015 10:40:32 +0100 Subject: [Extractor] Rename method 'test' to 'verify' --- module/plugins/internal/Extractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Extractor.py') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index ec6a4e175..159b65ffe 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -20,7 +20,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.23" + __version__ = "0.24" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -109,7 +109,7 @@ class Extractor: """ raise NotImplementedError - def test(self): + def verify(self): """Testing with Extractors buildt-in method Raises error if password is needed, integrity is questionable or else. -- cgit v1.2.3