From 5b71ec94fabd87c267f1dea446c53ef786e1b8f7 Mon Sep 17 00:00:00 2001 From: AndroKev Date: Sun, 27 Oct 2013 17:42:19 +0100 Subject: ExtractArchives - add an option to excludefiles --- module/plugins/hooks/ExtractArchive.py | 9 +++++---- module/plugins/internal/AbstractExtractor.py | 7 ++++--- module/plugins/internal/UnRar.py | 8 ++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'module') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 2cb546fbb..704ef3c6e 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -59,7 +59,7 @@ class ExtractArchive(Hook): Provides: unrarFinished (folder, filename) """ __name__ = "ExtractArchive" - __version__ = "0.15" + __version__ = "0.16" __description__ = "Extract different kind of archives" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), @@ -68,11 +68,12 @@ class ExtractArchive(Hook): ("deletearchive", "bool", "Delete archives when done", False), ("subfolder", "bool", "Create subfolder for each package", False), ("destination", "folder", "Extract files to", ""), + ("excludefiles", "str", "Exclude files from unpacking(seperated by ;)", "nfo;log"), ("recursive", "bool", "Extract archives in archvies", True), ("queue", "bool", "Wait for all downloads to be finished", True), ("renice", "int", "CPU Priority", 0)] - __author_name__ = ("pyload Team") - __author_mail__ = ("adminpyload.org") + __author_name__ = ("pyload Team", "AndroKev") + __author_mail__ = ("adminpyload.org", "@pyloadforum") event_list = ["allDownloadsProcessed"] @@ -177,7 +178,7 @@ class ExtractArchive(Hook): continue extracted.append(target) # prevent extracting same file twice - klass = plugin(self, target, out, self.getConfig("fullpath"), self.getConfig("overwrite"), + klass = plugin(self, target, out, self.getConfig("fullpath"), self.getConfig("overwrite"), self.getConfig("excludefiles"), self.getConfig("renice")) klass.init() diff --git a/module/plugins/internal/AbstractExtractor.py b/module/plugins/internal/AbstractExtractor.py index 2130f910e..2ba2f2edf 100644 --- a/module/plugins/internal/AbstractExtractor.py +++ b/module/plugins/internal/AbstractExtractor.py @@ -27,10 +27,10 @@ class AbtractExtractor: raise NotImplementedError - def __init__(self, m, file, out, fullpath, overwrite, renice): + def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice): """Initialize extractor for specific file - :param m: ExtractArchive Hook plugin + :param m: Extracd pylctArchive Hook plugin :param file: Absolute filepath :param out: Absolute path to destination directory :param fullpath: extract to fullpath @@ -42,6 +42,7 @@ class AbtractExtractor: self.out = out self.fullpath = fullpath self.overwrite = overwrite + self.excludefiles = excludefiles self.renice = renice self.files = [] # Store extracted files here @@ -90,4 +91,4 @@ class AbtractExtractor: def getExtractedFiles(self): """Populate self.files at some point while extracting""" - return self.files \ No newline at end of file + return self.files diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index da8e7cf3d..00f15791a 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -29,7 +29,7 @@ from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPas class UnRar(AbtractExtractor): __name__ = "UnRar" - __version__ = "0.13" + __version__ = "0.14" # there are some more uncovered rar formats re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$", re.I) @@ -185,6 +185,11 @@ class UnRar(AbtractExtractor): args = [] #overwrite flag args.append("-o+") if self.overwrite else args.append("-o-") + + if self.excludefiles != "": + for word in self.excludefiles.split(';'): + args.append("-x*" + word) + # assume yes on all queries args.append("-y") @@ -195,7 +200,6 @@ class UnRar(AbtractExtractor): else: args.append("-p-") - #NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) self.m.logDebug(" ".join(call)) -- cgit v1.2.3 From 5bbc5bdb087d98e0af584120eec0692d35f0fab7 Mon Sep 17 00:00:00 2001 From: AndroKev Date: Sun, 27 Oct 2013 18:10:28 +0100 Subject: Update AbstractExtractor.py there was a little bug --- module/plugins/internal/AbstractExtractor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module') diff --git a/module/plugins/internal/AbstractExtractor.py b/module/plugins/internal/AbstractExtractor.py index 2ba2f2edf..ace79e149 100644 --- a/module/plugins/internal/AbstractExtractor.py +++ b/module/plugins/internal/AbstractExtractor.py @@ -30,7 +30,7 @@ class AbtractExtractor: def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice): """Initialize extractor for specific file - :param m: Extracd pylctArchive Hook plugin + :param m: ExtractArchive Hook plugin :param file: Absolute filepath :param out: Absolute path to destination directory :param fullpath: extract to fullpath -- cgit v1.2.3 From aa9c7048902bf0fc90153118cf36d47910c7699c Mon Sep 17 00:00:00 2001 From: AndroKev Date: Sat, 2 Nov 2013 16:57:07 +0100 Subject: Deleted default value and cleaned the code a little bit --- module/plugins/hooks/ExtractArchive.py | 2 +- module/plugins/internal/UnRar.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'module') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 704ef3c6e..be023301c 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -68,7 +68,7 @@ class ExtractArchive(Hook): ("deletearchive", "bool", "Delete archives when done", False), ("subfolder", "bool", "Create subfolder for each package", False), ("destination", "folder", "Extract files to", ""), - ("excludefiles", "str", "Exclude files from unpacking(seperated by ;)", "nfo;log"), + ("excludefiles", "str", "Exclude files from unpacking (seperated by ;)", ""), ("recursive", "bool", "Extract archives in archvies", True), ("queue", "bool", "Wait for all downloads to be finished", True), ("renice", "int", "CPU Priority", 0)] diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 00f15791a..8a97ac7b7 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -186,7 +186,7 @@ class UnRar(AbtractExtractor): #overwrite flag args.append("-o+") if self.overwrite else args.append("-o-") - if self.excludefiles != "": + if self.excludefiles: for word in self.excludefiles.split(';'): args.append("-x*" + word) -- cgit v1.2.3 From 1cc2e8415828c2e4d60a3c872ea6b6cfd5f284c5 Mon Sep 17 00:00:00 2001 From: AndroKev Date: Sat, 2 Nov 2013 18:34:05 +0100 Subject: Deleted the wildcard --- module/plugins/internal/UnRar.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 8a97ac7b7..80ee39cdf 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -188,9 +188,8 @@ class UnRar(AbtractExtractor): if self.excludefiles: for word in self.excludefiles.split(';'): - args.append("-x*" + word) + args.append("-x%s" % word ) - # assume yes on all queries args.append("-y") -- cgit v1.2.3