-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated readme and settings, added storage script
- Loading branch information
1 parent
6bcd020
commit 61a0a9e
Showing
3 changed files
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
import datetime | ||
|
||
def clear_files(): | ||
current_time = datetime.datetime.now() | ||
hour_ago = (current_time - datetime.timedelta(hours=1)).timestamp() | ||
MEDIA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'media', '_temp') | ||
with os.scandir(MEDIA_DIR) as files: | ||
for file in files: | ||
if file.name == '.gitkeep': | ||
continue | ||
elif os.path.getmtime(os.path.realpath(file)) < hour_ago: | ||
os.remove(os.path.realpath(file)) | ||
|
||
|
||
if __name__ == '__main__': | ||
clear_files() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters