diff --git a/src/gutenberg2zim/download.py b/src/gutenberg2zim/download.py index b579a51..6a80f8c 100644 --- a/src/gutenberg2zim/download.py +++ b/src/gutenberg2zim/download.py @@ -71,10 +71,10 @@ def is_safe(fname): # move all extracted files to proper locations for zipped_file in zipped_files: # skip folders - if not Path(zipped_file).resolve().is_file(): + if not Path(zipped_file).is_file(): continue - src = (Path(tmpd) / zipped_file).resolve() + src = Path(tmpd) / zipped_file if src.exists(): fname = Path(zipped_file).name diff --git a/src/gutenberg2zim/entrypoint.py b/src/gutenberg2zim/entrypoint.py index 3aeb0b9..5a75ee0 100755 --- a/src/gutenberg2zim/entrypoint.py +++ b/src/gutenberg2zim/entrypoint.py @@ -222,12 +222,10 @@ def f(x): for zim_lang in zims: if do_zim: logger.info("BUILDING ZIM dynamically") - if one_lang_one_zim_folder: - output_folder = Path(one_lang_one_zim_folder).resolve() - else: - output_folder = Path(".").resolve() build_zimfile( - output_folder=output_folder, + output_folder=Path(one_lang_one_zim_folder).resolve() + if one_lang_one_zim_folder + else Path(".").resolve(), download_cache=dl_cache, concurrency=concurrency, languages=zim_lang, diff --git a/src/gutenberg2zim/export.py b/src/gutenberg2zim/export.py index dd45593..363d929 100644 --- a/src/gutenberg2zim/export.py +++ b/src/gutenberg2zim/export.py @@ -94,7 +94,7 @@ def save_bs_output(soup, fpath, encoding=UTF8): def tmpl_path() -> Path: - return (Path(gutenberg2zim.__file__).parent / "templates").resolve() + return Path(gutenberg2zim.__file__).parent / "templates" def get_list_of_all_languages(): diff --git a/src/gutenberg2zim/rdf.py b/src/gutenberg2zim/rdf.py index edfbec2..de37347 100644 --- a/src/gutenberg2zim/rdf.py +++ b/src/gutenberg2zim/rdf.py @@ -305,7 +305,7 @@ def get_formatted_number(num: str | None) -> str | None: nums = [f"{i:0=5d}" for i in range(21000, 40000)] for num in nums: print(num) # noqa: T201 - curd = Path(__file__).resolve().parent + curd = Path(__file__).parent rdf = curd.parent / "rdf-files" / num / f"pg{num}.rdf" if rdf.is_file(): data = "" diff --git a/src/gutenberg2zim/urls.py b/src/gutenberg2zim/urls.py index 69ce956..f0d2a92 100644 --- a/src/gutenberg2zim/urls.py +++ b/src/gutenberg2zim/urls.py @@ -290,5 +290,5 @@ def setup_urls(force, books): if __name__ == "__main__": - book = Book.get(id=84) + book = Book.get(id=9) print(get_urls(book)) # noqa: T201