+# Global Variables
+(TYPE_OLDRAR, TYPE_NEWRAR, TYPE_ZIP, TYPE_NOEXTRACT) = range (4)
+
+class RarslaveExtractor (object):
+
+ def __init__ (self, type):
+ self.type = type
+ self.heads = []
+
+ def addHead (self, head):
+ assert not os.path.isfile (head)
+
+ self.heads.append (head)
+
+ def extract (self, todir):
+ # Extract all heads
+
+ extraction_func = \
+ { TYPE_OLDRAR : self.__extract_rar,
+ TYPE_NEWRAR : self.__extract_rar,
+ TYPE_ZIP : self.__extract_zip,
+ TYPE_NOEXTRACT : self.__extract_noextract }[self.type]
+
+ # Call the extraction function on each head
+ for h in self.heads:
+ extraction_func (h, todir)
+
+ def __extract_rar (self, file, todir):
+ print 'Extracting (%s, %s)' % (file, todir)
+
+ def __extract_zip (self, file, todir):
+ print 'Extracting (%s, %s)' % (file, todir)
+
+ def __extract_noextract (self, file, todir):
+ print 'Extracting (%s, %s)' % (file, todir)
+
+