smcgateway-sv 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onMount, onDestroy } from 'svelte';
|
|
2
|
+
import { onMount, onDestroy, type Snippet } from 'svelte';
|
|
3
3
|
import { recording } from './recording.svelte.js';
|
|
4
4
|
import InputDatetime from './InputDatetime.svelte';
|
|
5
5
|
import { colors } from './colours.js';
|
|
6
6
|
|
|
7
|
+
let { module = '', header }: { module?: string; header?: Snippet } = $props();
|
|
8
|
+
|
|
7
9
|
type Segment = {
|
|
8
10
|
url: string;
|
|
9
11
|
start: Date;
|
|
@@ -47,33 +49,40 @@
|
|
|
47
49
|
return segments.findIndex((s) => tMs >= s.start.getTime() && tMs < s.end.getTime());
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
$effect(() => {
|
|
53
|
+
module;
|
|
54
|
+
loadSegments();
|
|
55
|
+
});
|
|
56
|
+
|
|
50
57
|
async function loadSegments() {
|
|
51
58
|
isLoading = true;
|
|
52
59
|
error = '';
|
|
53
60
|
try {
|
|
54
61
|
const ret = await recording.getRecordings(windowStart, windowEnd);
|
|
55
62
|
// console.log('getRecordings()', ret);
|
|
56
|
-
segments = ret
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
color =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
segments = ret
|
|
64
|
+
.filter((r) => module == '' || r.file.startsWith(module))
|
|
65
|
+
.map((r) => {
|
|
66
|
+
let color = deviceColorMap[r.from];
|
|
67
|
+
if (!color) {
|
|
68
|
+
color = colors[nextColorIndex];
|
|
69
|
+
deviceColorMap[r.from] = color;
|
|
70
|
+
nextColorIndex++;
|
|
71
|
+
}
|
|
72
|
+
const startPercent = ((r.start.getTime() - windowStart.getTime()) / WINDOW_MS) * 100;
|
|
73
|
+
const durPercent = ((r.dur * 1000) / WINDOW_MS) * 100;
|
|
74
|
+
return {
|
|
75
|
+
url: `/api/recordings/${r.file}`,
|
|
76
|
+
start: r.start,
|
|
77
|
+
end: new Date(r.start.getTime() + r.dur * 1000),
|
|
78
|
+
from: r.from,
|
|
79
|
+
to: r.to,
|
|
80
|
+
startPercent,
|
|
81
|
+
durPercent,
|
|
82
|
+
color,
|
|
83
|
+
style: `left:${startPercent}%; width:${durPercent}%; background-color: ${color}`
|
|
84
|
+
};
|
|
85
|
+
});
|
|
77
86
|
} catch (e) {
|
|
78
87
|
error = 'Failed to fetch audio segments';
|
|
79
88
|
} finally {
|
|
@@ -189,6 +198,9 @@
|
|
|
189
198
|
</script>
|
|
190
199
|
|
|
191
200
|
<div class="player">
|
|
201
|
+
{#if header}
|
|
202
|
+
{@render header()}
|
|
203
|
+
{/if}
|
|
192
204
|
{@render selector(shiftWindow)}
|
|
193
205
|
{@render timeline()}
|
|
194
206
|
{@render callInfo(activeSegment)}
|
|
@@ -328,6 +340,7 @@ cursor: {new Date(cursor).toISOString()}<br /> -->
|
|
|
328
340
|
bottom: 0;
|
|
329
341
|
border-radius: 0;
|
|
330
342
|
border-right: 3px red solid;
|
|
343
|
+
margin-left: -1px;
|
|
331
344
|
}
|
|
332
345
|
.call {
|
|
333
346
|
position: absolute;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
module?: string;
|
|
4
|
+
header?: Snippet;
|
|
5
|
+
};
|
|
6
|
+
declare const AudioTimeLinePlayer: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
2
7
|
type AudioTimeLinePlayer = ReturnType<typeof AudioTimeLinePlayer>;
|
|
3
8
|
export default AudioTimeLinePlayer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import settings from './settings.svelte.js';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
module = $bindable(),
|
|
6
|
+
id = '',
|
|
7
|
+
class: className = '',
|
|
8
|
+
allName = 'All channels'
|
|
9
|
+
}: { module?: string; id?: string; class?: string; allName?: string } = $props();
|
|
10
|
+
|
|
11
|
+
let channels = $derived.by(() => {
|
|
12
|
+
let v = settings.all['channels'];
|
|
13
|
+
if (v) {
|
|
14
|
+
return Object.keys(v).map((k) => {
|
|
15
|
+
return { module: k, name: v[k] };
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<select {id} class={className} bind:value={module}>
|
|
24
|
+
{#if allName}
|
|
25
|
+
<option value="">{allName}</option>
|
|
26
|
+
{/if}
|
|
27
|
+
{#each channels as c}
|
|
28
|
+
<option value={c.module}>{c.name}</option>
|
|
29
|
+
{/each}
|
|
30
|
+
</select>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
module?: string;
|
|
3
|
+
id?: string;
|
|
4
|
+
class?: string;
|
|
5
|
+
allName?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const SelectChannel: import("svelte").Component<$$ComponentProps, {}, "module">;
|
|
8
|
+
type SelectChannel = ReturnType<typeof SelectChannel>;
|
|
9
|
+
export default SelectChannel;
|
package/dist/settings.svelte.js
CHANGED
|
@@ -10,7 +10,7 @@ class Settings {
|
|
|
10
10
|
.then(resp => {
|
|
11
11
|
if (resp.status === 200) {
|
|
12
12
|
const regSection = /\[([a-zA-Z0-9]+)\]/;
|
|
13
|
-
const regKeyVal = /([a-zA-
|
|
13
|
+
const regKeyVal = /([a-zA-Z0-9_-]+) *= *(.*)/;
|
|
14
14
|
resp.text().then(t => {
|
|
15
15
|
try {
|
|
16
16
|
this.all = JSON.parse(t);
|