added irc hightlight support

This commit is contained in:
Sheppy
2017-02-25 23:02:33 +01:00
parent 53fcdb94ab
commit 170c116699

View File

@@ -1,6 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
import hl_utils import hl_utils
import string
sep = " | " sep = " | "
@@ -74,13 +75,20 @@ def battery():
return "" return ""
def irc(): def irc():
if hl_utils.is_cip():
ret_string = "IRC ERROR"
try: try:
fname = hl_utils.hlpath("irc.log") fname = hl_utils.hlpath("irc.log")
tmp = "error" tmp = []
with open(fname) as f: with open(fname) as f:
pass for l in f:
#handle pipe tmp+=[l]
return color_panel(PM,RED) if len(tmp) == 0:
return ""
msg = " ".join(tmp[-1].split(" ")[2:])[:50]
user = tmp[-1].split(" ")[1][:15]
ret_string = "MSG FROM: "+user+"-> "+msg.rstrip('\n')+" - [ "+str(len(tmp))+" total ]"
return color_panel(ret_string,RED)
except(IOError): except(IOError):
return "" return ""
print(guthaben(),battery()) print(irc(),guthaben(),battery())