mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Cleared newline loading plugins
This commit is contained in:
parent
9bbe8def98
commit
a56b9e1f73
@ -5,47 +5,57 @@ import time
|
|||||||
|
|
||||||
score_url = "http://api.scorescard.com/?type=score&teamone=Australia&teamtwo=England"
|
score_url = "http://api.scorescard.com/?type=score&teamone=Australia&teamtwo=England"
|
||||||
|
|
||||||
|
summary = None
|
||||||
|
|
||||||
# hooks
|
# hooks
|
||||||
|
|
||||||
def prof_init(version, status):
|
def prof_init(version, status):
|
||||||
prof.register_timed(get_scores, 5)
|
prof.register_timed(get_scores, 60)
|
||||||
|
|
||||||
|
def prof_on_start():
|
||||||
|
get_scores()
|
||||||
|
|
||||||
def get_scores():
|
def get_scores():
|
||||||
|
global score_url
|
||||||
|
global summary
|
||||||
|
|
||||||
|
notify = None
|
||||||
|
new_summary = None
|
||||||
|
change = True
|
||||||
|
|
||||||
req = urllib2.Request(score_url, None, {'Content-Type': 'application/json'})
|
req = urllib2.Request(score_url, None, {'Content-Type': 'application/json'})
|
||||||
f = urllib2.urlopen(req)
|
f = urllib2.urlopen(req)
|
||||||
response = f.read()
|
response = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
result_json = json.loads(response);
|
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():
|
if 'ms' in result_json.keys():
|
||||||
change = True
|
new_summary = result_json['ms']
|
||||||
summary += "\n\n" + result_json['ms']
|
if new_summary != summary:
|
||||||
prof.cons_show("")
|
change = True
|
||||||
prof.cons_show(result_json['ms'])
|
|
||||||
|
|
||||||
if change:
|
if change:
|
||||||
prof.cons_alert()
|
prof.cons_show("")
|
||||||
|
prof.cons_show("Cricket score:")
|
||||||
|
if 't1FI' in result_json.keys():
|
||||||
|
notify = result_json['t1FI']
|
||||||
|
prof.cons_show(" " + result_json['t1FI'])
|
||||||
|
|
||||||
prof.notify(summary, 5000, "Cricket score")
|
if 't2FI' in result_json.keys():
|
||||||
|
notify += "\n" + result_json['t2FI']
|
||||||
|
prof.cons_show(" " + result_json['t2FI'])
|
||||||
|
|
||||||
|
if 't1SI' in result_json.keys():
|
||||||
|
notify += "\n" + result_json['t1SI']
|
||||||
|
prof.cons_show(" " + result_json['t1SI'])
|
||||||
|
|
||||||
|
if 't2SI' in result_json.keys():
|
||||||
|
notify += "\n" + result_json['t2SI']
|
||||||
|
prof.cons_show(" " + result_json['t2SI'])
|
||||||
|
|
||||||
|
summary = new_summary
|
||||||
|
notify += "\n\n" + summary
|
||||||
|
prof.cons_show("")
|
||||||
|
prof.cons_show(" " + summary)
|
||||||
|
prof.cons_alert()
|
||||||
|
prof.notify(notify, 5000, "Cricket score")
|
||||||
|
@ -79,8 +79,6 @@ plugins_init(void)
|
|||||||
module_name = g_slist_next(module_name);
|
module_name = g_slist_next(module_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
cons_show("");
|
|
||||||
|
|
||||||
_init();
|
_init();
|
||||||
_check_error();
|
_check_error();
|
||||||
_on_start();
|
_on_start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user