X-Git-Url: https://www.irasnyder.com/gitweb/?a=blobdiff_plain;f=PAR2Set%2FNoExtract.py;h=c065aa34392af822588f9149ea5883bcbdd06a2d;hb=44cd23f16a5a184adb1d8890633a0e432a2e5636;hp=ce2fdfacb385325d316951b7d074327098e77ffc;hpb=24f030f703d80f8eedc85a4c4039e81006fd20a3;p=rarslave2.git diff --git a/PAR2Set/NoExtract.py b/PAR2Set/NoExtract.py index ce2fdfa..c065aa3 100644 --- a/PAR2Set/NoExtract.py +++ b/PAR2Set/NoExtract.py @@ -1,35 +1,71 @@ #!/usr/bin/env python # vim: set ts=4 sts=4 sw=4 textwidth=92: -import logging -import PAR2Set.Base -import rsutil.common +""" +Holds the NoExtract class. + +This module works with sets that only need to repair and delete, and do +not need any extraction. + +It will detect sets like the following: +X.par2 +X.vol0+1.par2 +... + +01.mp3 +02.mp3 +... + +Where the PAR2 files protect the mp3 files directly. + +NOTE: It doesn't just detect mp3's, it will detect any set that does not +NOTE: have any extractable elements in it. +""" +__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)" + +# NoExtract.py # -# This is a class that will only repair and delete, not extract +# Copyright (C) 2006,2007 Ira W. Snyder (devel@irasnyder.com) # -# It will detect sets like the following: -# X.par2 -# X.vol0+1.par2 -# X.vol1+2.par2 -# 01.mp3 -# 02.mp3 -# 03.mp3 +# 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 the mp3 files. +# 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 logging +import PAR2Set.Base +import rsutil.common + def detector (name_files, prot_files): + """Detector for the NoExtract type""" + EXTRACT_REGEX = rsutil.common.config_get_value ('regular expressions', 'extractable_regex') return not rsutil.common.has_a_match (EXTRACT_REGEX, prot_files) class NoExtract (PAR2Set.Base.Base): + """Class for sets that do not need to be extracted. Note that this is not a + base class, this is a working class.""" + def __repr__ (self): return 'NoExtract' def runAll (self): + """Run the Repair and Deletion stages, omitting the Extraction stage""" # Repair Stage ret = self.runVerifyAndRepair ()