Merge 6ae91050dabdc07bad086214b805392cdd025f7f into cb5b2e64af91ed0b08e6be606ea312d32933e6e2
This commit is contained in:
commit
b12f0905bd
28
tools/bookmark_integrator
Executable file
28
tools/bookmark_integrator
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
import csv
|
||||||
|
import sys
|
||||||
|
|
||||||
|
with open("../bookmarks.json") as f:
|
||||||
|
bookmarks = json.load(f)
|
||||||
|
|
||||||
|
modulation_map = {"FM": "nfm", "NFM": "nfm"}
|
||||||
|
|
||||||
|
in_file = sys.argv[1]
|
||||||
|
to_integrate = []
|
||||||
|
with open(in_file) as f:
|
||||||
|
reader = csv.DictReader(f)
|
||||||
|
for row in reader:
|
||||||
|
channel = {
|
||||||
|
"name": row["Name"],
|
||||||
|
"frequency": int(float(row["Frequency"]) * 1000000),
|
||||||
|
"modulation": modulation_map[row["Mode"]],
|
||||||
|
}
|
||||||
|
to_integrate.append(channel)
|
||||||
|
|
||||||
|
bookmarks.extend(to_integrate)
|
||||||
|
deduplicated = [dict(t) for t in {tuple(d.items()) for d in bookmarks}]
|
||||||
|
|
||||||
|
with open("../bookmarks.json", "w") as f:
|
||||||
|
json.dump(deduplicated, f)
|
Loading…
x
Reference in New Issue
Block a user