Sfoglia il codice sorgente

Link recordings to events in UI

master
Jan Svabenik 4 giorni fa
parent
commit
f306cb3379
2 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. +2
    -1
      internal/recorder/list.go
  2. +1
    -1
      web/app.js

+ 2
- 1
internal/recorder/list.go Vedi File

@@ -12,6 +12,7 @@ type Recording struct {
ID string `json:"id"` ID string `json:"id"`
Start time.Time `json:"start"` Start time.Time `json:"start"`
CenterHz float64 `json:"center_hz"` CenterHz float64 `json:"center_hz"`
EventID int64 `json:"event_id"`
Path string `json:"path"` Path string `json:"path"`
} }


@@ -38,7 +39,7 @@ func ListRecordings(root string) ([]Recording, error) {
if err := json.Unmarshal(b, &m); err != nil { if err := json.Unmarshal(b, &m); err != nil {
continue continue
} }
out = append(out, Recording{ID: id, Start: m.Start, CenterHz: m.CenterHz, Path: filepath.Join(root, id)})
out = append(out, Recording{ID: id, Start: m.Start, CenterHz: m.CenterHz, EventID: m.EventID, Path: filepath.Join(root, id)})
} }
sort.Slice(out, func(i, j int) bool { return out[i].Start.After(out[j].Start) }) sort.Slice(out, func(i, j int) bool { return out[i].Start.After(out[j].Start) })
return out, nil return out, nil


+ 1
- 1
web/app.js Vedi File

@@ -1138,7 +1138,7 @@ if (decodeEventBtn) {
const ev = eventsById.get(selectedEventId); const ev = eventsById.get(selectedEventId);
if (!ev) return; if (!ev) return;
if (!recordingMetaEl) return; if (!recordingMetaEl) return;
const rec = recordings.find(r => r.center_hz === ev.center_hz);
const rec = recordings.find(r => r.event_id === ev.id) || recordings.find(r => r.center_hz === ev.center_hz);
if (!rec) { if (!rec) {
decodeResultEl.textContent = 'Decode: no recording'; decodeResultEl.textContent = 'Decode: no recording';
return; return;


Loading…
Annulla
Salva