+#!/usr/bin/env python
+# vim: set ts=4 sts=4 sw=4 textwidth=92:
+
+import logging
+import PAR2Set.Base
+import rsutil.common
+
+#
+# This is a class that will only repair and delete, not extract
+#
+# It will detect sets like the following:
+# X.par2
+# X.vol0+1.par2
+# X.vol1+2.par2
+# 01.mp3
+# 02.mp3
+# 03.mp3
+#
+# Where the PAR2 files protect the mp3 files.
+#
+
+def detector (name_files, prot_files):
+ EXTRACT_REGEX = rsutil.common.config_get_value ('regular expressions', 'extractable_regex')
+ return not rsutil.common.has_a_match (EXTRACT_REGEX, prot_files)
+
+
+class NoExtract (PAR2Set.Base.Base):
+
+ def __repr__ (self):
+ return 'NoExtract'
+
+ def runAll (self):
+
+ # Repair Stage
+ ret = self.runVerifyAndRepair ()
+
+ if ret != rsutil.common.SUCCESS:
+ logging.critical ('Repair stage failed for: %s' % self.p2file)
+ return -rsutil.common.ECHECK
+
+ self.update_matches ()
+
+ # Deletion Stage
+ ret = self.runDelete ()
+
+ if ret != rsutil.common.SUCCESS:
+ logging.critical ('Deletion stage failed for: %s' % self.p2file)
+ return -rsutil.common.EDELETE
+
+ logging.info ('Successfully completed: %s' % self.p2file)
+ return rsutil.common.SUCCESS
+