Initial work on extraction.
[rarslave2.git] / rarslave.py
index 6532de5..47fbb03 100644 (file)
@@ -113,6 +113,38 @@ def is_zip (files):
                if has_extension (f, '.zip'):
                        return True
 
                if has_extension (f, '.zip'):
                        return True
 
+def is_noextract (files):
+       # Type that needs no extraction.
+       # TODO: Add others ???
+       for f in files:
+               if has_extension (f, '.001'):
+                       return True
+
+def find_deleteable_files (files):
+       # Deleteable types regex should come from the config
+       dfiles = []
+       dregex = re.compile ('^.*\.(par2|\d|\d\d\d|rar|r\d\d|zip)$', re.IGNORECASE)
+
+       return [f for f in files if dregex.match (f)]
+
+def extract (heads, todir):
+       # Try to extract each head
+       # NOTE: REQUIRES full paths to heads
+
+       PWD = os.getcwd()
+
+       # FIXME: Should come from the config
+       RCMD = 'unrar x -o+ -- '
+       ZCMD = 'unzip -- '
+
+       for h in heads:
+               # find type
+               # extract it
+
+               # NOTE: probably not able to clean up effectively...
+               pass
+
+
 
 def main ():
        print find_all_par2_files ('/home/irasnyd/downloads/test_material/01/')
 
 def main ():
        print find_all_par2_files ('/home/irasnyd/downloads/test_material/01/')