From 8d69c17c92858d8872d1119c81d3dee1ad6f9f8f Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Tue, 6 Aug 2024 21:45:23 -0400 Subject: [PATCH] Added option to skip certain bookmarks during scan. --- htdocs/index.html | 4 ++++ htdocs/lib/BookmarkDialog.js | 13 +++++++++---- htdocs/lib/Scanner.js | 3 +-- owrx/bookmarks.py | 5 +++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index bc1e9352..2453f9bf 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -386,6 +386,10 @@ +
+ + +
Cancel
Ok
diff --git a/htdocs/lib/BookmarkDialog.js b/htdocs/lib/BookmarkDialog.js index c2d94c26..ee7c2fd4 100644 --- a/htdocs/lib/BookmarkDialog.js +++ b/htdocs/lib/BookmarkDialog.js @@ -11,8 +11,13 @@ $.fn.bookmarkDialog = function() { }, setValues: function(bookmark) { var $form = $el.find('form'); - ['name', 'frequency', 'modulation', 'description'].forEach(function(key){ - $form.find('#' + key).val(bookmark[key]); + ['name', 'frequency', 'modulation', 'description', 'scannable'].forEach(function(key){ + var $input = $form.find('#' + key); + if ($input.is(':checkbox')) { + $input.prop('checked', bookmark[key]); + } else { + $input.val(bookmark[key]); + } }); $el.data('id', bookmark.id || false); return this; @@ -20,10 +25,10 @@ $.fn.bookmarkDialog = function() { getValues: function() { var bookmark = {}; var valid = true; - ['name', 'frequency', 'modulation', 'description'].forEach(function(key){ + ['name', 'frequency', 'modulation', 'description', 'scannable'].forEach(function(key){ var $input = $el.find('#' + key); valid = valid && $input[0].checkValidity(); - bookmark[key] = $input.val(); + bookmark[key] = $input.is(':checkbox')? $input.is(':checked') : $input.val(); }); if (!valid) { $el.find("form :submit").click(); diff --git a/htdocs/lib/Scanner.js b/htdocs/lib/Scanner.js index b6d3f5eb..02a6e273 100644 --- a/htdocs/lib/Scanner.js +++ b/htdocs/lib/Scanner.js @@ -91,10 +91,9 @@ Scanner.prototype.start = function() { if (!this.timer) { // Nothing found yet this.current = -1; - // Get all scannable bookmarks from the bookmark bar this.bookmarks = this.bbar.getAllBookmarks().filter( - (b) => !!b.frequency && !!b.modulation && this.modes.indexOf(b.modulation)>=0 + (b) => !!b.scannable && !!b.frequency && !!b.modulation && this.modes.indexOf(b.modulation)>=0 ); // If there are bookmarks to scan... diff --git a/owrx/bookmarks.py b/owrx/bookmarks.py index 191090ce..2653294f 100644 --- a/owrx/bookmarks.py +++ b/owrx/bookmarks.py @@ -15,6 +15,7 @@ class Bookmark(object): self.frequency = j["frequency"] self.modulation = j["modulation"] self.description = j["description"] if "description" in j else "" + self.scannable = j["scan"] if "scannable" in j else True self.srcFile = srcFile def getName(self): @@ -29,6 +30,9 @@ class Bookmark(object): def getDescription(self): return self.description + def isScannable(self): + return self.scannable + def getSrcFile(self): return self.srcFile @@ -38,6 +42,7 @@ class Bookmark(object): "frequency": self.getFrequency(), "modulation": self.getModulation(), "description": self.getDescription(), + "scannable": self.isScannable(), }