From 1d7dbeb74943b0778c3133bd49c971e053e44306 Mon Sep 17 00:00:00 2001 From: mol Date: Wed, 6 Sep 2023 10:03:15 +0800 Subject: [PATCH] feat: --- .drone.yml | 2 +- handlers/pixiv/file.py | 18 +++++++++++++----- handlers/pixiv/temp/.placehold | 0 3 files changed, 14 insertions(+), 6 deletions(-) delete mode 100644 handlers/pixiv/temp/.placehold diff --git a/.drone.yml b/.drone.yml index a82f918..6d67cdd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,7 @@ steps: # 定义管道的执行步骤 registry: https://git.liliyamol.cn:8081 repo: git.liliyamol.cn:8081/mol/rss-server # auto_tag: true - tags: ["1.2.0", latest] + tags: ["1.2.1", latest] --- kind: pipeline # 定义一个管道 diff --git a/handlers/pixiv/file.py b/handlers/pixiv/file.py index 388fd64..7a9a02b 100644 --- a/handlers/pixiv/file.py +++ b/handlers/pixiv/file.py @@ -1,4 +1,5 @@ import os +import shutil def save_file(name, data): temp_path = os.path.join(os.path.dirname(__file__), 'temp') @@ -14,8 +15,15 @@ def remove_file(path): def clear_dir(): temp_path = os.path.join(os.path.dirname(__file__), 'temp') - try: - os.rmdir(temp_path) - print('temp dir is cleared') - except: - print('temp clear failed') \ No newline at end of file + flag = True + for files in os.listdir(temp_path): + path = os.path.join(temp_path, files) + + try: + shutil.rmtree(path) + except OSError: + os.remove(path) + + print('Info: temp dir is cleared') + + \ No newline at end of file diff --git a/handlers/pixiv/temp/.placehold b/handlers/pixiv/temp/.placehold deleted file mode 100644 index e69de29..0000000