Pretty print date in query output.
[beagle.git] / wrappers / python / beagleinfo.py
blob61c2754477ca6db37cadfebb46a7e8a636768e11
1 #!/usr/bin/env python
3 import beagle
4 import gobject
5 import sys
7 def process_inputs (choice, val):
8 if choice [val] == "y":
9 choice [val] = True
10 else:
11 choice [val] = False
13 request = beagle.DaemonInformationRequest()
15 get_version = raw_input ("Get version (y/n)? ")
16 get_scheduler_status = raw_input ("Get scheduler status (y/n)? ")
17 get_index_info = raw_input ("Get index information (y/n)? ")
18 get_is_indexing = raw_input ("Find out if currently indexing (y/n)? ")
20 choice = {
21 'get_version': get_version,
22 'get_scheduler_status': get_scheduler_status,
23 'get_index_info': get_index_info,
24 'get_is_indexing': get_is_indexing}
26 process_inputs (choice, 'get_version')
27 process_inputs (choice, 'get_scheduler_status')
28 process_inputs (choice, 'get_index_info')
29 process_inputs (choice, 'get_is_indexing')
31 client = beagle.Client ()
33 request = beagle.DaemonInformationRequest (choice ['get_version'],
34 choice ['get_scheduler_status'],
35 choice ['get_index_info'],
36 choice ['get_is_indexing'])
37 response = client.send_request (request)
38 del request
39 request = None
41 if choice ['get_version']:
42 print "Version = %s" % response.get_version ()
43 if choice ['get_scheduler_status']:
44 print "Scheduler status:\n %s" % response.get_human_readable_status ()
45 if choice ['get_index_info']:
46 print "Index information:\n %s" % response.get_index_information ()
47 if choice ['get_is_indexing']:
48 print "Is indexing ? %s" % response.is_indexing ()