# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import os
-import PAR2Set.Base
-import rsutil.common
+from PAR2Set import Base, utils
+class OldRAR(Base):
-def detector (name_files, prot_files):
- """Detect OldRAR sets"""
+ ############################################################################
- return rsutil.common.has_a_match ('^.*\.r00$', prot_files)
+ def detect(self):
+ if not utils.hasAMatch('^.*\.r00$', self.protectedFiles):
+ raise TypeError
+ ############################################################################
-class OldRAR (PAR2Set.Base.Base):
+ def extract(self):
+ files = utils.findMatches('^.*\.rar$', self.protectedFiles)
- """Class for working with old-style rar sets"""
+ for f in files:
+ utils.runCommand(['unrar', 'x', '-o+', f], self.directory)
- def __repr__ (self):
- return 'OLDRAR'
-
- def find_extraction_heads (self):
- """Find the heads of extraction for an old-style rar set"""
-
- return rsutil.common.find_matches ('^.*\.rar$', self.all_files)
-
- def extraction_function (self, file, todir):
- """Extract a single rar file to the given directory.
-
- file -- the file to extract
- todir -- the directory to extract the file to"""
-
- assert os.path.isfile (file)
- assert os.path.isdir (todir)
-
- rsutil.common.run_command(['unrar', 'x', '-o+', file], todir)
+ ############################################################################