Exemplo n.º 1
0
 def _extract(self, path_in, file, password):
     try:
         if Utils.is_zip(path_in, file):
             Utils.extract_zip(path_in, file, path_in, password)
         elif Utils.is_rar(path_in, file):
             Utils.extract_rar(path_in, file, path_in, password)
         elif Utils.is_tar(path_in, file):
             Utils.extract_tar(path_in, file, path_in)
     except OSError, e:
         logging.error(e)
         return False
Exemplo n.º 2
0
    def _walk_dir(self, dir, path_out):
        try:
            for root, dirs, files in os.walk(dir):
                for file in files:
                    file.replace('$', '\$')

                    if Utils.is_zip(root, file) or \
                            Utils.is_rar(root, file) or \
                            Utils.is_tar(root, file):
                        self._extract_file(root, file)
                        Utils.remove_file(root, file)
                    else:
                        if Utils.is_apk(root, file):
                            Utils.rename_file(root, path_out, file)
                        else:
                            Utils.remove_file(root, file)
        except OSError, e:
            logging.error("Error walking dir '%s': %s" % (dir, e))
            raise OSError