diff --git a/plugins/cricket-score.py b/plugins/cricket-score.py index faa5c51c..1e98ec97 100644 --- a/plugins/cricket-score.py +++ b/plugins/cricket-score.py @@ -8,7 +8,7 @@ score_url = "http://api.scorescard.com/?type=score&teamone=Australia&teamtwo=Eng # hooks def prof_init(version, status): - prof.register_timed(get_scores, 10) + prof.register_timed(get_scores, 5) def get_scores(): req = urllib2.Request(score_url, None, {'Content-Type': 'application/json'}) @@ -17,26 +17,35 @@ def get_scores(): f.close() result_json = json.loads(response); summary = None + change = False if 't1FI' in result_json.keys(): + change = True summary = result_json['t1FI'] prof.cons_show(result_json['t1FI']) if 't2FI' in result_json.keys(): + change = True summary += "\n" + result_json['t2FI'] prof.cons_show(result_json['t2FI']) if 't1SI' in result_json.keys(): + change = True summary += "\n" + result_json['t1SI'] prof.cons_show(result_json['t1SI']) if 't2SI' in result_json.keys(): + change = True summary += "\n" + result_json['t2SI'] prof.cons_show(result_json['t2SI']) if 'ms' in result_json.keys(): + change = True summary += "\n\n" + result_json['ms'] prof.cons_show("") prof.cons_show(result_json['ms']) + if change: + prof.cons_alert() + prof.notify(summary, 5000, "Cricket score") diff --git a/plugins/platform-info.py b/plugins/platform-info.py index 68e29fc3..94550f19 100644 --- a/plugins/platform-info.py +++ b/plugins/platform-info.py @@ -6,16 +6,8 @@ import platform def prof_init(version, status): prof.register_command("/platform", 0, 0, "/platform", "Output system information.", "Output system information", cmd_platform) -# local functions +# commands def cmd_platform(): result_summary = platform.platform() -# result_machine = plaform.machine() -# result_node = platform,node() -# result_processor = platform.processor() -# result_release = platform.release() -# result_system = platform.system() -# result_version = platform.version() - -# prof.cons_show(result_machine + " " + result_node + " " + result_processor + " " + result_release + " " + result_release + " " + result_system + " " + result_version) prof.cons_show(result_summary) diff --git a/src/plugins/api.c b/src/plugins/api.c index f665a85f..8f2e671b 100644 --- a/src/plugins/api.c +++ b/src/plugins/api.c @@ -28,6 +28,13 @@ #include "ui/notifier.h" #include "ui/ui.h" +static PyObject* +api_cons_alert(PyObject *self, PyObject *args) +{ + cons_alert(); + return Py_BuildValue(""); +} + static PyObject* api_cons_show(PyObject *self, PyObject *args) { @@ -37,6 +44,7 @@ api_cons_show(PyObject *self, PyObject *args) return NULL; } cons_show("%s", message); + ui_current_page_off(); return Py_BuildValue(""); } @@ -111,6 +119,7 @@ api_notify(PyObject *self, PyObject *args) } static PyMethodDef apiMethods[] = { + { "cons_alert", api_cons_alert, METH_NOARGS, "Highlight the console window in the status bar." }, { "cons_show", api_cons_show, METH_VARARGS, "Print a line to the console." }, { "register_command", api_register_command, METH_VARARGS, "Register a command." }, { "register_timed", api_register_timed, METH_VARARGS, "Register a timed function." },