Version 4.6.2

This commit is contained in:
Chrystian Huot 2020-08-22 14:29:05 -04:00
parent b21351ba44
commit 802ef5db31
10 changed files with 103 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{
"name": "rdio-scanner-client",
"version": "4.6.1",
"version": "4.6.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -33,5 +33,5 @@
"build": "ng build --base-href ./ --prod",
"start": "ng serve"
},
"version": "4.6.1"
"version": "4.6.2"
}

View file

@ -661,7 +661,7 @@ systems: {
+ **id** - Unit ID.
+ **label** - Unit label shown on the right side of six sixth row.
## Load a system from RadioReference.com
## Load a system from RadioReference.com or talkgroups from Trunk Recorder CSV file
You may want to load your `server/config.json` with some systems from [RadioReference.com](https://radioreference.com/).

View file

@ -72,7 +72,21 @@ File /app/data/trs_tg_7537.csv imported successfully into system 11
$ rm ~/.rdio-scanner/trs_tg_7537.csv
```
# 5. Start Rdio Scanner
# 5. Load talkgroups from a Trunk Recorder CSV file (optional)
``` bash
$ mv ~/Downloads/tgs.csv ~/.rdio-scanner
$ docker run -it --rm chuot/rdio-scanner:latest load-tr
USAGE: load-tr <system_id> <input_tg_csv>
$ docker run -it --rm --user $(id -u):$(id -g) --volume ~/.rdio-scanner:/app/data chuot/rdio-scanner:latest load-tr 12 tgs.csv
File /app/data/tgs.csv imported successfully into system 12
$ rm ~/.rdio-scanner/tgs.csv
```
# 6. Start Rdio Scanner
By default, [Rdio Scanner](https://github.com/chuot/rdio-scanner) runs on port 3000. It is recommended to configure a **SSL certificate** and then to map port 3000 to port 443 using the `--publish 3000:443` option.

View file

@ -88,7 +88,17 @@ $ node server load-rrdb 11 ~/Downloads/trs_tg_7537.csv
File /home/radio/Downloads/trs_tg_7537.csv imported successfully into system 11
```
# 5. Start Rdio Scanner
# 5. Load talkgroups from a Trunk Recorder CSV file (optional)
``` bash
$ node server load-tr
USAGE: load-tr <system_id> <input_tg_csv>
$ node server load-tr 12 ~/Downloads/tgs.csv
File /home/radio/Downloads/tgs.csv imported successfully into system 12
```
# 6. Start Rdio Scanner
``` bash
$ node run server

View file

@ -11,5 +11,5 @@
"start": "node run",
"update": "node update"
},
"version": "4.6.1"
"version": "4.6.2"
}

View file

@ -213,6 +213,31 @@ class App {
process.exit();
});
} else if (cmd === 'load-tr') {
this.rdioScanner.once('ready', () => {
if (process.argv.length === 5) {
try {
const sysId = parseInt(process.argv[3], 10);
const input = path.resolve(process.env.APP_DATA || __dirname, process.argv[4]);
const msg = this.rdioScanner.utils.loadTR(sysId, input);
console.log(msg);
} catch (error) {
console.error(error.message);
}
} else {
console.log(`USAGE: ${cmd} <system_id> <input_tg_csv>`);
}
this.config.persist();
process.exit();
});
} else if (cmd === 'random-uuid') {
this.rdioScanner.once('ready', () => {
const count = parseInt(process.argv[3], 10) || 1;

View file

@ -75,6 +75,52 @@ class Utils {
return `File ${input} imported successfully into system ${sysId}`;
}
loadTR(sysId, input) {
if (typeof sysId !== 'number' || sysId < 0) {
throw new Error(`Invalid system id ${JSON.stringify(sysId)}`);
}
if (typeof input !== 'string' || !input.length) {
throw new Error(`Invalid filename ${JSON.stringify(input)}`);
}
input = path.resolve(__dirname, input);
if (!fs.existsSync(input)) {
throw new Error(`${input} file not found!`);
}
const csv = fs.readFileSync(input, 'utf8').split(/[\n|\r|\r\n]/).map((csv) => csv.split(/,/));
const system = {
id: sysId,
label: path.parse(input).name,
talkgroups: [],
};
for (let line of csv) {
const id = parseInt(line[0], 10);
const label = line[3] || '';
const name = line[4] || '';
const tag = line[5] || '';
const group = line[6] || '';
if (id > 0 && label.length && name.length && tag.length && group.length) {
system.talkgroups.push({ id, label, name, tag, group });
}
}
system.talkgroups.sort((a, b) => a.id - b.id);
this.config.systems = this.config.systems.filter((system) => system.id !== sysId);
this.config.systems.push(system);
this.config.systems.sort((a, b) => a.id - b.id);
return `File ${input} imported successfully into system ${sysId}`;
}
randomUUID(count = 1) {
const uuids = [];

View file

@ -1,6 +1,6 @@
{
"name": "rdio-scanner-server",
"version": "4.6.1",
"version": "4.6.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -39,5 +39,5 @@
"build": "webpack",
"start": "nodemon"
},
"version": "4.6.1"
"version": "4.6.2"
}