From d550f12b0638071fd27b81913ba03fed0f5242bd Mon Sep 17 00:00:00 2001 From: Rob Vella Date: Fri, 31 Jul 2020 18:17:47 -0700 Subject: [PATCH] Get node info from allmon --- app.js | 13 +++++++------ index.html | 4 +--- streamServer.php | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 9045501..7c49b74 100644 --- a/app.js +++ b/app.js @@ -84,9 +84,9 @@ let App = new Vue({ }); }, - getNodeInfo(node, type) { - if (typeof this.nodes[type+node] !== "undefined") { - let info = this.nodes[type+node]; + getNodeInfo(node) { + if (typeof this.nodes[node.type+node.node] !== "undefined") { + let info = this.nodes[node.type+node.node]; if (typeof info.callsign === "undefined") return; return `${info.callsign} ${info.desc || ''} ${info.location || ''}`; } else { @@ -99,9 +99,9 @@ let App = new Vue({ rows.forEach((v) => { // let match = v.match(/([A-Za-z]+ [0-9]+ [0-9]+\:[0-9]+\:[0-9]+) (rpt|stn)([A-Za-z0-9]+) ?.*? (?:\[(?:via) ([0-9]+))?/); - let match = v.match(/([A-Za-z]+ [0-9]+ [0-9]+\:[0-9]+\:[0-9]+) (rpt|stn)([A-Za-z0-9]+) (KEY|UNKEY) (?:\[(?:via) ([0-9]+))?/); + let match = v.match(/([A-Za-z]+ [0-9]+ [0-9]+\:[0-9]+\:[0-9]+) (rpt|stn)([A-Za-z0-9]+) (KEY|UNKEY) (?:\[(?:via) ([0-9]+)\])?(?: \[(.*)\])?/); if (!match) return; - + console.log(match); let type = this.getNodeType(match[2]); this.addEntry( @@ -111,7 +111,8 @@ let App = new Vue({ via: match[5], type: type, typeLabel: this.getNodeTypeLabel(type), - info: this.fetchNodeInfo(match[3], type), + // info: this.fetchNodeInfo(match[3], type), + info: typeof match[6] !== "undefined" ? match[6].trim() : undefined, dateTime: moment(match[1], "MMM DD hh:mm:ss"), } ); diff --git a/index.html b/index.html index 0e7ca7e..c52fe2a 100644 --- a/index.html +++ b/index.html @@ -39,9 +39,7 @@ {{ row.key }} {{ row.typeLabel }} {{ row.dateTime.format('hh:mm:ss MM/DD/YY') }} - - {{ getNodeInfo(row.node, row.type) }} - + {{ row.info }} diff --git a/streamServer.php b/streamServer.php index ad724a3..7b0a666 100644 --- a/streamServer.php +++ b/streamServer.php @@ -144,13 +144,13 @@ class Stream } // Permanently set to Allstar for now - // $nodePrefix = isIrlp($node) ? 'stn' : 'rpt'; $nodePrefix = 'rpt'; $keyedLabel = $keyedNow ? "KEY" : "UNKEY"; + $time = Carbon::now(); $timeFormatted = $time->format("M d h:i:s"); - // echo "{$node},{$keyedLabel},{$time}\n"; - $toWrite = "{$timeFormatted} $nodePrefix{$node} {$keyedLabel} [via {$via}]\n"; + + $toWrite = "{$timeFormatted} $nodePrefix{$node} {$keyedLabel} [via {$via}] [{$remoteNode->info}]\n"; file_put_contents($this->streamOutput, $toWrite, FILE_APPEND); echo $toWrite; }