Change output options
This commit is contained in:
parent
0693129a4d
commit
4280b412b5
1 changed files with 10 additions and 7 deletions
|
@ -5,15 +5,18 @@ from protonvpn_cli import utils as pvpn_utils
|
|||
|
||||
|
||||
IP_ADDR = pvpn_utils.get_ip_info()[0]
|
||||
CONNECTED_SERVER = pvpn_utils.get_config_value("metadata", "connected_server")
|
||||
SERVERS = pvpn_utils.get_servers()
|
||||
COUNTRY_CODE = pvpn_utils.get_server_value(CONNECTED_SERVER, "ExitCountry", SERVERS)
|
||||
COUNTRY = pvpn_utils.get_country_name(COUNTRY_CODE)
|
||||
CITY = pvpn_utils.get_server_value(CONNECTED_SERVER, "City", SERVERS)
|
||||
|
||||
if not pvpn_utils.is_connected():
|
||||
OUTPUT = os.environ['LABEL'] + " OFF"
|
||||
OUTPUT = "<span foreground='#ef1225'>{}</span>".format(os.environ['LABEL'])
|
||||
OUTPUT += " {}".format(IP_ADDR)
|
||||
|
||||
else:
|
||||
OUTPUT = "{} {} - {}, {}".format(os.environ['LABEL'], IP_ADDR, CITY, COUNTRY)
|
||||
CONNECTED_SERVER = pvpn_utils.get_config_value("metadata", "connected_server")
|
||||
SERVERS = pvpn_utils.get_servers()
|
||||
COUNTRY_CODE = pvpn_utils.get_server_value(CONNECTED_SERVER, "ExitCountry", SERVERS)
|
||||
COUNTRY = pvpn_utils.get_country_name(COUNTRY_CODE)
|
||||
CITY = pvpn_utils.get_server_value(CONNECTED_SERVER, "City", SERVERS)
|
||||
OUTPUT = "<span foreground='#12ef25'>{}</span>".format(os.environ['LABEL'])
|
||||
OUTPUT += " {} - {}, {}".format(IP_ADDR, CITY, COUNTRY)
|
||||
|
||||
print(OUTPUT)
|
||||
|
|
Loading…
Add table
Reference in a new issue