Package: dzcb
dzcbDMRZoneChannelBuilderFetch - fetch input files from local directories or urlsAssemble - combine information from multiple sourcesFilter - rename, exclude, reorder zones, and talkgroupsFormat - output to common export formatsOverview VideoSeeReleasesfor Default CodeplugsGithub ActionsFor more information on generating customized codeplugs in the cloud without
installing any software, seeWALKTHROUGH.The walkthrough usesmycodeplug/example-codeplug[input files]Output FormatsFarnsworth JSONFor import intoeditcp,
with theoretical support for:TYTMD-380, MD-390MD-UV380 (tested), MD-UV390MD-2017Alinco DJ-MD40Retevis RT3, RT3-G, RT3S, and RT82 radiosUse--farnsworth-template-jsonto specify an exported codeplug to
use as the template for settings and radio capabilities.dzcbincludes basic template files forMD380/390andMD-UV380/390.Generated JSON files will be written to theeditcpsubdir of the output directory.OpenRTX/dmrconfigFor import intodmrconfig1.1
utility with theoretical support for:Anytone AT-D868UVAnytone AT-D878UVBTECH DMR-6x2Baofeng DM-1801Radioddity GD-77TYT MD-380TYT MD-390Zastone D900Zastone DP880Radtel RT-27DBaofeng RD-5RTYT MD-UV380TYT MD-UV390TYT MD-2017TYT MD-9600Retevis RT84Use--dmrconfig-templateto specify an exported codeplug config to use as a
template for radio type, messages, DMR ID,  and startup text. Thedmrconfigsubdir
of the output directory will contain a dmrconfig config per template specified.Anytone CPSFor import into the official Anytone CPS (windows-only).dzcbgenerates Channels.CSV, Talkgroups.CSV, ScanList.CSV, and Zone.CSV in theanytonesubdir
of the output directory.Versions SupportedAT-D578UVCPS 1.11Bridgecom SupportAT-D868UVCPS 1.39Bridgecom SupportAT-D878UVCPS 1.21Bridgecom Support(links fetched 2021/01/24)GB3GF OpenGD77 CSVFor import intoGB3GF CSV tool.
Currently only supporting OpenGD77 target. Tool is "windows-only" but
runs decently under wine.If--gb3gfis specified, thegb3gf/opengd77subdir of the output directory will
contain the 4 CSV files used by the program:Channels.csvContacts.csvTG_Lists.csvZones.csvNote: these files are actually semicolon separated.Input FormatK7ABD styleA directory of inter-related CSV files describing the common settings
needed to program all radios. This is a common format used by K7ABD's
originalanytone-config-builderand N7EKB'scps-import-builder.An arbitrary number of files and folders will be combined. At this time duplicate
zone names in different files may be problematic. Keep zone names unique.
Particularly be wary of trucated names.Analog__ZoneName.csvZone, Channel Name, Bandwidth, Power, RX Freq, TX Freq, CTCSS Decode, CTCSS Encode, TX ProhibitTalkgroups__ZoneName.csvNo Header Rowtuples of: talkgroup_name,talkgroup_numberTo specify aPrivatecall, suffix the talkgroup number with a "P"Digital-Other__ZoneName.csv-- only really useful for digital simplex channels or private callZone, Channel Name, Power, RX Freq, TX Freq, Color Code, Talk Group, TimeSlot, Call Type, TX PermitDigital-Repeaters__ZoneName.csv-- each line is a digital channel with static talkgroup timeslot assignmentsZone Name, Comment, Power, RX Freq, TX Freq, Color Code, talkgroup1, talkgroup2, talkgroup3, ...Typically the Zone Name field is semicolon separated: "Longer Name;LNM"The value for the talkgroup column should be "-", "1", or "2"The talkgroup names must exist in the talkgroups file.Some codeplug targets will create a zone for each frequency with channels for each static talkgroup.Data SourcesPNWdigital.netBefore using this network, please read thequick startWhen building a codeplug with the--pnwdigitalswitch,
data is downloaded fromPNWDigital.net/files/acb.
The files are updated regularly from the cBridge, so there
could be test data or repeaters that are not yet active.The data is cached bydzcb.pnwdigitalSeattleDMRBefore using these repeaters, please read the websiteWhen building a codeplug with the--seattledmrswitch,
data is downloaded fromseattledmr.org/ConfigBuilder/Digital-Repeaters-Seattle-addon.csvand cleaned up a bit indzcb.seattledmrRepeaterbook ProximityDownload live analog Repeaterbook data within distance of point of
interest.--repeaterbook-proximity-csvreferences a csv file with the fields:Zone Name,Lat,Long,Distance,Unit,Band(2m;1.25m;70cm),Use,Operational Status,etcSee example:src/dzcb/data/repeaterbook_proximity_zones.csvThe fields after Band are optional and correspond directly to the field names
and values in theRepeaterbook API(see examples).--repeaterbook-stateis a space-separated list of US states or Canadian
provinces that should be included in the proximity search. Including more
states will increase the time required to generate the codeplug.Repeaterbook API data is downloaded and cached in a user and platform-specific
cache directory. Data will be refreshed if it is older than 12 hours. When
downloading from Repeaterbook, a delay of 30 seconds is introduced between
requests to reduce load on the repeaterbook servers.Please respect their servers and submit changes requests to repeaterbook
directly.Seedzcb.repeaterbook.Example FormatZone Name,Lat,Long,Distance,Unit,Band(2m;1.25m;70cm),Use,Operational Status
Longview WA 35mi,46.13819885,-122.93800354,35,miles,2m;70cm,OPEN,On-air
Longview WA VHF 35mi,46.13819885,-122.93800354,35,miles,2m,open,On-air
Longview WA UHF 35mi,46.13819885,-122.93800354,35,miles,70cm,OPEN,On-Air(it's easy to search on repeaterbook and copy the info from the URL!)Simplex, GMRS, etcSome commonDigitalandAnalogsimplex frequencies,
andGMRS/FRS and MURS channelsare
included if--default-k7abdis specified.CustomizationThe channels, zones, and contacts present and the ordering of such in the
final generated codeplug is controlled by one or more CSV files passed
as parameters.The column headers correspond to the codeplug objects (zones, contacts, channels,
etc) and may appear in any order or be omitted (if no change is requested to
that type of codeplug object).The names used in include, exclude, and order arepython regular expressionsthat match from the beginning of the object name. They are prefix match by
default.  To opt-out of prefix match, add a$at the end. All regular
expression special characters should be escaped (\).--includeIf the CSV file is passed as a--includeparameter, then any objects not explicitly
mentioned in the file will be removed.--excludeIf the CSV file is passed as an--excludeparameter, then any objects mentioned
will be removed.See example:codeplug/default-tyt-md380/exclude.csv(for radios with lower channel/zone capacity)--orderAlphabetic sorting by filename is used when initially building the zones and channels
from K7ABD input files. No implicit sorting by object name occurs.Any remaining objects are sorted according to the order specified in the file
passed to--order. Similarly, a file may be specified as--reverse-orderwhich
will sort in reverse, starting from the end of the list.See example:codeplug/default/order.csv--replacementsThe replacements CSV column headers are likeobject_pattern,object_repland
correspond exactly to the arguments passed to python'sre.sub. Similar to the
ordering csv,objectwould refer to zones, contacts, channels, etc.The replacements will be applied to the name of each object of the given
type in the listed order. Subsequent patterns will affect previous
replacements. Unlike the previous group, these regular expressions are
case sensitive, support capturing groups, and indexed replacement.See example:codeplug/default/replacements.csv--repeaterbook-name-formatPython format string used to generate channel names from repeaterbook.The format string will be passed the Repeaterbook API response dictionary
for the repeater, so all valid fields are usable in the format string.The default name format is:"{Callsign} {Nearest City} {Landmark}"Bonus: Trim the Contact ListDownload the usersDB.bin with Farnsworth editcp.python -m dzcb.contact_trim \
    < "~/.cache/codeplug/Codeplug Editor/usersDB.bin" \
    > "~/.cache/codeplug/Codeplug Editor/usersDB-trimmed.bin"Basic UsageInstallationpip install dzcbExampleDownload live pnwdigital and seattledmr networks and generate a dmrconfig style
codeplug in/tmp/my-codeplugwith local simplex zones included.python -m dzcb \
    --pnwdigital \
    --seattledmr \
    --default-k7abd \
    --dmrconfig -- /tmp/my-codeplugDocker ContainerA docker container for dzcb can be built and run as follows:# Build container
tools/build_docker.sh

# Run dzcb
docker run --rm -ti \
      -v /tmp/my-codeplug:/my-codeplug \
      dzcb \
      --pnwdigital \
      --seattledmr \
      --default-k7abd \
      --dmrconfig \
      -- \
      /my-codeplugComplex UsageSeeWALKTHROUGHfor a step-by-step guide
to getting started with your own customized codeplug build. (The walkthrough
usesmycodeplug/example-codeplug)CLI$ python -m dzcb --help
usage: python -m dzcb [-h] [--pnwdigital] [--seattledmr] [--default-k7abd] [--k7abd [DIR [DIR ...]]]
                   [--repeaterbook-proximity-csv [CSV [CSV ...]]] [--repeaterbook-state [STATE [STATE ...]]]
                   [--repeaterbook-name-format REPEATERBOOK_NAME_FORMAT] [--scanlists-json JSON] [--include [CSV [CSV ...]]]
                   [--exclude [CSV [CSV ...]]] [--order [CSV [CSV ...]]] [--reverse-order [CSV [CSV ...]]]
                   [--replacements [CSV [CSV ...]]] [--anytone [RADIO [RADIO ...]]] [--dmrconfig-template [CONF [CONF ...]]]
                   [--farnsworth-template-json [JSON [JSON ...]]] [--gb3gf [RADIO [RADIO ...]]]
                   outdir

dzcb: DMR Zone Channel Builder

positional arguments:
  outdir                Write codeplug files to this directory

optional arguments:
  -h, --help            show this help message and exit
  --pnwdigital          Fetch the latest pnwdigital K7ABD input files
  --seattledmr          Fetch the latest seattledmr K7ABD input files
  --default-k7abd       Include bundled K7ABD input files (simplex + unlicensed)
  --k7abd [DIR [DIR ...]]
                        Specify one or more local directories containing K7ABD CSV files
  --repeaterbook-proximity-csv [CSV [CSV ...]]
                        Fetch repeaters within X distance of POIs defined in a CSV file
  --repeaterbook-state [STATE [STATE ...]]
                        Download repeaters from the given state(s). Default: 'Washington' 'Oregon'
  --repeaterbook-name-format REPEATERBOOK_NAME_FORMAT
                        Python format string used to generate channel names from repeaterbook. See Repeaterbook API response
                        for usable field names. Default: '{Callsign} {Nearest City} {Landmark}'
  --scanlists-json JSON
                        JSON dict mapping scanlist name to list of channel names.
  --include [CSV [CSV ...]]
                        Specify one or more CSV files with object names to include
  --exclude [CSV [CSV ...]]
                        Specify one or more CSV files with object names to exclude
  --order [CSV [CSV ...]]
                        Specify one or more CSV files with object order by name
  --reverse-order [CSV [CSV ...]]
                        Specify one or more CSV files with object order by name (reverse)
  --replacements [CSV [CSV ...]]
                        Specify one or more CSV files with object name replacements
  --anytone [RADIO [RADIO ...]]
                        Generate Anytone CPS CSV files in the 'anytone' subdir for the given radio and CPS versions. If no
                        RADIO+CPS versions are provided, use default set: (578_1_11 868_1_39 878_1_21)
  --dmrconfig-template [CONF [CONF ...]], --dmrconfig [CONF [CONF ...]]
                        Generate dmrconfig conf files in the 'dmrconfig' subdir based on the given template conf files. If no
                        templates are provided, default templates will be used.
  --farnsworth-template-json [JSON [JSON ...]], --editcp [JSON [JSON ...]]
                        Generate Farnsworth editcp JSON format codeplugs in the 'editcp' subdir based on the given template
                        json files. If no templates are provided, default templates will be used.
  --gb3gf [RADIO [RADIO ...]]
                        Generate GB3GF CSV files in the 'gb3gf' subdir for the given radio types. If no radios are provided,
                        use default: (opengd77)Python APIdzcbexposes a python API that is identical to the command line interface
which can be extended to further customize the generation process without
having to directly patch dzcb.The documentation should improve as the project matures, but for now, seegenerate.pyfor a real example anddzcb.recipe.CodeplugRecipefor the implementation details.Development UsageInstallationpip install -e ./dzcbDevelopment Docker ContainerA docker container for dzcb development can be built and run as follows:# Build container
tools/build_docker_dev.sh

# Run dzcb
docker run --rm -ti \
      -v /tmp/my-codeplug:/my-codeplug \
      -v .:/app/dzcb \
      dzcb:devBugs?Please submit the entire output directory including log files when submittingissues.