forked from daryljones/stream_recorder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_concat.html
More file actions
68 lines (59 loc) · 2.36 KB
/
test_concat.html
File metadata and controls
68 lines (59 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<title>Test Concatenation API</title>
</head>
<body>
<h1>Test Concatenation API</h1>
<button onclick="testConcatenation()">Test Concatenation</button>
<div id="result"></div>
<script>
async function testConcatenation() {
const resultDiv = document.getElementById('result');
resultDiv.innerHTML = 'Testing concatenation...';
const testData = {
files: [
"20250828_150445_160_2_-_Sheriff.flac",
"20250828_150631_693_2_-_Sheriff.flac"
]
};
try {
console.log('Sending request:', testData);
const response = await fetch('/api/concatenate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(testData)
});
console.log('Response status:', response.status);
console.log('Response headers:', Object.fromEntries(response.headers.entries()));
if (response.ok) {
const result = await response.json();
console.log('Success result:', result);
resultDiv.innerHTML = `
<h3>✅ Success!</h3>
<p><strong>Files concatenated:</strong> ${result.files_concatenated}</p>
<p><strong>Output file:</strong> ${result.filename}</p>
<p><strong>Download URL:</strong> <a href="${result.download_url}" target="_blank">${result.download_url}</a></p>
<p><strong>Files included:</strong> ${result.file_list.join(', ')}</p>
`;
} else {
const errorText = await response.text();
console.error('Error response:', errorText);
resultDiv.innerHTML = `
<h3>❌ Error ${response.status}</h3>
<pre>${errorText}</pre>
`;
}
} catch (error) {
console.error('Request failed:', error);
resultDiv.innerHTML = `
<h3>❌ Request Failed</h3>
<p>${error.message}</p>
`;
}
}
</script>
</body>
</html>