[RARSLAVE] Fix runCheckAndRepair() for joined files
authorIra W. Snyder <devel@irasnyder.com>
Fri, 29 Dec 2006 03:17:32 +0000 (19:17 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Fri, 29 Dec 2006 03:17:32 +0000 (19:17 -0800)
The function runCheckAndRepair() was broken for files that needed to be
joined, because it was including protected files on the par2 command line.
This patch fixes the behavior so that only split pieces are added.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
rarslave.py

index 6972d41..a8e69bc 100644 (file)
@@ -321,10 +321,16 @@ class PAR2Set (object):
 
                self.name_matched_files = self.__find_name_matches (self.dir, self.basename)
 
+       def __is_joinfile (self, filename):
+               regex = re.compile ('^.*\.\d\d\d$', re.IGNORECASE)
+               if regex.match (filename):
+                       return True
+
+               return False
+
        def __should_be_joined (self, files):
-               regex = re.compile ('^.*\.001$', re.IGNORECASE)
                for f in files:
-                       if regex.match (f):
+                       if self.__is_joinfile (f):
                                return True
 
        def runCheckAndRepair (self):
@@ -342,9 +348,10 @@ class PAR2Set (object):
                        if f != self.p2file:
                                command += "\"%s\" " % os.path.split (f)[1]
 
+               # Only needed when using par2 to join
                if join:
                        for f in all_files:
-                               if f not in self.p2files:
+                               if self.__is_joinfile (f):
                                        command += "\"%s\" " % os.path.split (f)[1]
 
                # run the command