forked from NBO2001/Automatizador-de-rotina
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_monitoration.py
35 lines (24 loc) · 855 Bytes
/
file_monitoration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from utils import convert_url, reading_json, retun_md
def plan_is_change(conf):
now = os.path.getmtime(convert_url("./scan.xlsx"))
in_base = reading_json(convert_url("./config/monitoration"))
if in_base["scan"] == now:
return False
else:
return True
def folder_is_change():
in_base = reading_json(convert_url('./config/folders'))
list_items = list()
for ibase in in_base:
for box in ibase["boxs"]:
for key, value in box.items():
if not retun_md(convert_url(f'./{ibase["index"]}/{key}')) == value:
list_items.append({
"index": ibase["index"],
"box": key
})
if len(list_items):
return True, list_items
else:
return False, list_items