Skip to content

Commit 7f85204

Browse files
authored
Merge pull request #11 from masenf/us-dzcb-0.3
dzcb 0.3
2 parents 675de00 + 84ad051 commit 7f85204

17 files changed

+215
-80
lines changed

README.md

+33-5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ Create / edit codeplug source files under [`/input`](/input).
3333
If multiple subdirectories exist under `/input`, then multiple
3434
codeplugs will be generated.
3535

36+
The [`default`](./input/default) directory contains the example codeplug
37+
input files along with 2 scripts:
38+
39+
* [`generate.sh`](./input/default/generate.sh) builds the codeplug with a
40+
standard bash shell command.
41+
* [`generate.py`](./input/default/generate.py) builds the same codeplug
42+
using python code.
43+
44+
Derivative codeplugs don't need to include both scripts. Use the format
45+
that is most familiar. While the sample scripts show identical functionality,
46+
the python code could be extended to hack at the generation process itself.
47+
3648
### See [dzcb README.md](https://github.com/mycodeplug/dzcb#dzcb) for more information on input files and formats.
3749

3850
## Generating
@@ -51,14 +63,20 @@ for step-by-step instructions.
5163
* Copy templates from
5264
[default-tyt-md380](https://github.com/mycodeplug/dzcb/blob/main/codeplug/default-tyt-md380)
5365
for monoband variants.
66+
* [`example-d878uv.conf`](./input/default/example-d878uv.conf):
67+
set your Radio ID and Radio Name
68+
* See README and templates in
69+
[dmrconfig](https://github.com/mycodeplug/dzcb/blob/main/src/dzcb/data/dmrconfig)
70+
for more information and other radio types.
5471
* [`k7abd`](./input/default/k7abd): manually defined zones in
5572
K7ABD anytone-config-builder format. See N7EKB's
5673
[`cps-import-builder` reference data files](https://github.com/n7ekb/cps-import-builder/tree/main/reference_data_files/N7EKB_shared_files)
5774
for more examples.
58-
* [`order.json`](./input/default/order.json): preferred zone order,
59-
zone exclusion, preferred talkgroup order
75+
* [`order.csv`](./input/default/order.csv): preferred zone, contact, channel order
76+
* [`exclude.csv`](./input/default/exclude.csv): zone, contact, channel exclude
77+
* [`replacements.csv`](./input/default/replacements.csv): object name replacements (regex)
6078
* [`scanlists.json`](./input/default/scanlists.json): additional scanlists
61-
* [`generate.sh`](./input/default/generate.sh): options passed to `dzcb` (whether
79+
* [`generate.py`](./input/default/generate.py): options passed to `dzcb` (whether
6280
to include PNWDigital, SeattleDMR, default files, etc)
6381
* [`prox.csv`](./input/default/prox.csv): customize points of
6482
interest, distances, and desired bands
@@ -71,11 +89,21 @@ for step-by-step instructions.
7189

7290
#### Requirements
7391

74-
* linux or macOS (windows not yet supported)
75-
* python 3.5+ (python 3.8 recommended)
92+
* linux, macOS, windows
93+
* python 3.6+ (python 3.8 recommended)
7694
* [tox](https://tox.readthedocs.io/en/latest/)
7795

96+
#### Build
97+
98+
To output to a specific directory, set the `OUTPUT` environment variable.
99+
78100
```
79101
pip install tox
80102
tox
81103
```
104+
105+
To run the `generate.sh` shell scripts
106+
107+
```
108+
tox -e shell
109+
```

input/default/example-d878uv.conf

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# mycodeplug/example-codeplug generated $ISODATE
3+
# by dzcb (https://github.com/mycodeplug/dzcb)
4+
#
5+
# !dzcb.ranges: 136-174,400-480
6+
Radio: Anytone AT-D878UV
7+
8+
# Table of text messages.
9+
# 1) Message number: 1-100
10+
# 2) Text: up to 200 characters
11+
#
12+
Message Text
13+
1 Hello
14+
2 Thank you
15+
3 73
16+
4 QTH?
17+
5 Test message
18+
19+
# Unique DMR ID and name of this radio.
20+
ID: 12345678
21+
Name: AA1AA
22+
23+
# Text displayed when the radio powers up.
24+
Intro Line 1: $DATE
25+
Intro Line 2: PNWDigital

input/default/example-md-uv380.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"GroupCallHangTime": "3000",
172172
"GroupCallMatch": "On",
173173
"IntroScreen": "Character String",
174-
"IntroScreenLine1": "2021/01/01",
174+
"IntroScreenLine1": "$DATE",
175175
"IntroScreenLine2": "PNWDigital",
176176
"KeypadTones": "Off",
177177
"LoneWorkerReminderTime": "10",

input/default/exclude.csv

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Channels,Contacts,Zones
2+
"MM/Peter 430","Kitsap CARC",
3+
"MM/Wes 430","Wash ARES",
4+
"Coeur d'Alene","Idaho ARES 2",
5+
"Lewiston ID","SoCal 2",
6+
"Poteros/Goat Mtn","Utah 2",
7+
"Prineville/Town",,
8+
"Saint Maries ID",,
9+
"Sultan/Haystack",,
10+
"BC:Whisler/Black",,
11+
"BC:NewWstmnstr",,
12+
"BC:Vancouver/Sey",,
13+
"BC:Squamish",,
14+
"BC:W.Vancvr/Ambl",,
15+
"Tulalip/Tulalip",,
16+
"Gresham/Hospital",,
17+
"BM Port Townsend",,
18+
"CC Port Angeles",,
19+
"CC Sequim",,
20+
"Sequim KC7EQO",,
21+
"BM Ferndale",,
22+
"BM Scappoose",,

input/default/generate.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
3+
# This generates the same codeplug as generate.sh
4+
# using python code.
5+
6+
from pathlib import Path
7+
import os
8+
9+
from dzcb.recipe import CodeplugRecipe
10+
11+
cp_dir = Path(__file__).parent
12+
output = Path(os.environ.get("OUTPUT") or (cp_dir / ".." / ".." / "OUTPUT"))
13+
14+
CodeplugRecipe(
15+
source_pnwdigital=True,
16+
source_seattledmr=True,
17+
source_default_k7abd=True,
18+
source_k7abd=[(cp_dir / "k7abd")],
19+
source_repeaterbook_proximity=cp_dir / "prox.csv",
20+
repeaterbook_states=["washington", "oregon"],
21+
repeaterbook_name_format='{Callsign} {Nearest City} {Landmark}',
22+
scanlists_json=cp_dir / "scanlists.json",
23+
exclude=cp_dir / "exclude.csv",
24+
order=cp_dir / "order.csv",
25+
replacements=cp_dir / "replacements.csv",
26+
output_anytone=True,
27+
output_dmrconfig=[(cp_dir / "example-d878uv.conf")],
28+
output_farnsworth=[(cp_dir / "example-md-uv380.json")],
29+
output_gb3gf=True
30+
).generate(output / cp_dir.name)

input/default/generate.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
#!/usr/bin/env bash
22

3+
# This generates the same codeplug as generate.py
4+
# using bash scripting. Linux or macOS only.
5+
36
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
47
OUTPUT=${OUTPUT:-$DIR/../../OUTPUT}
58
python -m dzcb \
69
--pnwdigital \
710
--seattledmr \
811
--default-k7abd \
9-
--repeaterbook-state washington oregon \
10-
--repeaterbook-proximity-csv "$DIR/prox.csv" \
1112
--k7abd $DIR/k7abd \
12-
--farnsworth-template-json "$DIR/example-md-uv380.json" \
13+
--repeaterbook-proximity-csv "$DIR/prox.csv" \
14+
--repeaterbook-state washington oregon \
15+
--repeaterbook-name-format '{Callsign} {Nearest City} {Landmark}' \
1316
--scanlists-json "$DIR/scanlists.json" \
14-
--order-json "$DIR/order.json" \
15-
$OUTPUT/$(basename "$DIR")
17+
--exclude "$DIR/exclude.csv" \
18+
--order "$DIR/order.csv" \
19+
--replacements "$DIR/replacements.csv" \
20+
--anytone \
21+
--dmrconfig "$DIR/example-d878uv.conf" \
22+
--farnsworth-template-json "$DIR/example-md-uv380.json" \
23+
--gb3gf \
24+
-- "$OUTPUT/$(basename "$DIR")"
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Zone Name,Comment,Power,RX Freq,TX Freq,Color Code,CNJHam,Colorado Mega,CO Skyhub,Illinois-Link,Olympic P,Oregon 1,Oregon TAC,PNW Rgnl,Quadnet Array,Reddit,TAC 310-2,TAC 311-2,TAC 312-2,Texas,Washington 1,Worldwide
2-
DPHS Static;DHS,Static Tgs,Low,430.4375,439.4375,1,-,-,-,-,2,1,2,2,-,2,-,-,-,-,1,-
3-
DPHS Wide;DHW,Dynamic Tgs,Low,430.4375,439.4375,1,2,2,2,2,-,-,-,-,2,2,2,2,2,2,-,2
1+
Zone Name,Comment,Power,RX Freq,TX Freq,Color Code,CNJHam,Colorado Mega,CO Skyhub,Illinois-Link,Olympic P,Oregon 1,Oregon TAC,PNW Rgnl,Quadnet Array,Reddit,Parrot BM,TAC 310-2,TAC 311-2,TAC 312-2,Texas,Washington 1,Worldwide
2+
DPHS Static;DHS,Static Tgs,Low,430.4375,439.4375,1,-,-,-,-,2,1,2,2,-,2,2,-,-,-,-,1,-
3+
DPHS Wide;DHW,Dynamic Tgs,Low,430.4375,439.4375,1,2,2,2,2,-,-,-,-,2,2,2,2,2,2,2,-,2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Zone Name,Comment,Power,RX Freq,TX Freq,Color Code,California,Emcom US,Kitsap CARC,Olympic P,Oregon 1,Oregon TAC,PNW Rgnl,TAC 310,TAC 311,TAC 312,TG 2,TG 9,Washington 1,Wash ARES
2+
BM Port Townsend;BPT,W7JCR,High,443.825,448.825,1,2,2,1,1,2,1,1,1,1,1,1,1,2,1
3+
CC Port Angeles;CPA,W7FW,High,442.125,447.125,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1
4+
CC Sequim;CSQ,K6MBY,High,440.75,445.75,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1
5+
Sequim KC7EQO;SQK,KC7EQO,High,442.1,447.1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1
6+
BM Ferndale;BFD,W7ECG,High,440.7375,445.7375,1,-,1,-,-,1,-,2,1,1,1,1,1,1,1
7+
BM Scappoose;BSC,AA7BG,High,441.8625,446.8625,1,-,2,-,-,1,2,2,1,1,1,1,2,1,-

input/default/k7abd/Talkgroups__Hotspot.csv

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Oregon TAC,31410
88
PNW Rgnl,31771
99
Quadnet Array,31012
1010
Reddit,98003
11+
Parrot BM,9990P
1112
TAC 310-2,310
1213
TAC 311-2,311
1314
TAC 312-2,312
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
California,3106
2+
Emcom US,9911
3+
Kitsap CARC,311429
4+
Local 1,3181
5+
Olympic P,31531
6+
Oregon 1,3141
7+
Oregon TAC,31410
8+
PNW Rgnl,31771
9+
TAC 310,310
10+
TAC 311,311
11+
TAC 312,312
12+
TG 2,2
13+
TG 9,9
14+
Washington 1,3153
15+
Wash ARES,31538
16+
Simplex 99,99

input/default/order.csv

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
zones,contacts,channels
2+
PNWDigital,Oregon 1,Rainier Hill
3+
Hotspot,Washington 1,DPHS Static
4+
Local,Washington 2,DPHS Wide
5+
SeattleDMR,Cascades 1,
6+
Longview WA VHF 35mi,Local 1,
7+
Longview WA UHF 35mi,Local 2,
8+
Simplex A VHF,Parrot 1,
9+
Simplex A UHF,,
10+
Simplex D VHF,,
11+
Simplex D UHF,,

input/default/order.json

-42
This file was deleted.

input/default/replacements.csv

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Channels_pattern,Channels_repl,Zones_pattern,Zones_repl,Contacts_pattern,Contacts_repl,
2+
Oregon,OR,Longview/Rainier,Rainier Hill,,,
3+
Washington,WA,,,,,

input/default/scanlists.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
"Longview/Rainier",
44
"DPHS Static",
55
"DPHS Wide",
6-
"Oregon 1 LVR",
7-
"Washington 2 LVR",
8-
"W7DG Longview 1",
6+
"OR 1 LVR",
7+
"WA 2 LVR",
8+
"W7DG Longview1",
9+
"W7DG Longview Co",
910
"N7EI Deer Island",
10-
"W7BU Astoria Ni1",
11-
"W7BU Astoria Wi1",
12-
"K7RPT Astoria W1",
13-
"KJ7IY Timber ",
14-
"WA7UHD Chehalis ",
15-
"W7DG Longview ",
11+
"W7BU Astoria Nic",
12+
"W7BU Astoria Wic",
13+
"K7RPT Astoria Wi",
14+
"KJ7IY Timber",
15+
"WA7UHD Chehalis",
16+
"W7DG Longview",
1617
"N3EG Longview Co",
17-
"AB7F Longview ",
18+
"AB7F Longview",
1819
"W7OTV Colton Goa",
1920
"SP U01 441.000",
2021
"SP U02 446.5",

input/generate_all.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python3
2+
3+
# execute all generate.py files in subdirectories of this
4+
# scripts directory
5+
6+
from pathlib import Path
7+
import subprocess
8+
import sys
9+
10+
cp_dir = Path(__file__).parent
11+
12+
for genpy in cp_dir.glob("**/generate.py"):
13+
subprocess.check_call([sys.executable, genpy])

input/generate_all.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# execute all generate.sh files in subdirectories of this
4+
# scripts directory (posix-like only)
5+
6+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
8+
if find --version 2>/dev/null | grep "GNU findutils" > /dev/null; then
9+
FIND_OPTS="-executable"
10+
else
11+
FIND_OPTS="-perm +111"
12+
fi
13+
14+
find $DIR \
15+
-name "generate.sh" \
16+
$FIND_OPTS -print0 | \
17+
xargs -0 -n 1 bash

tox.ini

+8-14
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,16 @@
22
minversion = 3.7.0
33
skipsdist = true
44
allowlist_external = /usr/bin/env
5-
envlist = py3-{linux,mac}
5+
envlist = py3
66

77
[testenv]
8-
platform =
9-
linux: linux
10-
mac: darwin
118
passenv = OUTPUT
12-
setenv =
13-
!mac: FIND_OPTS = -executable
14-
mac: FIND_OPTS = -perm '+111'
159
deps =
16-
dzcb~=0.2.0
10+
dzcb~=0.3.0
1711
commands =
18-
/usr/bin/env bash -c " \
19-
find {toxinidir}/input \
20-
-name "generate.sh" \
21-
{env:FIND_OPTS} -print0 | \
22-
xargs -0 -n 1 bash \
23-
"
12+
python {toxinidir}/input/generate_all.py
13+
14+
[testenv:shell]
15+
platform = linux|darwin
16+
commands =
17+
{toxinidir}/input/generate_all.sh

0 commit comments

Comments
 (0)