Browse Source

add northern line, fix mgets

master
eta 2 months ago
parent
commit
e234aaff31
  1. 30
      trackernet.lisp

30
trackernet.lisp

@ -11,7 +11,7 @@
(local-time:find-timezone-by-location-name "Europe/London")))
(defparameter *trackernet-predictions-dir* "./predictions/")
(defparameter *trackernet-trains-archival-dir* "./trains/")
(defparameter *trackernet-scrape-interval* 4)
(defparameter *trackernet-scrape-interval* 5.5)
(defparameter *prediction-expiry-secs* 60)
(defparameter *train-active-expiry-secs* 30)
(defparameter *rescue-grace-period-secs* 15)
@ -41,6 +41,13 @@
("J" "STA") ; Stanmore
("J" "SFD") ; Stratford
("J" "WLO") ; Waterloo
("N" "MOR") ; Morden
("N" "EUS") ; Euston
("N" "HBT") ; High Barnet
("N" "KEN") ; Kennington
("N" "MHE") ; Mill Hill East
("N" "EDG") ; Edgware
("N" "CTN") ; Camden Town
("W" "WLO"))) ; Waterloo & City
(defparameter *manuals*
'(("TPAE.AF" "TPAG")
@ -550,10 +557,11 @@
(defun redis-paired-mget (key-names)
"Given a list of KEY-NAMES, returns an alist of each name paired with its value, or NIL if the value did not exist."
(loop
for key in key-names
for value in (apply #'red:mget key-names)
collect (cons key value)))
(when key-names
(loop
for key in key-names
for value in (apply #'red:mget key-names)
collect (cons key value))))
(defun redis-cpk-sorted-set-all (key)
"Gets all elements of the sorted set KEY, alongside their scores, CONSPACK-decoding each element."
@ -1102,6 +1110,7 @@ Stop if *TRACKERNET-KILL-SWITCH* is set to T."
(kick-off-scrapers*)
(start-statsd-reporter-loop "D")
(start-statsd-reporter-loop "V")
(start-statsd-reporter-loop "N")
(start-statsd-reporter-loop "J"))
(defun main ()
@ -1196,7 +1205,8 @@ Stop if *TRACKERNET-KILL-SWITCH* is set to T."
(defun write-mini-graphviz (around-codes line-code &key (out *standard-output*) (neato nil))
"Write out a mini graph containing the nodes around AROUND-CODE in graphviz format."
(let ((*normalized-track-links*
(gethash line-code *per-line-track-graph*)))
(or (gethash line-code *per-line-track-graph*)
*normalized-track-links*)))
(princ "digraph {" out)
(terpri out)
(princ "node [shape=box margin=\"0.1,0.1\"];" out)
@ -1528,7 +1538,7 @@ color=lightblue;
(defun extract-station-information (description)
(when (uiop:string-prefix-p "At " description)
(cl-ppcre:register-groups-bind (station-name platform)
("At (.+) Platform (.+)" description)
("At (.+) Plat?form (.+)" description)
(return-from extract-station-information
(values station-name platform)))
(values (subseq description #.(length "At ")) nil)))
@ -1548,8 +1558,10 @@ color=lightblue;
(declare (ignore observer))
(let* ((identity (list (nilify-zeros (set-no train))
(nilify-zeros (trip-no train))))
(descr (cdr (assoc (track-code train) track-descriptions
:test #'string=)))
(descr (or
(cdr (assoc (track-code train) track-descriptions
:test #'string=))
(location-desc train)))
(destination (or (destination-desc train)
"<somewhere>")))
(unless (equal destination current-destination)

Loading…
Cancel
Save