X-Git-Url: https://www.irasnyder.com/gitweb/?p=rarslave2.git;a=blobdiff_plain;f=rarslave.py;h=47fbb03e35ebc4ea2c24369f089e28a867ca49a8;hp=6532de57de81ce6d34a5a88f5f42018450d66be0;hb=5ec7a887a528ecf80185ef26a2d5b754cb05ef18;hpb=f4ae5ea4515b9a7d8a3198e13cd4472da748a99c diff --git a/rarslave.py b/rarslave.py index 6532de5..47fbb03 100644 --- a/rarslave.py +++ b/rarslave.py @@ -113,6 +113,38 @@ def is_zip (files): 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/')