Author: dmeyer
Date: Wed Mar 29 17:22:55 2006
New Revision: 1360
Modified:
trunk/beacon/README
trunk/beacon/bin/beacon
Log:
add hidden feature for testing
Modified: trunk/beacon/README
==============================================================================
--- trunk/beacon/README (original)
+++ trunk/beacon/README Wed Mar 29 17:22:55 2006
@@ -64,4 +64,22 @@
+Hidden features
+
+The beacon server can also be used as a small test application. In
+normal use, the server won't connect to a database unless a client
+connects. You can force the server to connect on startup setting the
+environment variable BEACON_DATABASE to the location of the database.
+A second environment variable is BEACON_MONITOR, a collon separated
+list of directories (plus subdirectories) to be monitored using
+inotify. Both variables are created to help testing beacon, the may be
+removed later.
+
+Example:
+export BEACON_DATABASE=/home/dmeyer/.beacon
+export BEACON_MONITOR=/home/dmeyer/video:/home/dmeyer/mp3
+beacon --start --verbose crawler,db
+
+
+
More about kaa.beacon later
Modified: trunk/beacon/bin/beacon
==============================================================================
--- trunk/beacon/bin/beacon (original)
+++ trunk/beacon/bin/beacon Wed Mar 29 17:22:55 2006
@@ -19,14 +19,16 @@
def usage(error_code):
print 'beacon [options]'
- print 'Server options:'
- print '--start start beacon'
- print '--stop stop running beacon'
- print '--daemon detach for parent process'
- print '--autoshutdown stop server when no clients are connected'
- print '--logfile file use file for logging'
- print '--loglevel level log level (warning, info, debug)'
- print '--help | -h this message'
+ print 'options:'
+ print '--start start beacon'
+ print '--stop stop running beacon'
+ print '--daemon detach for parent process'
+ print '--autoshutdown stop server when no clients are connected'
+ print '--logfile file use file for logging'
+ print '--verbose modules comma separated list of modules which should be
more'
+ print ' verbose. Possible modules are db, notifier,
crawler'
+ print ' Use \'all\' to increase every module.'
+ print '--help | -h this message'
print
print 'Client options:'
print '--search args search mode'
@@ -43,7 +45,7 @@
try:
# read arguments
- opts = [ 'start', 'stop', 'daemon', 'autoshutdown', 'logfile=',
'loglevel=',
+ opts = [ 'start', 'stop', 'daemon', 'autoshutdown', 'logfile=', 'verbose=',
'help', 'search', 'monitor' ]
opts, args = getopt.getopt(sys.argv[1:], 'h', opts)
except getopt.GetoptError:
@@ -66,12 +68,13 @@
shutdown = True
if o == '--logfile':
logfile = a
- if o == '--loglevel':
- try:
- log.setLevel(getattr(logging, a.upper()))
- except:
- print 'invalid loglevel: %s' % a
- usage(1)
+ if o == '--verbose':
+ a = a.lower()
+ if a == 'all':
+ log.setLevel(logging.INFO)
+ else:
+ for m in a.split(','):
+ logging.getLogger(m).setLevel(logging.INFO)
if o == '--monitor':
monitor = True
if o in ('--help', '-h'):
@@ -110,6 +113,7 @@
print
def changed(result):
+ print 'Beacon query update'
for r in result:
print r
@@ -247,6 +251,14 @@
ipc.register_object(kaa.notifier.shutdown, 'shutdown')
ipc.signals["client_closed"].connect(kaa.beacon.server._client_closed)
+if os.environ.get('BEACON_DATABASE'):
+ log.info('connect to %s', os.environ['BEACON_DATABASE'])
+ server = kaa.beacon.server.connect(os.environ['BEACON_DATABASE'])
+ if os.environ.get('BEACON_MONITOR'):
+ for dirname in os.environ.get('BEACON_MONITOR').split(':'):
+ log.info('monitor %s', dirname)
+ server.monitor_dir(dirname)
+
# start garbage collector
kaa.notifier.Timer(garbage_collect).start(10)
if shutdown:
-------------------------------------------------------
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