43 lines
934 B
Python
43 lines
934 B
Python
|
#!/usr/bin/env python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from compare_json import compare_json
|
||
|
from dir_to_json import get_json
|
||
|
|
||
|
from copy import deepcopy
|
||
|
from time import sleep
|
||
|
|
||
|
ORIGINAL = "/home/kirbylife/Proyectos/munyal_test/original"
|
||
|
|
||
|
def main(args):
|
||
|
actual = get_json(ORIGINAL)
|
||
|
new = deepcopy(actual)
|
||
|
|
||
|
while True:
|
||
|
delete, add = compare_json(deepcopy(actual), deepcopy(new))
|
||
|
for item in delete:
|
||
|
if item.get("tag"):
|
||
|
if item.get("tag") == "update":
|
||
|
print("Actualizado el archivo {}".format(item.get("name")))
|
||
|
else:
|
||
|
print("borrado el archivo {}".format(item.get("name")))
|
||
|
|
||
|
for item in add:
|
||
|
print("Agregado el archivo {}".format(item.get("name")))
|
||
|
actual = deepcopy(new)
|
||
|
new = get_json(ORIGINAL)
|
||
|
return 0
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
import sys
|
||
|
sys.exit(main(sys.argv))
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|