2019-08-18 01:09:33 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from copy import deepcopy
|
|
|
|
from time import sleep
|
|
|
|
|
2020-12-08 20:45:42 +00:00
|
|
|
from compare_json import compare_json
|
|
|
|
from dir_to_json import get_json
|
|
|
|
|
2019-08-18 01:09:33 +00:00
|
|
|
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))
|