updated the time checking for demos

This commit is contained in:
Christian 2021-02-12 13:27:57 +01:00
parent 547b6c3bc7
commit 74cc467757

View File

@ -9,7 +9,13 @@ class local_dir_remote:
def list_dir(self):
path = Path(self.path)
return list(path.glob('*'))
file_list = []
delta = timedelta(minutes=5)
for file_demo in list(path.glob('*')):
mtime = datetime.fromtimestamp(os.stat(file_demo).st_mtime)
if mtime < datetime.now() - delta:
file_list.append(file_demo)
return file_list
def delete_local(self, pathfile):
with contextlib.suppress(FileNotFoundError):