Major Projectwide Restructuring
[rarslave2.git] / PAR2Set_EF_NEWRAR.py
diff --git a/PAR2Set_EF_NEWRAR.py b/PAR2Set_EF_NEWRAR.py
new file mode 100644 (file)
index 0000000..6b90591
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# vim: set ts=4 sts=4 sw=4 textwidth=92:
+
+import PAR2Set_NEWRAR
+import PAR2Set_EXTRACTFIRST
+from RarslaveCommon import *
+
+#
+# This is an old-style rar type
+#
+# It will detect sets like the following:
+# X.par2
+# X.vol0+1.par2
+# X.vol1+2.par2
+# X.rar
+# X.r00
+# X.r01
+#
+# OR
+#
+# ABC.rar
+# ABC.r00
+# ABC.r01
+#
+# Where the PAR2 files protect all files that do not match in basename
+# with the PAR2 file itself.
+#
+
+def detect_EF_NEWRAR (name_files, prot_files):
+       return has_a_match ('^.*\.part0*1\.rar$', name_files) \
+                       and not has_a_match ('^.*\.part0*1\.rar$', prot_files)
+
+
+class PAR2Set_EF_NEWRAR (PAR2Set_EXTRACTFIRST.PAR2Set_EXTRACTFIRST,
+                                                       PAR2Set_NEWRAR.PAR2Set_NEWRAR):
+
+       def __repr__ (self):
+               return 'EXTRACTFIRST NEWRAR'
+