def get_download_link(self): meta = pcs.get_metas(self.cookie, self.tokens, self.row[PATH_COL]) if not meta or meta['errno'] != 0 or 'info' not in meta: print('Error: failed to get meta info:', meta) self.emit('network-error', self.row[FSID_COL]) else: dlink = meta['info'][0]['dlink'] red_url, req_id = pcs.get_download_link(self.cookie, dlink) if not req_id: print('Error: failed to get req_id:', req_id) self.emit('network-error', self.row[FSID_COL]) else: self.red_url = red_url self.download()
def get_download_link(self): meta = pcs.get_metas(self.cookie, self.tokens, self.row[PATH_COL]) if not meta or meta['errno'] != 0 or 'info' not in meta: self.network_error() return pcs_files = meta['info'] if not pcs_files: print('pcs_files in meta is empty, abort') self.network_error() return pcs_file = pcs_files[0] if str(pcs_file['fs_id']) != self.row[FSID_COL]: print('FSID not match, abort.') self.network_error() return dlink = pcs_file['dlink'] red_url, req_id = pcs.get_download_link(self.cookie, dlink) if not req_id: self.network_error() else: self.red_url = red_url self.download()
def check_exists(self): meta = pcs.get_metas(self.cookie, self.tokens, self.row[PATH_COL]) return meta and meta.get('errno', 12) == 0
def check_dir_exists(self, remotepath): meta = pcs.get_metas(self.cookie, self.tokens, remotepath) return meta.get('errno', 12) == 0
def check_exists(self): meta = pcs.get_metas(self.row[PATH_COL]) print(meta)