Get node info from allmon

This commit is contained in:
Rob Vella 2020-07-31 18:17:47 -07:00
parent 4c28e53094
commit d550f12b06
3 changed files with 11 additions and 12 deletions

13
app.js
View File

@ -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"),
}
);

View File

@ -39,9 +39,7 @@
<td>{{ row.key }}</td>
<td>{{ row.typeLabel }}</td>
<td class="when">{{ row.dateTime.format('hh:mm:ss MM/DD/YY') }}</td>
<td>
{{ getNodeInfo(row.node, row.type) }}
</td>
<td>{{ row.info }}</td>
</tr>
</tbody>
</table>

View File

@ -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;
}