now the client check updates on the folder

master
kirbylife 2019-12-02 02:48:52 -06:00
parent eee6b1a765
commit 8333eb92c7
2 changed files with 17 additions and 5 deletions

View File

@ -49,11 +49,10 @@ class MunyalClient(pystray.Icon):
name="downloader", name="downloader",
daemon=True) daemon=True)
thread_uploader.start() thread_uploader.start()
thread_downloader.start() # thread_downloader.start()
self.run(self.__run) self.run(self.__run)
def __run(self, icon): def __run(self, icon):
print("_run")
icon.visible = True icon.visible = True
sleep(60) sleep(60)
self.stop() self.stop()
@ -63,8 +62,21 @@ class MunyalClient(pystray.Icon):
def uploader(self): def uploader(self):
print("Uploader") print("Uploader")
folder = self.config["folder"]
last = get_json(folder)
while True: while True:
sleep(5) sleep(1)
actual = get_json(folder)
_actual = deepcopy(actual)
delete, add = compare_json(last, actual)
if delete:
print("Cosas eliminadas:")
print(delete)
if add:
print("Cosas agregadas:")
print(add)
last = _actual
def __upload(self, path): def __upload(self, path):
pass pass

View File

@ -31,8 +31,8 @@ def compare_json(json1, json2):
if __name__ == "__main__": if __name__ == "__main__":
try: try:
json1 = get_json("/home/kirbylife/Munyal/test_1") json1 = get_json("/home/kirbylife/Munyal")
json2 = get_json("/home/kirbylife/Munyal/test_2") json2 = get_json("/home/kirbylife/Munyal")
except Exception: except Exception:
print("error outside") print("error outside")
json1, json2 = compare_json(json1, json2) json1, json2 = compare_json(json1, json2)