Skip to content

Commit

Permalink
Build bookmarks for SDR++, SDR# and GQRX
Browse files Browse the repository at this point in the history
  • Loading branch information
Xerbo committed Jul 21, 2022
1 parent fb2358f commit d1b312b
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ jobs:
- name: Build satfreq.json
run: rm .gitignore && python3 concatenate.py

- name: Build bookmark files
run: |
python3 sdrpp_bookmarks.py &&
python3 sdrsharp_bookmarks.py &&
python3 gqrx_bookmarks.py &&
mkdir bookmarks &&
mv sdrpp_bookmarks.json sdrsharp_bookmarks.xml gqrx_bookmarks.csv bookmarks
- name: Upload bookmarks
uses: actions/upload-artifact@v3
with:
name: bookmarks
path: bookmarks/

- name: Upload satfreq.json
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
satfreq.json
json/index.html
sdrpp_bookmarks.json
sdrsharp_bookmarks.xml
gqrx_bookmarks.csv
bookmarks/
14 changes: 14 additions & 0 deletions gqrx_bookmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import json

csv_out = "satfreq; #58A6FF" + os.linesep + os.linesep

with open("satfreq.json", "r") as sat_file:
sat_json = json.load(sat_file)
for sat in sat_json:
for downlink in sat["downlinks"]:
name = sat["name"] + " " + downlink["name"]
csv_out += str(downlink["frequency"]) + "; " + name + "; Demod Off; 0; satfreq" + os.linesep

with open("gqrx_bookmarks.csv", "w") as output_file:
output_file.write(csv_out)
22 changes: 22 additions & 0 deletions sdrpp_bookmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import json

bookmarks_json = {
"bookmarkDisplayMode": 1,
"lists": {
"satfreq": {
"bookmarks": {},
"showOnWaterfall": True
}
},
"selectedList": "satfreq"
}

with open("satfreq.json", "r") as sat_file:
sat_json = json.load(sat_file)
for sat in sat_json:
for downlink in sat["downlinks"]:
name = sat["name"] + " " + downlink["name"]
bookmarks_json["lists"]["satfreq"]["bookmarks"][name] = { "bandwidth": 0, "frequency": downlink["frequency"], "mode": 7 }

with open("sdrpp_bookmarks.json", "w") as output_file:
output_file.write(json.dumps(bookmarks_json, indent=4))
42 changes: 42 additions & 0 deletions sdrsharp_bookmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import os
import json
import xml.dom.minidom as minidom

root = minidom.Document()
xml = root.createElement("ArrayOfMemoryEntry")
xml.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
xml.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema")

with open("satfreq.json", "r") as sat_file:
sat_json = json.load(sat_file)
for sat in sat_json:
for downlink in sat["downlinks"]:
bookmark = root.createElement("MemoryEntry")

val = root.createElement("IsFavourite")
val.appendChild(root.createTextNode("false"))
bookmark.appendChild(val)
val = root.createElement("Name")
val.appendChild(root.createTextNode(sat["name"] + " " + downlink["name"]))
bookmark.appendChild(val)
val = root.createElement("GroupName")
val.appendChild(root.createTextNode("satfreq"))
bookmark.appendChild(val)
val = root.createElement("Frequency")
val.appendChild(root.createTextNode(str(downlink["frequency"])))
bookmark.appendChild(val)
val = root.createElement("DetectorType")
val.appendChild(root.createTextNode("RAW"))
bookmark.appendChild(val)
val = root.createElement("Shift")
val.appendChild(root.createTextNode("0"))
bookmark.appendChild(val)
val = root.createElement("FilterBandwidth")
val.appendChild(root.createTextNode("0"))
bookmark.appendChild(val)

xml.appendChild(bookmark)

with open("sdrsharp_bookmarks.xml", "w") as output_file:
output_file.write("<?xml version=\"1.0\"?>" + os.linesep)
output_file.write(xml.toprettyxml())

0 comments on commit d1b312b

Please sign in to comment.