mirror of
https://github.com/FAUSheppy/config
synced 2025-12-09 08:08:32 +01:00
Fixed VPN status
This commit is contained in:
@@ -76,7 +76,8 @@ def vpn():
|
|||||||
if not hl_utils.is_cip():
|
if not hl_utils.is_cip():
|
||||||
tmp = -1
|
tmp = -1
|
||||||
with open(hl_utils.hlpath("vpn_status.log")) as f:
|
with open(hl_utils.hlpath("vpn_status.log")) as f:
|
||||||
tmp = float(f.read());
|
tmp = f.read()
|
||||||
|
tmp = ' '+tmp
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
||||||
def battery():
|
def battery():
|
||||||
@@ -95,7 +96,7 @@ def battery():
|
|||||||
|
|
||||||
if bat.startswith("Charging"):
|
if bat.startswith("Charging"):
|
||||||
return color_panel("Charging",GREEN,seper=False) + color_panel(bat.lstrip("Charging ,").strip('\n'),get_color(plain,0,100))
|
return color_panel("Charging",GREEN,seper=False) + color_panel(bat.lstrip("Charging ,").strip('\n'),get_color(plain,0,100))
|
||||||
elif bat.startswith("Full"):
|
elif bat.startswith("Full") or bat.startswith('Unknown'):
|
||||||
return color_panel("On Supply and fully charged",GREEN)
|
return color_panel("On Supply and fully charged",GREEN)
|
||||||
elif plain <= 1:
|
elif plain <= 1:
|
||||||
return color_panel(">>>>>>>>>>>>>>>> --------------- WARNING BATTER FAILURE IMMINENT --------------- <<<<<<<<<<<<<",RED)
|
return color_panel(">>>>>>>>>>>>>>>> --------------- WARNING BATTER FAILURE IMMINENT --------------- <<<<<<<<<<<<<",RED)
|
||||||
@@ -132,5 +133,5 @@ def irc():
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
if __name__ == "__main__":
|
||||||
print(vpn(),guthaben(),battery(),sep='')
|
print(vpn(),guthaben(),battery(),sep='')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
from hl_panel_content.py import color_panel
|
from hl_panel_content import color_panel
|
||||||
from hl_utils import error, is_cip, shexec, color_remove, hlpath
|
from hl_utils import error, is_cip, shexec, color_remove, hlpath
|
||||||
|
|
||||||
RED = 0xff0000
|
RED = 0xff0000
|
||||||
@@ -27,12 +27,14 @@ while(True):
|
|||||||
ret += 1;
|
ret += 1;
|
||||||
print(ret)
|
print(ret)
|
||||||
if ret <= 1:
|
if ret <= 1:
|
||||||
out_vpn = color_panel("VPN DEACTIVATED",GREEN)
|
out_vpn = color_panel("VPN DEACTIVATED",RED)
|
||||||
if ret == 2:
|
elif ret <= 3:
|
||||||
out_vpn = color_panel("VPN CONNECTED",RED)
|
out_vpn = color_panel("VPN CONNECTED",GREEN)
|
||||||
if ret >= 3:
|
elif ret >= 4:
|
||||||
out_vpn = color_panel("multiple VPNs connected",YELLOW)
|
out_vpn = color_panel("multiple VPNs connected",YELLOW)
|
||||||
print(out_vpn)
|
else:
|
||||||
|
out_vpn = color_panel("WTF VPN STATUS BROKEN",RED)
|
||||||
|
#print(out_vpn)
|
||||||
with open(vpn_path,'w+') as g:
|
with open(vpn_path,'w+') as g:
|
||||||
g.write(out_vpn)
|
g.write(out_vpn)
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
|
|||||||
Reference in New Issue
Block a user