auto-reload bookmarks from file

This commit is contained in:
Jakob Ketterl
2021-02-13 01:29:21 +01:00
parent 5e51beac46
commit ae76470612
2 changed files with 28 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ class Bookmarks(object):
self.bookmarks = []
self.fileList = ["/etc/openwebrx/bookmarks.json", "bookmarks.json"]
def refresh(self):
def _refresh(self):
modified = self._getFileModifiedTimestamp()
if self.file_modified is None or modified > self.file_modified:
logger.debug("reloading bookmarks from disk due to file modification")
@@ -79,6 +79,6 @@ class Bookmarks(object):
return []
def getBookmarks(self, range):
self.refresh()
self._refresh()
(lo, hi) = range
return [b for b in self.bookmarks if lo <= b.getFrequency() <= hi]