X-Git-Url: https://www.irasnyder.com/gitweb/?p=rarslave2.git;a=blobdiff_plain;f=PAR2Set%2FExtractFirstOldRAR.py;fp=PAR2Set%2FExtractFirstOldRAR.py;h=26ed99778bd7e4dde4aa015e3998c8efc511f99d;hp=1a45c9e88501a5fad19460355621c010a8bfa828;hb=44cd23f16a5a184adb1d8890633a0e432a2e5636;hpb=24f030f703d80f8eedc85a4c4039e81006fd20a3 diff --git a/PAR2Set/ExtractFirstOldRAR.py b/PAR2Set/ExtractFirstOldRAR.py index 1a45c9e..26ed997 100644 --- a/PAR2Set/ExtractFirstOldRAR.py +++ b/PAR2Set/ExtractFirstOldRAR.py @@ -1,32 +1,56 @@ #!/usr/bin/env python # vim: set ts=4 sts=4 sw=4 textwidth=92: -import PAR2Set.ExtractFirstBase -import PAR2Set.OldRAR -import rsutil.common +""" +Holds the ExtractFirstOldRAR class. +This module works with old-style rar sets which need to be extracted +before they are verified. + +It will detect sets like the following: +X.par2 +X.vol0+1.par2 +... + +X.rar +X.r00 +X.r01 +... + +Where the PAR2 files do not protect the rar files directly, but instead +protect the files contained inside the rar files. +""" + +__author__ = "Ira W. Snyder (devel@irasnyder.com)" +__copyright__ = "Copyright (c) 2006,2007 Ira W. Snyder (devel@irasnyder.com)" +__license__ = "GNU GPL v2 (or, at your option, any later version)" + +# ExtractFirstOldRAR.py -- detect and work with a old-style rar set # -# 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 +# Copyright (C) 2006,2007 Ira W. Snyder (devel@irasnyder.com) # -# ABC.rar -# ABC.r00 -# ABC.r01 +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. # -# Where the PAR2 files protect all files that do not match in basename -# with the PAR2 file itself. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +import PAR2Set.ExtractFirstBase +import PAR2Set.OldRAR +import rsutil.common + def detector (name_files, prot_files): + """Detects a ExtractFirstOldRAR set""" + return rsutil.common.has_a_match ('^.*\.r00$', name_files) \ and not rsutil.common.has_a_match ('^.*\.r00$', prot_files) @@ -34,6 +58,8 @@ def detector (name_files, prot_files): class ExtractFirstOldRAR (PAR2Set.ExtractFirstBase.ExtractFirstBase, \ PAR2Set.OldRAR.OldRAR): + """Class for old-style rar sets which must be extracted before repair""" + def __repr__ (self): return 'EXTRACTFIRST OLDRAR'