[RARSLAVE] Improve deletion
[rarslave2.git] / rarslave.py
index 89d526d..884bfe5 100644 (file)
@@ -330,14 +330,32 @@ class PAR2Set (object):
 
                # Repair Stage
                repairer = RarslaveRepairer (self.dir, par2head, join)
-               repairer.checkAndRepair () # FIXME: Check return value
+               ret = repairer.checkAndRepair () # FIXME: Check return value
 
                # Extraction Stage
                extractor = find_extraction_heads (self.dir, self.likely_files)
-               extractor.extract ('extract_dir') # FIXME: Get it from the config
+               ret = extractor.extract ('extract_dir') # FIXME: Get it from the config
 
                # Deletion Stage
-               printlist ( find_deleteable_files (self.likely_files) )
+               # printlist ( find_deleteable_files (self.likely_files) )
+               deleteable_files = find_deleteable_files (self.likely_files)
+               ret = delete_list (deleteable_files)
+
+def delete_list (files, interactive=False):
+       # Delete a list of files
+       # TODO: Add the ability to confirm deletion, like in the original rarslave
+
+       if interactive:
+               # TODO: prompt here
+               # prompt -> OK_TO_DELETE -> do nothing, fall through
+               # prompt -> NOT_OK -> return immediately
+               pass
+
+       for f in files:
+               # FIXME: re-enable this in production
+               # os.remove (f)
+               print 'rm', f
+
 
 def generate_all_parsets (dir):
        # Generate all parsets in the given directory.