Feature #10269
openchirpc: add import and export CSV features
0%
Description
One thing I missed was the ability to just "import" a CSV file of channels that I had prepared earlier. This can be done in the GUI using copy and paste, but if that's not usable (e.g. if buggy libs cause a crash or if screen readers are in use), it'd be nice for chirpc
to support this as it'd allow the memory channels to at least be manipulated without the full GUI.
I had a stab at this this morning and came up with this:
https://github.com/sjlongland/chirp/tree/feature/chirpc-csv-import-export
Usage is pretty simple:
- Dumping:
python3 chirpc --mmap radio.img --export-csv radio.csv
- Loading:
python3 chirpc --mmap radio.img --import-csv radio.csv
I've tried to stay "true" to the standard CSV format as much as possible. Export simply uses the Memory.to_csv
method and the standard Memory
headers. Import tries to be fairly permissive in terms of handling column ordering and extra columns. I did try using the Memory.really_from_csv
method, but found the column indices it expects differ from the standard export format (notably; Mode
was sourced from the RxCtcsCode
column), so wound up writing my own.
I used it successfully to import channels for VK4 and some VK2 repeaters into my Yaesu FT-897D radio as generated by this script (which I adapted to support this CSV schema):
https://gist.github.com/sjlongland/16fa7308c8a6f5597e725e0b0d9f27f6
I suspect this code will need some cleaning up before final submission into CHIRP.