Move common functionality into rsutil package
[rarslave2.git] / PAR2Set / NewRAR.py
index f6702c9..e780ec8 100644 (file)
@@ -2,7 +2,7 @@
 # vim: set ts=4 sts=4 sw=4 textwidth=92:
 
 import PAR2Set.Base
 # vim: set ts=4 sts=4 sw=4 textwidth=92:
 
 import PAR2Set.Base
-from RarslaveCommon import *
+import rsutil.common
 
 #
 # This is an new-style rar type
 
 #
 # This is an new-style rar type
@@ -26,7 +26,7 @@ from RarslaveCommon import *
 #
 
 def detector (name_files, prot_files):
 #
 
 def detector (name_files, prot_files):
-       return has_a_match ('^.*\.part0*1\.rar$', prot_files)
+       return rsutil.common.has_a_match ('^.*\.part0*1\.rar$', prot_files)
 
 
 class NewRAR (PAR2Set.Base.Base):
 
 
 class NewRAR (PAR2Set.Base.Base):
@@ -35,16 +35,16 @@ class NewRAR (PAR2Set.Base.Base):
                return 'NEWRAR'
 
        def find_extraction_heads (self):
                return 'NEWRAR'
 
        def find_extraction_heads (self):
-               return find_matches ('^.*\.part0*1\.rar$', self.all_files)
+               return rsutil.common.find_matches ('^.*\.part0*1\.rar$', self.all_files)
 
        def extraction_function (self, file, todir):
                assert os.path.isfile (file)
                assert os.path.isdir (todir)
 
 
        def extraction_function (self, file, todir):
                assert os.path.isfile (file)
                assert os.path.isdir (todir)
 
-               RAR_CMD = config_get_value ('commands', 'unrar')
+               RAR_CMD = rsutil.common.config_get_value ('commands', 'unrar')
 
                cmd = '%s \"%s\"' % (RAR_CMD, file)
 
                cmd = '%s \"%s\"' % (RAR_CMD, file)
-               ret = run_command (cmd, todir)
+               ret = rsutil.common.run_command (cmd, todir)
 
                # Check error code
                if ret != 0:
 
                # Check error code
                if ret != 0: