# vim: set ts=4 sts=4 sw=4 textwidth=92:
from RarslaveCommon import *
-import RarslaveLogger
import Par2Parser
import re
# extraction_function ()
#
-class PAR2Set (object):
+class Base (object):
# Instance Variables
# ==========================================================================
# vim: set ts=4 sts=4 sw=4 textwidth=92:
import logging
-import PAR2Set
+import PAR2Set.Base
from RarslaveCommon import *
#
# (and other) files.
#
-class PAR2Set_EXTRACTFIRST (PAR2Set.PAR2Set):
+class ExtractFirstBase (PAR2Set.Base.Base):
def runAll (self):
#!/usr/bin/env python
# vim: set ts=4 sts=4 sw=4 textwidth=92:
-import PAR2Set_NEWRAR
-import PAR2Set_EXTRACTFIRST
+import PAR2Set.ExtractFirstBase
+import PAR2Set.NewRAR
from RarslaveCommon import *
#
# with the PAR2 file itself.
#
-def detect_EF_NEWRAR (name_files, prot_files):
+def detector (name_files, prot_files):
return has_a_match ('^.*\.part0*1\.rar$', name_files) \
and not has_a_match ('^.*\.part0*1\.rar$', prot_files)
-class PAR2Set_EF_NEWRAR (PAR2Set_EXTRACTFIRST.PAR2Set_EXTRACTFIRST,
- PAR2Set_NEWRAR.PAR2Set_NEWRAR):
+class ExtractFirstNewRAR (PAR2Set.ExtractFirstBase.ExtractFirstBase, \
+ PAR2Set.NewRAR.NewRAR):
def __repr__ (self):
return 'EXTRACTFIRST NEWRAR'
#!/usr/bin/env python
# vim: set ts=4 sts=4 sw=4 textwidth=92:
-import PAR2Set_OLDRAR
-import PAR2Set_EXTRACTFIRST
+import PAR2Set.ExtractFirstBase
+import PAR2Set.OldRAR
from RarslaveCommon import *
#
# with the PAR2 file itself.
#
-def detect_EF_OLDRAR (name_files, prot_files):
+def detector (name_files, prot_files):
return has_a_match ('^.*\.r00$', name_files) \
and not has_a_match ('^.*\.r00$', prot_files)
-class PAR2Set_EF_OLDRAR (PAR2Set_EXTRACTFIRST.PAR2Set_EXTRACTFIRST,
- PAR2Set_OLDRAR.PAR2Set_OLDRAR):
+class ExtractFirstOldRAR (PAR2Set.ExtractFirstBase.ExtractFirstBase, \
+ PAR2Set.OldRAR.OldRAR):
def __repr__ (self):
return 'EXTRACTFIRST OLDRAR'
# vim: set ts=4 sts=4 sw=4 textwidth=92:
import logging
-import PAR2Set
+import PAR2Set.Base
from RarslaveCommon import *
#
# work where the PAR2 files are protecting the .001, etc files directly.
#
-def detect_JOIN (name_files, prot_files):
+def detector (name_files, prot_files):
return has_a_match ('^.*\.\d\d\d$', name_files) \
and not has_a_match ('^.*\.\d\d\d$', prot_files)
-class PAR2Set_JOIN (PAR2Set.PAR2Set):
+class Join (PAR2Set.Base.Base):
def __repr__ (self):
return 'JOIN'
#!/usr/bin/env python
# vim: set ts=4 sts=4 sw=4 textwidth=92:
-import PAR2Set
+import PAR2Set.Base
from RarslaveCommon import *
#
# with the PAR2 file itself.
#
-def detect_NEWRAR (name_files, prot_files):
+def detector (name_files, prot_files):
return has_a_match ('^.*\.part0*1\.rar$', prot_files)
-class PAR2Set_NEWRAR (PAR2Set.PAR2Set):
+class NewRAR (PAR2Set.Base.Base):
def __repr__ (self):
return 'NEWRAR'
#!/usr/bin/env python
# vim: set ts=4 sts=4 sw=4 textwidth=92:
-import PAR2Set
+import PAR2Set.Base
from RarslaveCommon import *
#
# with the PAR2 file itself.
#
-def detect_OLDRAR (name_files, prot_files):
+def detector (name_files, prot_files):
return has_a_match ('^.*\.r00$', prot_files)
-class PAR2Set_OLDRAR (PAR2Set.PAR2Set):
+class OldRAR (PAR2Set.Base.Base):
def __repr__ (self):
return 'OLDRAR'
#!/usr/bin/env python
# vim: set ts=4 sts=4 sw=4 textwidth=92:
-import PAR2Set
+import PAR2Set.Base
from RarslaveCommon import *
#
# Where the PAR2 files protect a file named X.zip and/or ABC.zip.
#
-def detect_ZIP (name_files, prot_files):
+def detector (name_files, prot_files):
all_files = no_duplicates (name_files + prot_files)
return has_a_match ('^.*\.zip$', all_files)
-class PAR2Set_ZIP (PAR2Set.PAR2Set):
+class ZIP (PAR2Set.Base.Base):
def __repr__ (self):
return 'ZIP'
# Module Description Goes Here
+import Base
+import ExtractFirstBase
+import ExtractFirstNewRAR
+import ExtractFirstOldRAR
+import Join
+import NewRAR
+import OldRAR
+import ZIP
+
__all__ = ['Base', 'ExtractFirstBase', 'ExtractFirstNewRAR', 'ExtractFirstOldRAR', 'Join',
'NewRAR', 'OldRAR', 'ZIP']
from RarslaveCommon import *
# PAR2Set-derived types
-import PAR2Set_JOIN
-import PAR2Set_ZIP
-import PAR2Set_OLDRAR
-import PAR2Set_NEWRAR
-import PAR2Set_EF_OLDRAR
-import PAR2Set_EF_NEWRAR
+import PAR2Set.Join
+import PAR2Set.ZIP
+import PAR2Set.OldRAR
+import PAR2Set.NewRAR
+import PAR2Set.ExtractFirstOldRAR
+import PAR2Set.ExtractFirstNewRAR
import logging
# A tuple of tuples with the following definition:
# (TYPE_NAME, DETECTION_FUNCTION, PAR2Set-derived class)
- TYPES = ( (PAR2Set_JOIN.detect_JOIN, PAR2Set_JOIN.PAR2Set_JOIN),
- (PAR2Set_ZIP.detect_ZIP, PAR2Set_ZIP.PAR2Set_ZIP),
- (PAR2Set_OLDRAR.detect_OLDRAR, PAR2Set_OLDRAR.PAR2Set_OLDRAR),
- (PAR2Set_NEWRAR.detect_NEWRAR, PAR2Set_NEWRAR.PAR2Set_NEWRAR),
- (PAR2Set_EF_OLDRAR.detect_EF_OLDRAR, PAR2Set_EF_OLDRAR.PAR2Set_EF_OLDRAR),
- (PAR2Set_EF_NEWRAR.detect_EF_NEWRAR, PAR2Set_EF_NEWRAR.PAR2Set_EF_NEWRAR),
+ TYPES = ( (PAR2Set.Join.detector, PAR2Set.Join.Join),
+ (PAR2Set.ZIP.detector, PAR2Set.ZIP.ZIP),
+ (PAR2Set.OldRAR.detector, PAR2Set.OldRAR.OldRAR),
+ (PAR2Set.NewRAR.detector, PAR2Set.NewRAR.NewRAR),
+ (PAR2Set.ExtractFirstOldRAR.detector, PAR2Set.ExtractFirstOldRAR.ExtractFirstOldRAR),
+ (PAR2Set.ExtractFirstNewRAR.detector, PAR2Set.ExtractFirstNewRAR.ExtractFirstNewRAR),
)
def __init__ (self, dir, p2file):
#!/usr/bin/env python
# vim: set ts=4 sts=4 sw=4 textwidth=92:
-import RarslaveLogger
import RarslaveConfig
# I know that this sucks majorly, but I kinda need it to keep things
-# sane in the code. I don't /want/ to have to keep passing the config,
-# options, and logger around all the time.
+# sane in the code. I don't /want/ to have to keep passing the config
+# and options around all the time.
# This will hold the configuration from the configuration file. This should
# only be used to hold statically, non-runtime alterable content.
# from the configuration file.
options = None
-# This will hold the logger that will be able to log everything in all the
-# classes in rarslave.
-logger = RarslaveLogger.RarslaveLogger ()
-
# Run any special actions that are needed on these options
run_options (options)
- # Find the loglevel using the options given
+ # Find the loglevel using the options given
logging.getLogger().setLevel (find_loglevel (options))
# Run recursively
# Print the results
if logger.size () > 0:
- print 'Log\n' + '=' * 80
+ print '\nLog\n' + '=' * 80
logger.close ()
# Done!