def test_manualcrop1(self): bp = Base() img = files_paths[0] fs.unlink(root_path + img[1]) bp._image_params['offsets_crop'] = (10, 32, 12, 5) bp.image_manual_crop(root_path + img[0], root_path + img[1]) self.assertTrue(fs.is_file(root_path + img[1]))
def get_driver(self): from selenium import webdriver # need, if captcha detected driver_path = self._driver_path() if not is_file(driver_path): self.download_drivder() self.is_win() or chmod(driver_path, 0o755) driver = webdriver.Chrome(executable_path=driver_path) driver.set_window_size(500, 600) return driver
def prepare_cookies(self): _storage = storage('.passwords.json') if not is_file(_storage): copy(path_join(root_path(), 'manga_py', '.passwords.json.dist'), _storage) file = open(_storage, 'r').read() data = self.json.loads(file).get('hentai_chan_me', {}) cookies = self._login(**data) for i in cookies: self._storage['cookies'][i] = cookies[i]
def save_file(self, idx=None, callback=None, url=None, in_arc_name=None): # ref = self._storage['referer'] self._storage['referer'] = self.chapter[0] _path, idx, _url = self._save_file_params_helper(url, idx) if not is_file(_path): self.http(True).download_file(_url, _path) self._archive.add_file(_path, in_arc_name) callable(callback) and callback() self.after_file_save(_path, idx) # self._storage['referer'] = ref return _path
def __add_files(self): for file in self.files: if is_file(file[0]): self._archive.write(file[0], file[1])
def test_autocrop(self): bp = Base() img = files_paths[0] fs.unlink(root_path + img[1]) bp.image_auto_crop(root_path + img[0], root_path + img[1]) self.assertTrue(fs.is_file(root_path + img[1]))