Created
August 8, 2021 21:32
-
-
Save netdoggy/39735c95d221421249eb0efdc55e4522 to your computer and use it in GitHub Desktop.
sdrsharp to sdrpp frequency manager list converter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
import json | |
tree = ET.parse('frequencies.xml') | |
root = tree.getroot() | |
freq_list = {} | |
for child in root: | |
name = child.find("Name").text | |
group = child.find("GroupName").text | |
frequency = child.find("Frequency").text | |
bandwidth = child.find("FilterBandwidth").text | |
if not freq_list.get(group): | |
freq_list[group] = {'bookmarks':{}, "showOnWaterfall": True} | |
freq_list[group]['bookmarks'][name] = { | |
"frequency": int(frequency), | |
"bandwidth": int(bandwidth), | |
"mode": 0 | |
} | |
print(json.dumps({'bookmarkDisplayMode':1, 'lists':freq_list, "selectedList": list(freq_list.keys())[1]}, sort_keys=True, indent=4)) | |
# > frequency_manager_config.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment