Ejemplo n.º 1
0
 def upload(self, args):
     """上传文件(夹)"""
     if not args:
         info('参数:文件路径')
     task_flag = False
     follow = False
     force = False
     mkdir = True
     for arg in args:
         follow, force, mkdir, match = parsing_up_params(arg, follow, force, mkdir)
         if match:
             args.remove(arg)
     for path in args:
         path = path.strip('\"\' ')  # 去除直接拖文件到窗口产生的引号
         if not os.path.exists(path):
             error(f'该路径不存在哦: {path}')
             continue
         uploader = Uploader(self._disk)
         if os.path.isfile(path):
             uploader.set_upload_path(path, is_file=True, force=force)
         else:
             uploader.set_upload_path(path, is_file=False, force=force, mkdir=mkdir)
         uploader.set_target(self._work_id, self._work_name)
         self._task_mgr.add_task(uploader)
         task_flag = True
     if follow and task_flag:
         self.jobs(['-f', ])
     elif task_flag:
         print("开始上传, 输入 jobs 查看上传进度...")
Ejemplo n.º 2
0
 def upload_by_MD5info(self, md5, size, name, url, session_key,
                       session_secret, access_token):
     self._disk.set_session(session_key, session_secret, access_token)
     uploader = Uploader(self._disk)
     uploader.set_md5_info(md5, size, name, url)
     uploader.set_target(self._work_id, self._work_name)
     self._task_mgr.add_task(uploader)
Ejemplo n.º 3
0
 def upload(self, args):
     """上传文件(夹)"""
     if not args:
         info('参数:文件路径')
     for path in args:
         path = path.strip('\"\' ')  # 去除直接拖文件到窗口产生的引号
         if not os.path.exists(path):
             error(f'该路径不存在哦: {path}')
             continue
         uploader = Uploader(self._disk)
         if os.path.isfile(path):
             uploader.set_upload_path(path, is_file=True)
         else:
             uploader.set_upload_path(path, is_file=False)
         uploader.set_target(self._work_id, self._work_name)
         self._task_mgr.add_task(uploader)
Ejemplo n.º 4
0
 def upload_by_url(self, url):
     """远程下载上传"""
     uploader = Uploader(self._disk)
     uploader.set_upload_url(url)
     uploader.set_target(self._work_id, self._work_name)
     self._task_mgr.add_task(uploader)