added 'jobs count' to lish; get_job_count to interface and jsonrpc

This commit is contained in:
Johannes Findeisen 2013-10-21 15:48:39 +02:00
commit b1f8d86fdb
4 changed files with 12 additions and 0 deletions

View file

@ -30,3 +30,5 @@ print c.call.get_job_list()
print c.call.get_job_info_by_id("3950d44b") print c.call.get_job_info_by_id("3950d44b")
print c.call.set_job_enabled("3950d44b", False) print c.call.set_job_enabled("3950d44b", False)
print c.call.get_job_count()

View file

@ -60,6 +60,10 @@ class ServerHandler(BaseHandler):
job_list = ServerHandler.interface.get_job_list() job_list = ServerHandler.interface.get_job_list()
return json.dumps(job_list, ensure_ascii=False) return json.dumps(job_list, ensure_ascii=False)
def get_job_count(self):
job_count = ServerHandler.interface.get_job_count()
return json.dumps(job_count, ensure_ascii=False)
def get_job_info_by_id(self, job_hex): def get_job_info_by_id(self, job_hex):
job = ServerHandler.interface.find_job_by_hex_string(job_hex) job = ServerHandler.interface.find_job_by_hex_string(job_hex)
job_dict = ServerHandler.interface.get_job_info_dict(job) job_dict = ServerHandler.interface.get_job_info_dict(job)

View file

@ -67,6 +67,10 @@ class LinspectorInterface(object):
job_list.append(d) job_list.append(d)
return job_list return job_list
def get_job_count(self):
count = len(self.jobs)
return count
def get_enabled_layouts(self): def get_enabled_layouts(self):
self._config.get_enabled_layouts() self._config.get_enabled_layouts()

View file

@ -176,6 +176,8 @@ class LishCommander(Exit):
PURPLE + " Service" + END + ": " + job_dict["Service"] + \ PURPLE + " Service" + END + ": " + job_dict["Service"] + \
PURPLE + " Next run" + END + ": " + job_dict["Next run"] + \ PURPLE + " Next run" + END + ": " + job_dict["Next run"] + \
PURPLE + " Enabled" + END + ": " + job_dict["Enabled"] PURPLE + " Enabled" + END + ": " + job_dict["Enabled"]
elif text == "count":
print GREEN + "Job Count" + END + ":\t" + str(self.interface.get_job_count())
else: else:
self.print_color(RED, "Invalid or missing parameter") self.print_color(RED, "Invalid or missing parameter")
self.help_jobs() self.help_jobs()