Skip to content

Commit

Permalink
- WIP adding per group custom labels (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardiesoft committed Feb 10, 2025
1 parent bf31c14 commit d6f812c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions browse-next/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions browse-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@
"leaflet": "^1.9.3",
"luxon": "^3.3.0",
"scale-color-perceptual": "^1.1.2",
"spectastiq": "github:hardiesoft/spectastiq#v0.9.4",
"suncalc": "^1.9.0",
"tesseract-wasm": "^0.10.0",
"tz-lookup-oss": "^6.3.0",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
"vue-router": "^4.5.0",
"spectastiq": "github:hardiesoft/spectastiq#v0.9.5"
},
"devDependencies": {
"@eslint/compat": "^1.2.0",
"@eslint/js": "^9.12.0",
"@rushstack/eslint-patch": "^1.2.0",
"@stylistic/eslint-plugin": "^2.9.0",
"@tsconfig/node16": "^1.0.4",
"@tsconfig/node18": "^2.0.1",
"@types/leaflet": "^1.9.3",
"@types/luxon": "^3.2.0",
Expand All @@ -61,7 +62,6 @@
"unplugin-vue-components": "^0.26.0",
"vite": "^6.0.11",
"vite-plugin-eslint": "^1.8.1",
"vue-tsc": "^1.6.5",
"@tsconfig/node16": "^1.0.4"
"vue-tsc": "^1.6.5"
}
}
14 changes: 10 additions & 4 deletions browse-next/src/components/ActivitySearchParameters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import type { ApiGroupResponse as ApiProjectResponse } from "@typedefs/api/group
import type { ApiStationResponse as ApiLocationResponse } from "@typedefs/api/station";
import { timezoneForLatLng } from "@models/visitsUtils.ts";
import { canonicalLatLngForLocations } from "@/helpers/Location.ts";
import { RecordingLabels } from "@/consts.ts";
import {
CameraRecordingLabels,
AudioRecordingLabels,
CommonRecordingLabels,
} from "@/consts.ts";
import { TagMode } from "@typedefs/api/consts.ts";
import {
ActivitySearchDisplayMode,
Expand Down Expand Up @@ -62,20 +66,22 @@ const currentProject = inject(currentActiveProject) as ComputedRef<
const availableProjects = inject(userProjects) as Ref<
LoadedResource<ApiProjectResponse[]>
>;
// FIXME: Add user selected labels. Probably wants to be a globally accessible function
const availableLabels = computed(() => {
const labels = RecordingLabels.slice(2).map(({ text, value }) => ({
const labels = CameraRecordingLabels.slice(2).map(({ text, value }) => ({
label: text,
value: (value || text).toLowerCase(),
}));
if (selectedCoolLabel.value) {
const label = RecordingLabels[0];
const label = CameraRecordingLabels[0];
labels.push({
label: label.text,
value: (label.value || label.text).toLowerCase(),
});
}
if (selectedFlaggedLabel.value) {
const label = RecordingLabels[1];
const label = CameraRecordingLabels[1];
labels.push({
label: label.text,
value: (label.value || label.text).toLowerCase(),
Expand Down
5 changes: 5 additions & 0 deletions browse-next/src/components/SpectrogramViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ const initInteractionHandlers = (context: CanvasRenderingContext2D) => {
for (const track of tracksIntermediate.value) {
const trackStart = track.start / audioDuration.value;
const trackEnd = track.end / audioDuration.value;
if (track.minFreq === undefined || track.maxFreq === undefined) {
alert("This track has no valid frequency range, so it can't be used.");
console.warn("track", track);
}
const minFreq = 1 - Math.max(0, track.minFreq || 0) / cropScaleY;
const maxFreq = 1 - Math.min(track.maxFreq || 0, cropScaleY) / cropScaleY;
const hitBox = getTrackBounds(
Expand Down Expand Up @@ -660,6 +664,7 @@ watch(pendingTrackClass, async (classification: string[]) => {
end_s: pendingTrack.value.end,
minFreq: pendingTrack.value.minFreq,
maxFreq: pendingTrack.value.maxFreq,
automatic: false,
};
const response = await createUserDefinedTrack(props.recording, payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const addPendingAudioLabel = async () => {
</card-table>

<div
class="d-flex flex-column flex-md-row justify-content-md-between mb-3 align-items-center"
class="d-flex flex-column flex-md-row justify-content-md-between my-3 align-items-center"
>
<h2 class="h6">Bird recording labels</h2>
<div class="d-flex align-items-end justify-content-end ms-md-5">
Expand Down

0 comments on commit d6f812c

Please sign in to comment.