Skip to content

Commit

Permalink
feat: 新增轉換後檔案增加後輟功能
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosDi committed Sep 3, 2024
1 parent 2f329cd commit c829c5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/modules/zip.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import pathlib
import zipfile as zf

from loguru import logger
Expand Down Expand Up @@ -29,6 +30,9 @@ def compress(epub_absolute_path: str) -> None:
file_list.append(os.path.join(root, name))
new_filename = ZIP.convert_filename(epub_absolute_path)
save_as = os.path.join(dirname, new_filename)
if Config.ADD_SUFFIX:
filename_with_suffix = f"{pathlib.Path(new_filename).stem}_{Config.CONVERTER}.epub"
save_as = pathlib.Path(dirname).joinpath(filename_with_suffix)
with zf.ZipFile(save_as, 'w', zf.zlib.DEFLATED) as z_f:
for file in file_list:
logger.debug(file)
Expand Down

0 comments on commit c829c5d

Please sign in to comment.