feat: trash files by default

This commit is contained in:
2026-07-15 15:01:37 +03:00
parent c449a2dffd
commit a5c317f083
4 changed files with 30 additions and 2 deletions
+9
View File
@@ -4,6 +4,7 @@ import os
import pathlib
import requests
import send2trash
WEBHOOK_URL = os.environ.get("RANDOM_FILE_PICKER_WEBHOOK_URL", None)
MOVE_FOLDER = os.environ.get("RANDOM_FILE_PICKER_MOVE_FOLDER", None)
@@ -111,3 +112,11 @@ def move_file_to_move_folder(file_path: pathlib.Path) -> None:
destination_path = move_dir_path / f"{name}_{counter}{ext}"
counter += 1
_ = file_path.rename(destination_path)
def trash_file(file_path: pathlib.Path) -> None:
"""
Put the specified file into the system trash using the send2trash library.
:param file_path: The path of the file to be trashed.
"""
send2trash.send2trash(file_path)