Skip to content

Commit

Permalink
Clear custom list button
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Oct 9, 2024
1 parent 027f11e commit 37c89e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 1 addition & 3 deletions Help/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@
<li>Search only for a specific species</li>
</ol>
You may use a different custom list for both BirdNET and Chirpity models. The format for a
custom list file is "scientific name_common name", with each species on a new line. You can export a starting
custom list file is "scientific name_common name", with each species on a new line. <b>Importantly, the custom list needs to use labels in your selected language.</b> You can export a starting
list in the correct format from the Help menu, using the "<i>What species are detected?</i>" link.

<p><i>If you wish to see the full list of classes each model was trained on, check the Help menu &gt; <b>What species are detected?</b></i>.</p>
</td>
</tr>
<tr>
Expand Down
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,15 @@ <h5 class="offcanvas-title" id="offcanvasExampleLabel">Settings</h5>
</select>
</div>
<div class="row p-2 d-none" id="choose-file-container">
<div class="col">
<div class="col-10 pe-0">
<div class="input-group">
<button class="btn btn-outline-secondary" type="button" id="list-file-selector">Select file</button>
<input type="text" class="form-control" id="custom-list-location" aria-describedby="list-file-selector" placeholder="No custom list set" disabled="" readonly="">
</div>
</div>
<div class="col ps-0 pe-4">
<span id="clear-custom-list" class="material-symbols-outlined btn btn-outline-secondary float-end p-1" title="Clear custom list">clear</span>
</div>
</div>
<div class="d-none" id="use-location-container">
<div class="form-switch ms-2">
Expand Down
16 changes: 15 additions & 1 deletion js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4404,6 +4404,19 @@ DOM.gain.addEventListener('input', () => {
case 'locate-missing-file': {
(async () => await locateFile(MISSING_FILE))();
break }
case 'clear-custom-list': {
config.customListFile[config.model] = '';
delete LIST_MAP.custom;
config.list = 'birds';
DOM.listToUse.value = config.list;
DOM.customListFile.value = '';
updateListIcon();
updatePrefs('config.json', config)
resetResults({clearSummary: true, clearPagination: true, clearResults: true});
setListUIState(config.list);
if (currentFile && STATE.analysisDone) worker.postMessage({ action: 'update-list', list: config.list, refreshResults: true })
break;
}
case 'compress-and-organise': {compressAndOrganise(); break}
case 'purge-file': { deleteFile(currentFile); break }

Expand Down Expand Up @@ -4597,7 +4610,8 @@ DOM.gain.addEventListener('input', () => {
config.list = element.value;
updateListIcon();
resetResults({clearSummary: true, clearPagination: true, clearResults: true});
worker.postMessage({ action: 'update-list', list: config.list, refreshResults: STATE.analysisDone});
// Don't call this for custom lists
config.list === 'custom' || worker.postMessage({ action: 'update-list', list: config.list, refreshResults: STATE.analysisDone});
break;
}
case 'locale': {
Expand Down

0 comments on commit 37c89e6

Please sign in to comment.