Author: dmeyer
Date: Sat Mar 25 18:48:12 2006
New Revision: 1342
Modified:
trunk/beacon/test/client.py
Log:
make better test app
Modified: trunk/beacon/test/client.py
==============================================================================
--- trunk/beacon/test/client.py (original)
+++ trunk/beacon/test/client.py Sat Mar 25 18:48:12 2006
@@ -5,30 +5,35 @@
import time
def msg(*args):
- print '>>>>>>>>>', args
+ print 'Beacon Server Message:', args
-kaa.beacon.connect(os.path.expanduser("~/.beacon"))
-
-a = u'Inkubus Sukkubus'
-#a = u'Bif Naked'
+if len(sys.argv) == 1:
+ print 'Beacon Test Client'
+ print 'Start the client with your query'
+ print 'Examples:'
+ print ' client.py dirname=/local/video'
+ print ' client.py artist=Silbermond'
+ print ' client.py attr=album type=audio'
+ sys.exit(0)
+
+query = {}
+for a in sys.argv[1:]:
+ key, value = a.split('=', 1)
+ query[key] = value
-t1 = time.time()
-result = kaa.beacon.get(sys.argv[1]).listdir()
-# result = kaa.beacon.query(artist=a)
-# result = kaa.beacon.query(attr='album', type='audio')
-t2 = time.time()
+kaa.beacon.connect(os.path.expanduser("~/.beacon"))
+if 'dirname' in query:
+ result = kaa.beacon.get(query['dirname']).listdir()
+else:
+ result = kaa.beacon.query(**query)
+
result.signals['changed'].connect(msg, 'changed')
result.signals['progress'].connect(msg, 'progress')
result.signals['up-to-date'].connect(msg, 'up-to-date')
result.monitor()
-print 'query took', (t2 - t1)
-
-print result[0].getattr('foo')
-result[0].setattr('foo', 'barw')
-
if 1:
for r in result:
print r
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog