feat
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
mol
2023-09-05 18:22:22 +08:00
parent 85d897de11
commit b0720f2d48
2 changed files with 11 additions and 3 deletions

View File

@ -11,3 +11,11 @@ def remove_file(path):
os.remove(path) os.remove(path)
except: except:
pass pass
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')

View File

@ -5,7 +5,7 @@ import os
from handlers.pixiv.comb import extract_pixiv_info, get_prefix_name_on_entry from handlers.pixiv.comb import extract_pixiv_info, get_prefix_name_on_entry
from handlers.pixiv.Webdav import Webdav from handlers.pixiv.Webdav import Webdav
from handlers.pixiv.request import downloadPic from handlers.pixiv.request import downloadPic
from handlers.pixiv.file import save_file, remove_file from handlers.pixiv.file import save_file, remove_file, clear_dir
webdav = Webdav({ webdav = Webdav({
@ -58,7 +58,7 @@ def pixiv_result_handler(entries):
for entry in entries: for entry in entries:
if entry['id'] == item['id']: if entry['id'] == item['id']:
failed_entries.append(entry) failed_entries.append(entry)
clear_dir()
return (success_entries, failed_entries) return (success_entries, failed_entries)