move bands and bookmarks to the config, too
This commit is contained in:
parent
3b32dc37c8
commit
5c8da76d9a
4
debian/openwebrx.install
vendored
4
debian/openwebrx.install
vendored
@ -1,2 +1,4 @@
|
|||||||
config_webrx.py etc/
|
config_webrx.py etc/openwebrx/
|
||||||
|
bands.json etc/openwebrx/
|
||||||
|
bookmarks.json etc/openwebrx/
|
||||||
systemd/openwebrx.service lib/systemd/system/
|
systemd/openwebrx.service lib/systemd/system/
|
@ -46,10 +46,18 @@ class Bandplan(object):
|
|||||||
return Bandplan.sharedInstance
|
return Bandplan.sharedInstance
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
f = open("bands.json", "r")
|
self.bands = self.loadBands()
|
||||||
bands_json = json.load(f)
|
|
||||||
f.close()
|
def loadBands(self):
|
||||||
self.bands = [Band(d) for d in bands_json]
|
for file in ["/etc/openwebrx/bands.json", "bands.json"]:
|
||||||
|
try:
|
||||||
|
f = open(file, "r")
|
||||||
|
bands_json = json.load(f)
|
||||||
|
f.close()
|
||||||
|
return [Band(d) for d in bands_json]
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
return []
|
||||||
|
|
||||||
def findBands(self, freq):
|
def findBands(self, freq):
|
||||||
return [band for band in self.bands if band.inBand(freq)]
|
return [band for band in self.bands if band.inBand(freq)]
|
||||||
|
@ -34,10 +34,19 @@ class Bookmarks(object):
|
|||||||
return Bookmarks.sharedInstance
|
return Bookmarks.sharedInstance
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
f = open("bookmarks.json", "r")
|
self.bookmarks = self.loadBookmarks()
|
||||||
bookmarks_json = json.load(f)
|
|
||||||
f.close()
|
def loadBookmarks(self):
|
||||||
self.bookmarks = [Bookmark(d) for d in bookmarks_json]
|
for file in ["/etc/openwebrx/bookmarks.json", "bookmarks.json"]:
|
||||||
|
try:
|
||||||
|
f = open(file, "r")
|
||||||
|
bookmarks_json = json.load(f)
|
||||||
|
f.close()
|
||||||
|
return [Bookmark(d) for d in bookmarks_json]
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
def getBookmarks(self, range):
|
def getBookmarks(self, range):
|
||||||
(lo, hi) = range
|
(lo, hi) = range
|
||||||
|
@ -134,7 +134,7 @@ class PropertyManager(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def loadConfig(self):
|
def loadConfig(self):
|
||||||
for file in ["/etc/config_webrx.py", "./config_webrx.py"]:
|
for file in ["/etc/openwebrx/config_webrx.py", "./config_webrx.py"]:
|
||||||
try:
|
try:
|
||||||
spec = importlib.util.spec_from_file_location("config_webrx", file)
|
spec = importlib.util.spec_from_file_location("config_webrx", file)
|
||||||
cfg = importlib.util.module_from_spec(spec)
|
cfg = importlib.util.module_from_spec(spec)
|
||||||
|
Loading…
Reference in New Issue
Block a user