Пример #1
0
 def get_unverified_list_from_mega(settings):
     dst_path = MegaAccountHandler.to_absoulte_dst_path(settings) + "/"
     dst_path_pattern = dst_path + "archive_"  # FIXME dependent on cur impl
     cmd = MegaAccountHandler.build_command_argumetns(command_str="megals", settings=settings)
     popen = MegaAccountHandler.execute_command(cmd)
     with popen as proc:
         return [file_name[len(dst_path):].strip()
                 for file_name in proc.stdout
                 if file_name.startswith(dst_path_pattern)]
Пример #2
0
 def do_init(self, settings, rate_limiter=None):
     super(MegaSender, self).do_init()
     dst_dir_path = MegaAccountHandler.to_absoulte_dst_path(settings)
     self._base_comand = MegaAccountHandler.build_command_argumetns(
         command_str="megaput", settings=settings, extra_args=["--no-progress", "--path", dst_dir_path]
     )
     self._destination_name = settings.destinations[0]
     self._prepare_service(settings)
     self._limited_cmd = (lambda args: args) if rate_limiter is None else (lambda args: rate_limiter.wrap_call(args))
Пример #3
0
 def do_send(self, block):
     to_upload = block.latest_file_info.path
     self.log.info("Starting upload of '%s'", to_upload)
     command = self._limited_cmd(self._base_comand + [to_upload])
     self.log.debug("Executing: %s", command)
     try:
         MegaAccountHandler.check_call(command)
     except CalledProcessError as e:
         self.log.error("Upload of '%s' failed: %s", to_upload, e)
         raise SendingError(e)
Пример #4
0
 def _prepare_service(settings):
     if settings.verify_access:
         MegaAccountHandler.verify_access(settings)
     MegaAccountHandler.create_dest_directories(settings)