def step(self):
     """
     legr: copy TIFF's from Goobi to Limb
     legr: if "overwrite_destination_files=True" is added to the command line, we send TIFF's to Limb
     legr:  even if we already has recieved ALTO's, PDF and TOC from a previous LIMB processing.
     """
     error = None
     self.getVariables()
     msg = ('Copying files from {0} to {1} via transit {2}.')
     msg = msg.format(self.source_folder, self.hotfolder_dir, self.transit_dir)
     self.debug_message(msg)
     try:
         if not self.overwrite_destination_files:
             if limb_tools.alreadyMoved(self.goobi_toc,self.goobi_pdf,
                                        self.input_files,self.goobi_altos,
                                        self.valid_exts):
                 return error
             if (tools.folderExist(self.hotfolder_dir) and
                 fs.compareDirectories(self.source_folder, self.hotfolder_dir)):
                 return error
         tools.copy_files(source = self.source_folder,
                          dest = self.hotfolder_dir,
                          transit = self.transit_dir,
                          delete_original = False,
                          wait_interval = self.sleep_interval,
                          max_retries = self.retries,
                          logger = self.glogger)
     except errors.TransferError as e:
         error = e.strerror
     except errors.TransferTimedOut as e:
         error = e.strerror
     except Exception as e:
         error = str(e)
     return error
 def transferXML(self):
     tools.copy_files(source = self.ojs_metadata_dir,
                      dest = self.ojs_dest_dir,
                      transit=None,
                      delete_original=False,
                      wait_interval=60,
                      max_retries=5,
                      logger=self.glogger,
                      change_owner=1000 # set owner to gid 1000 => ojs-group
                      )
 def copyFiles(self, source_dir, dest_dir):
     '''
     Wrapper around tools method
     Throws TransferError, TransferTimedOut
     '''
     tools.copy_files(source = source_dir,
                      dest = dest_dir,
                      transit = None,
                      delete_original = False,
                      wait_interval = self.retry_wait,
                      max_retries = self.retry_num,
                      logger = self.glogger)
 def step(self):
     error = None
     try:
         self.getVariables()
         msg = 'Copying files from {0} to {1} via transit {2}.'
         msg = msg.format(self.source_folder, self.hotfolder_dir, self.transit_dir)
         self.debug_message(msg)
         # ==================================================================
         # Wait for preprocessed images to be ready
         # Returns false if it times out 
         # ==================================================================
         if not self.waitForPreprocessedImages():
             pp_files = fs.getFilesInFolderWithExts(self.source_folder, self.valid_exts)
             raise Exception('Timed out or count error while waiting for pre-processing of '
                             'images. Current number of processed images: '
                             '{0}. Expected amount: {1}'.format(pp_files, self.expected_image_count))
         # ==================================================================
         # Copy files to OCR-server
         # ==================================================================
         self.debug_message("Start copy of preprocessed images to OCR-server")
         tools.copy_files(source          = self.source_folder,
                          dest            = self.hotfolder_dir,
                          transit         = self.transit_dir,
                          delete_original = False,
                          wait_interval   = self.retry_wait,
                          max_retries     = self.retry_num,
                          logger          = self.glogger,
                          valid_exts      = self.valid_exts)
         self.debug_message("Finished copy of preprocessed images to OCR-server")
     except errors.TransferError as e:
         error = e.strerror
     except errors.TransferTimedOut as e:
         error = e.strerror
     except Exception as e:
         error = str(e)
     return error