i3pystatus: make travelynx url configurable to user

This commit is contained in:
Franzi 2022-07-02 18:30:50 +02:00
parent cd6ada85d9
commit e486f477bb
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -8,6 +8,10 @@ from sys import argv, exit
LINK_MODE = False
if len(argv) > 1 and argv[1] == '--link':
LINK_MODE = True
if len(argv) > 2:
LINK_TARGET = argv[2]
else:
LINK_TARGET = 'travelynx.franzi.business'
# bundlewrap.utils.text.format_duration, but trimmed down
@ -49,7 +53,8 @@ try:
ice_status = ice_status_req.json()
if LINK_MODE:
check_output(['xdg-open', 'https://travelynx.franzi.business/s/{}?train={}%20{}'.format(
check_output(['xdg-open', 'https://{}/s/{}?train={}%20{}'.format(
LINK_TARGET,
trip_info['stopInfo']['actualLast'],
trip_info['trainType'],
trip_info['vzn'],