Added option to skip certain bookmarks during scan.

This commit is contained in:
Marat Fayzullin 2024-08-06 21:45:23 -04:00
parent ecb7ab75e7
commit 8d69c17c92
4 changed files with 19 additions and 6 deletions

View File

@ -386,6 +386,10 @@
<label for="name">Description:</label> <label for="name">Description:</label>
<input type="text" id="description" name="description"> <input type="text" id="description" name="description">
</div> </div>
<div class="form-field">
<label for="name">Scannable</label>
<input type="checkbox" id="scannable" name="scannable" checked>
</div>
<div class="buttons"> <div class="buttons">
<div class="openwebrx-button" data-action="cancel">Cancel</div> <div class="openwebrx-button" data-action="cancel">Cancel</div>
<div class="openwebrx-button" data-action="submit">Ok</div> <div class="openwebrx-button" data-action="submit">Ok</div>

View File

@ -11,8 +11,13 @@ $.fn.bookmarkDialog = function() {
}, },
setValues: function(bookmark) { setValues: function(bookmark) {
var $form = $el.find('form'); var $form = $el.find('form');
['name', 'frequency', 'modulation', 'description'].forEach(function(key){ ['name', 'frequency', 'modulation', 'description', 'scannable'].forEach(function(key){
$form.find('#' + key).val(bookmark[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); $el.data('id', bookmark.id || false);
return this; return this;
@ -20,10 +25,10 @@ $.fn.bookmarkDialog = function() {
getValues: function() { getValues: function() {
var bookmark = {}; var bookmark = {};
var valid = true; var valid = true;
['name', 'frequency', 'modulation', 'description'].forEach(function(key){ ['name', 'frequency', 'modulation', 'description', 'scannable'].forEach(function(key){
var $input = $el.find('#' + key); var $input = $el.find('#' + key);
valid = valid && $input[0].checkValidity(); valid = valid && $input[0].checkValidity();
bookmark[key] = $input.val(); bookmark[key] = $input.is(':checkbox')? $input.is(':checked') : $input.val();
}); });
if (!valid) { if (!valid) {
$el.find("form :submit").click(); $el.find("form :submit").click();

View File

@ -91,10 +91,9 @@ Scanner.prototype.start = function() {
if (!this.timer) { if (!this.timer) {
// Nothing found yet // Nothing found yet
this.current = -1; this.current = -1;
// Get all scannable bookmarks from the bookmark bar // Get all scannable bookmarks from the bookmark bar
this.bookmarks = this.bbar.getAllBookmarks().filter( 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... // If there are bookmarks to scan...

View File

@ -15,6 +15,7 @@ class Bookmark(object):
self.frequency = j["frequency"] self.frequency = j["frequency"]
self.modulation = j["modulation"] self.modulation = j["modulation"]
self.description = j["description"] if "description" in j else "" self.description = j["description"] if "description" in j else ""
self.scannable = j["scan"] if "scannable" in j else True
self.srcFile = srcFile self.srcFile = srcFile
def getName(self): def getName(self):
@ -29,6 +30,9 @@ class Bookmark(object):
def getDescription(self): def getDescription(self):
return self.description return self.description
def isScannable(self):
return self.scannable
def getSrcFile(self): def getSrcFile(self):
return self.srcFile return self.srcFile
@ -38,6 +42,7 @@ class Bookmark(object):
"frequency": self.getFrequency(), "frequency": self.getFrequency(),
"modulation": self.getModulation(), "modulation": self.getModulation(),
"description": self.getDescription(), "description": self.getDescription(),
"scannable": self.isScannable(),
} }