Author: dmeyer
Date: Fri Feb 17 21:41:44 2006
New Revision: 1189

Added:
   trunk/WIP/vfs/test/cache.py

Log:
add basic cache client to populate the db

Added: trunk/WIP/vfs/test/cache.py
==============================================================================
--- (empty file)
+++ trunk/WIP/vfs/test/cache.py Fri Feb 17 21:41:44 2006
@@ -0,0 +1,48 @@
+import sys
+import kaa
+import kaa.vfs.client
+
+c = kaa.vfs.client.Client('vfsdb')
+
+checked  = []
+to_check = []
+
+def progress(cur, total, item):
+    n = 0
+    if total > 0:
+        n = int((cur / float(total)) * 50)
+    sys.stdout.write("|%51s| %d / %d\r" % (("="*n + ">").ljust(51), cur, 
total))
+    sys.stdout.flush()
+    if cur == total:
+        print
+
+def check():
+    if to_check:
+        d = to_check.pop(0)
+        checked.append(d)
+        print d.filename
+        q = d.listdir()
+        q.signals['up-to-date'].connect(next, q)
+        q.signals['progress'].connect(progress)
+        q.monitor()
+    else:
+        sys.exit(0)
+    
+def next(q):
+    q.monitor(False)
+    for f in q:
+        if f._vfs_isdir:
+            for i in checked + to_check:
+                if f.filename == i.filename:
+                    break
+            else:
+                to_check.insert(0, f)
+    check()
+    
+
+d = c.get(sys.argv[1])
+to_check.append(d)
+
+check()
+
+kaa.main()


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to