]> khamidou — GitHub mirrors - cagibi.git/commitdiff
client changes
authorkarim hamidou <khamidou@gmail.com>
Thu, 12 Jul 2012 12:07:06 +0000 (14:07 +0200)
committerkarim hamidou <khamidou@gmail.com>
Thu, 12 Jul 2012 12:07:06 +0000 (14:07 +0200)
cagibi/cagibi.py

index c8826478b5ed1a7314a54984baabc098bc4c9765..33d5ab91fcc1b72519cc0c276fdf26aee27262ad 100644 (file)
@@ -3,8 +3,11 @@
 from watch import FileWatcher
 from rsync import *
 from config import load_config
+import urllib2
+import json
 
 client_config = {}
+server_url = "http://localhost:8080/"
 
 def changesHandler(modified, added, removed):
     for file in modified:
@@ -12,8 +15,20 @@ def changesHandler(modified, added, removed):
         hashes = blockchecksums(fd)
         print hashes
 
+def checkout_changes():
+    """Checkout changes on the server"""
+    fd = urllib2.urlopen(server_url + "/folder")
+    data = json.load(fd)
+    print data
+
 if __name__ == "__main__":
     client_config = load_config("cagibi.json")
+    if "server" in client_config:
+        server_url = client_config["server"]
+        if server_url[-1] == '/':
+            server_url = server_url[0:-1]
+
     fw = FileWatcher()
     fw.addHandler(changesHandler)
+    checkout_changes()
     fw.watch()